#4308: LLVM compiles Updates.cmm badly
---------------------------------+------------------------------------------
Reporter: dterei | Owner: dterei
Type: bug | Status: new
Priority: normal | Milestone: 7.2.1
Component: Compiler (LLVM) | Version: 6.13
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: x86_64 (amd64) | Failure: Runtime performance bug
---------------------------------+------------------------------------------
Comment(by dterei):
OK, writebarrier problem fixed, patch in my repo waiting to be pushed.
The extra spills is a little more tricky but a bad bug that needs fixing
asap. Basically because I always pass the STG registers around their live
range is the entire function. Across C calls this is bad since some of
them are caller save and get spilled. To fix this I currently store an
'undef' value into the STG registers that are caller save just before the
C call. This is kind of like live range splitting. This is a naive fix as
if the C call is in one of the branches of say a diamond control flow then
in one branch the stg regs are undefined, in the other they are defined as
the value they were on entry. Hence why we still get the spilling of them.
So need to handle when the C call is in a branch of a if-else or case
statement. Either bubble up or down to the entry or exit node. Or perhaps
keep track of what STG regs are actually modified in a method and don't
pass through those that aren't. Not sure if this later approach is safe
but it seems to produce better code so is preferred if it works.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4308#comment:5>
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