[llvm] [SCCP] Remove masking operations (PR #142736)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 00:48:19 PDT 2025


================
@@ -131,8 +129,7 @@ define void @val_undef_to_cr_to_overdef_range(i32 %a, i1 %cond) {
 ; CHECK-NEXT:    br i1 [[BC_1]], label [[TRUE:%.*]], label [[FALSE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    call void @use(i1 false)
-; CHECK-NEXT:    [[P_127:%.*]] = and i32 [[P]], 127
-; CHECK-NEXT:    call void @use.i32(i32 [[P_127]])
+; CHECK-NEXT:    call void @use.i32(i32 [[P]])
----------------
nikic wrote:

It would be good to add a replacement test though where it's actually invalid to remove the and due to undef. E.g. a case where you have a phi with one undef operand and one known-masked operand, and then a mask on the phi.

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


More information about the llvm-commits mailing list