[llvm-dev] RFC: Killing undef and spreading poison

John Regehr via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 7 14:27:37 PDT 2017


Peter, it looks to me like you've misunderstood how nsw works.  You are 
saying that the transformation below is incorrect.  If it is incorrect, 
there needs to be a valuation of x and y (and also a choice of "..." and 
"condition") that causes the transformed code to call use(t) with a 
different t than the original code would have.  Please tell us those values.

John


>    for (...) {
>      if (condition){
>        i32 prod = x *nsw y
>        i64 prod.sext = sext prod to i64
>        i64 t = K `udiv` (-1 + (sum.prod >> 32))
>        use(t)
>      }
>    }
>
> ==> (step 1) multiplication and sext can be speculated
>
>    i32 prod = x *nsw y
>    i64 prod.sext = sext prod to i64
>    for (...) {
>      if (condition){
>        i64 t = K `udiv` (-1 + (prod.sext >> 32))
>        use(t)
>      }
>    }


More information about the llvm-dev mailing list