Skip to content

Improve constant folding for and/or

GHC has a constant folding rule

(e .&. v) .&. v ~~> e .&. v

added in !6167 (closed).

This rule will not simplify (e .&. 0xFA) .&. 0xAF to e .&. 0xAA. This should be doable by code analogous to https://gitlab.haskell.org/ghc/ghc/-/blob/9b719549fda563fb80b197fb47d9e508c7989d2d/compiler/GHC/Core/Opt/ConstantFold.hs#L2728.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information