id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
5054,LLVM Errors with test cases,arsenm,dterei,"I encountered a build error when using the LLVM backend on my homework. I attempted to get a reduced test case, but ended up running into a different problem. I don't really have the time to reduce these to simpler cases right now, and I figured it would be better to report this rather than doing nothing.

In the original problem, the build fails with:
{{{
$ ghc -fllvm -O2 TestCase.hs
[1 of 1] Compiling Main             ( TestCase.hs, TestCase.o )
LLVM ERROR: Cannot yet select: 0x2793a60: f64 = sint_to_fp 0x2795aa0 [ORD=2066] [ID=74]
  0x2795aa0: i64 = add 0x27b9e30, 0x2791990 [ORD=2065] [ID=72]
    0x27b9e30: i64,ch = load 0x2761e08, 0x2796db0, 0x27927a0<LD8[%ln79D]> [ORD=2064] [ID=70]
      0x2761e08: ch = EntryToken [ORD=2061] [ID=0]
      0x2796db0: i64 = add 0x27977b0, 0x27967a0 [ORD=2062] [ID=64]
        0x27977b0: i64,ch = CopyFromReg 0x2761e08, 0x27a76b0 [ORD=2062] [ID=45]
          0x2761e08: ch = EntryToken [ORD=2061] [ID=0]
          0x27a76b0: i64 = Register %reg16387 [ORD=2062] [ID=2]
        0x27967a0: i64 = Constant<7> [ORD=2062] [ID=3]
      0x27927a0: i64 = undef [ORD=2064] [ID=4]
    0x2791990: i64 = Constant<-1> [ORD=2065] [ID=5]

}}}

The second error I encountered was:

TestCase2.hs:
{{{
ghc -fforce-recomp -fllvm -O2 TestCase2.hs
[1 of 1] Compiling Main             ( TestCase2.hs, TestCase2.o )
LLVM ERROR: Cannot yet select: 0x13834e0: f64 = ConstantFP<0.000000e+00> [ORD=1600] [ID=7]
}}}

Replacing the peek/poke with undefined seems to make the errors go away. The programs build and work correctly with the default NCG, and with -O0. The errors happen with -O1 and -O2. Both were using LLVM 2.8 on Linux x86_64.
",bug,closed,normal,7.4.1,Compiler (LLVM),7.0.2,fixed,,,Unknown/Multiple,Unknown/Multiple,Compile-time crash,,,,,
