aboutsummaryrefslogtreecommitdiff
path: root/src/Simplify.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Simplify.hs')
-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))