Opened 6 years ago

Closed 5 years ago

Last modified 10 months ago

#5054 closed bug (fixed)

LLVM Errors with test cases

Reported by: arsenm Owned by: dterei
Priority: normal Milestone: 7.4.1
Component: Compiler (LLVM) Version: 7.0.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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:


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.

Attachments (2)

TestCase.hs (4.8 KB) - added by arsenm 6 years ago.
First test case
TestCase2.hs (1.4 KB) - added by arsenm 6 years ago.
Second test case

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by arsenm

Attachment: TestCase.hs added

First test case

Changed 6 years ago by arsenm

Attachment: TestCase2.hs added

Second test case

comment:1 Changed 6 years ago by dterei

Sorry but I can't reproduce this bug. Can you confirm which OS you are using, which llvm version (and where you got it from) and which ghc version.

comment:2 Changed 6 years ago by simonmar

Status: newinfoneeded

comment:3 Changed 6 years ago by arsenm

Status: infoneedednew

This is with Arch Linux x86_64, ghc 7.0.2 and llvm 2.8, both installed from the Arch repositories (ghc 7.0.2-1, llvm 2.8-5). Also note that it only happens with optimizations, -O2 which I'm not sure I made clear before.

comment:4 Changed 6 years ago by igloo

Milestone: 7.2.1

comment:5 Changed 6 years ago by dterei

Owner: changed from davidterei@… to dterei

comment:6 Changed 6 years ago by dterei

There is more evidence of this bug, or something like this:

Will have to replicate setup exactly to find the problem.

comment:7 Changed 5 years ago by igloo


comment:8 Changed 5 years ago by dterei

Resolution: fixed
Status: newclosed

Closing as I've never been able to reproduce and it was a bug in LLVM itself and in version 2.8 when we are up to 3.0 now. Feel free to reopen if you come across this issue again and can reproduce.

comment:9 Changed 10 months ago by Thomas Miedema <thomasmiedema@…>

In e20b3ed0/ghc:

Testsuite: delete T5054 and T5054_2 (#5054)

These tests no longer compile, because the hmatrix api has completely
changed. Even if we managed to fix the tests, I don't think they would
provided much value, since the ghc/llvm bug from #5054 was not
reproducible in the first place.

Reviewed by: bgamari

Differential Revision:
Note: See TracTickets for help on using tickets.