Skip to content
  • Ben Gamari's avatar
    fee015b5
    PrelRules: Don't break let/app invariant in shiftRule · fee015b5
    Ben Gamari authored
    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.
    
    (cherry picked from commit 0bd3b9dd)
    fee015b5
    PrelRules: Don't break let/app invariant in shiftRule
    Ben Gamari authored
    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.
    
    (cherry picked from commit 0bd3b9dd)
Loading