Constant folding in Core could be better
Constant folding in Core is still a bit feeble. For example, when staring at the code for nofib/shootout/k-nucleotide I saw this expression:
(x +# 8) -# 1
which would be relatively easy to optimise.
The difficulty is knowing where to stop. What about (8 +# x) -# 1?
Anyway, this ticket is to record the issue. Currently constant folding is done by the built-in RULES in compiler/prelude/PrelRules.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |