Primitive string literals prevent optimization
Using an Addr# literal seems to result in less aggressive optimization. If I compile the attached program like this:
ghc -O2 -fforce-recomp -ddump-simpl addr.hs
the code is optimized nicely. Everything are inlined into t, intermediate pairs are eliminated, etc.
However, when I replace the Int# literals in the code with Addr# literals by defining the ADDR macro:
ghc -O2 -fforce-recomp -ddump-simpl -DADDR addr.hs
GHC now creates 2 extra top-level bindings, each of which allocates a pair. I don't see why the presence of Addr# literals should prevent inlining, so I'm reporting a bug.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |