You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could fix this problem if the `RULES` pragmas could identify constants instead of variables. This would let us commute/associate the constants to the left of all computations, then GHC's standard constant folding mechanism would work successfully.
62
+
If we change the code so that the constants appear next to each other:
63
+
64
+
```
65
+
test3 d1 d2 = d1*d2 + d1*10 + d1*20
66
+
```
67
+
68
+
then GHC successfully combines the constants.
69
+
70
+
We could fix this problem if the `RULES` pragmas could identify which terms are constants and which are variables. This would let us commute/associate the constants to the left of all computations, then GHC's standard constant folding mechanism would work successfully.
63
71
64
72
**The best way to check what optimizations are actually supported is to look at the source code.**`RULES` pragmas are surprisingly readable.
0 commit comments