[llvm] [LV] Add extra check for signed oveflow for SDiv/SRem (PR #170818)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 09:31:26 PST 2025


================
@@ -115,7 +115,8 @@ define void @loop_invariant_srem(ptr %p, i64 %a, i8 %b) {
 ; CHECK-NEXT:    [[PREDPHI:%.*]] = select <4 x i1> [[TMP5]], <4 x i32> [[TMP3]], <4 x i32> [[TMP2]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = shl <4 x i32> [[PREDPHI]], splat (i32 8)
 ; CHECK-NEXT:    [[TMP8:%.*]] = trunc <4 x i32> [[TMP7]] to <4 x i8>
-; CHECK-NEXT:    [[TMP11:%.*]] = srem <4 x i8> [[VEC_IND1]], [[TMP8]]
+; CHECK-NEXT:    [[TMP9:%.*]] = select <4 x i1> [[TMP4]], <4 x i8> [[TMP8]], <4 x i8> splat (i8 1)
+; CHECK-NEXT:    [[TMP11:%.*]] = srem <4 x i8> [[VEC_IND1]], [[TMP9]]
----------------
topperc wrote:

Does this need the select? The case I filed the bug for was specific to EVL vectorization due to the load being EVL predicated.

https://github.com/llvm/llvm-project/pull/170818


More information about the llvm-commits mailing list