#4992: LLVM trashes registers for primitive calls
--------------------------------+-------------------------------------------
Reporter: scpmw | Owner: davidterei@…
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler (LLVM) | Version: 7.1
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Linux | Blocking:
Architecture: x86_64 (amd64) | Failure: Runtime crash
--------------------------------+-------------------------------------------
Comment(by scpmw):
Producing a test case for isn't straightforward... It would have to
construct a situation where LLVM is pressured for (non-floating-point)
registers while at the same time making heavy use of LLVM primitives. At
the moment, these all concern floating-point operations, which makes this
hard. Using "round", for example, makes the code pieces end up in
different thunks. I suppose that's the reason why this problem hasn't
shown up so far.
It might be possible to come up with something by addressing the primops
directly and using unsafeCoerce in order to force GHC to pull some ints
out of nowhere... But I'm not really sure the testcase would even be
useful at that point.
The problem surfaced for me when I tried to add a primop for querying the
cycle counter (llvm.readcyclecounter), which always uses two integer
registers and therefore quickly ends up overwriting important stuff.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4992#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs