aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-10-08 20:52:47 +0200
committerTom Smeding <tom@tomsmeding.com>2025-10-08 20:52:47 +0200
commitec3b8471a6549f46e36b0e601041b835b18cdc3f (patch)
tree4c3715163e3b67674333ada706c471fb312f5b16 /src
parentb8c5c85e24df82462f03b47b298573206e7b7f80 (diff)
Simplify: Don't forget effects, again
This didn't actually result in any test failures, but I caught it while hunting for a bug that turned out to be missing scaleMany in the new occCount.
Diffstat (limited to 'src')
-rw-r--r--src/Simplify.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Simplify.hs b/src/Simplify.hs
index 28b6d60..ac1570b 100644
--- a/src/Simplify.hs
+++ b/src/Simplify.hs
@@ -200,12 +200,12 @@ simplify'Rec = \case
EMaybe ext (ESnd ext e1) (ESnd ext e2) e3
-- TODO: more array indexing
- EIdx _ (EBuild _ _ _ e1) e2 -> acted $ simplify' $ elet e2 e1
- EIdx _ (EReplicate1Inner _ _ e2) e3 -> acted $ simplify' $ EIdx ext e2 (EFst ext e3)
- EIdx _ (EUnit _ e1) _ -> acted $ simplify' $ e1
+ EIdx _ (EBuild _ _ e1 e2) e3 | not (hasAdds e1) -> acted $ simplify' $ elet e3 e2
+ EIdx _ (EReplicate1Inner _ e1 e2) e3 | not (hasAdds e1) -> acted $ simplify' $ EIdx ext e2 (EFst ext e3)
+ EIdx _ (EUnit _ e1) e2 | not (hasAdds e2) -> acted $ simplify' $ e1
-- TODO: more array shape
- EShape _ (EBuild _ _ e _) -> acted $ simplify' e
+ EShape _ (EBuild _ _ e1 e2) | not (hasAdds e2) -> acted $ simplify' e1
-- TODO: more constant folding
EOp _ OIf (EConst _ STBool True) -> acted $ return (EInl ext STNil (ENil ext))