Arbitrarily large expressions built out of cheap primops are not floated out
While investigating #13338 (closed) I was tripped up by the fact that GHC won't float out even a large expression like the product in
\i# -> magic# (x# *# 2# *# 2# *# 2# *# 2# *# 2# *# 2# *# 2# *# 2# -# i#)
The test involved here is exprIsCheap
. The fact that *#
is a cheap primop makes exprIsCheap
think the whole expression is cheap; but clearly there must come some point where it would be better to float out the expression.
Perhaps exprIsCheap
should work more like exprIsDupable
, and take the size of the expression into account. See related comments on primOpIsCheap
, though this ticket is about saving runtime work, not code size.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |