PrelRules: Don't break let/app invariant in shiftRule
Previously shiftRule would rewrite as invalid shift like ``` let x = I# (uncheckedIShiftL# n 80) in ... ``` to ``` let x = I# (error "invalid shift") in ... ``` However, this breaks the let/app invariant as `error` is not okay-for-speculation. There isn't an easy way to avoid this so let's not try. Instead we just take advantage of the undefined nature of invalid shifts and return zero. Fixes #16742.
Showing
- compiler/coreSyn/CoreSyn.hs 3 additions, 0 deletionscompiler/coreSyn/CoreSyn.hs
- compiler/prelude/PrelRules.hs 22 additions, 3 deletionscompiler/prelude/PrelRules.hs
- compiler/prelude/PrimOp.hs 21 additions, 0 deletionscompiler/prelude/PrimOp.hs
- testsuite/tests/codeGen/should_run/T16449_2.hs 4 additions, 0 deletionstestsuite/tests/codeGen/should_run/T16449_2.hs
- testsuite/tests/codeGen/should_run/T16449_2.stderr 0 additions, 1 deletiontestsuite/tests/codeGen/should_run/T16449_2.stderr
- testsuite/tests/codeGen/should_run/T16449_2.stdout 2 additions, 0 deletionstestsuite/tests/codeGen/should_run/T16449_2.stdout
- testsuite/tests/codeGen/should_run/all.T 1 addition, 1 deletiontestsuite/tests/codeGen/should_run/all.T
Loading
Please register or sign in to comment