[PATCH] D48987: [InstCombine] drop poison flags for shuffle transforms with undefs

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 15:32:58 PDT 2018


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/shuffle_select.ll:521
 ; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <4 x i32> [[V0:%.*]], <4 x i32> [[V1:%.*]], <4 x i32> <i32 undef, i32 5, i32 2, i32 undef>
-; CHECK-NEXT:    [[T3:%.*]] = shl nsw <4 x i32> [[TMP1]], <i32 undef, i32 6, i32 3, i32 undef>
+; CHECK-NEXT:    [[T3:%.*]] = shl <4 x i32> [[TMP1]], <i32 undef, i32 6, i32 3, i32 undef>
 ; CHECK-NEXT:    ret <4 x i32> [[T3]]
----------------
nlopes wrote:
> Everything looks good, except this one.
> As discussed in the other patch, `a << undef` is poison, so you can't introduce it. (since it's not correct to replace undef with poison).
Hmm...how is this case different than the 'shl_shl' above?

Are there 4 cases?
1. Instructions with immediate UB (srem, urem).
2. Instructions with immediate UB and poison with flags (sdiv, udiv).
3. Instructions with poison regardless of flags (shl, ashr, lshr).
4. Instructions with poison only with flags (mul, add, sub).




https://reviews.llvm.org/D48987





More information about the llvm-commits mailing list