[llvm] [InstCombine] Drop poison-generating/UB-implying param attrs after changing operands (PR #115988)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 09:27:26 PST 2024


================
@@ -1541,3 +1541,14 @@ define <2 x i32> @test_umax_smax_vec_neg(<2 x i32> %x) {
   %umax = call <2 x i32> @llvm.umax.v2i32(<2 x i32> %smax, <2 x i32> <i32 1, i32 10>)
   ret <2 x i32> %umax
 }
+
+; Make sure that poison-generating/UB-implying parameters are dropped
+
+define i32 @umax_commute_operand_drop_attrs(i32 %x) {
+; CHECK-LABEL: @umax_commute_operand_drop_attrs(
+; CHECK-NEXT:    [[RET:%.*]] = call range(i32 -10, 0) i32 @llvm.umax.i32(i32 [[X:%.*]], i32 -10)
----------------
arsenm wrote:

I don't understand how this shows a fix. All it did was commute the operands, so the attributes could have been preserved? 

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


More information about the llvm-commits mailing list