LlvmCodeGen: Fix generation of malformed LLVM blocks
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 12 Mar 2016 11:03:56 +0000 (12:03 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sat, 12 Mar 2016 11:03:56 +0000 (12:03 +0100)
commit92821ec9a57817e1429ae94c756539259488b728
treea8bd8a2dfbbee57b83bc5f832896d7851237e4ea
parent41051dd846c3a7fc01cbb8ad3b7dd2b4332f7f0b
LlvmCodeGen: Fix generation of malformed LLVM blocks

Commit 673efccb3b uncovered a bug in LLVM code generation that produced
LLVM code that the LLVM compiler refused to compile:

    {
    clpH:
      br label %clpH
    }

This may well be a bug in LLVM itself. The solution is to keep the
existing entry label and rewrite the function as:

    {
    clpH:
      br label %nPV
    nPV:
      br label %nPV
    }

Thanks to Ben Gamari for pointing me in the right direction on this
one.

Test Plan: Build GHC with BuildFlavour=quick-llvm

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1996

GHC Trac Issues: #11649
compiler/llvmGen/LlvmCodeGen.hs
testsuite/tests/llvm/should_compile/T11649.hs [new file with mode: 0644]
testsuite/tests/llvm/should_compile/all.T