[llvm] [LVI] Generalize mask not equal conditions handling (PR #92946)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 09:49:27 PDT 2024
================
@@ -1475,3 +1474,37 @@ entry:
%select = select i1 %cmp1, i1 %cmp2, i1 false
ret i1 %select
}
+
+declare void @opaque()
+
+define void @test_icmp_ne_from_implied_range(i32 noundef %arg) {
+; CHECK-LABEL: @test_icmp_ne_from_implied_range(
+; CHECK-NEXT: [[AND_MASK:%.*]] = and i32 [[ARG:%.*]], -8
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND_MASK]], -16
+; CHECK-NEXT: br i1 [[CMP]], label [[END:%.*]], label [[ELSE:%.*]]
+; CHECK: else:
+; CHECK-NEXT: br label [[END]]
+; CHECK: sw.case:
+; CHECK-NEXT: call void @opaque()
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: ret void
+;
+ %and.mask = and i32 %arg, -8
+ %cmp = icmp eq i32 %and.mask, -16
+ br i1 %cmp, label %end, label %else
+
+else:
+ switch i32 %arg, label %end [
+ i32 -16, label %sw.case
+ i32 -12, label %sw.case
+ i32 -9, label %sw.case
+ ]
+
+sw.case:
+ call void @opaque()
+ br label %end
+
+end:
+ ret void
+}
----------------
goldsteinn wrote:
Can you please split the test to a seperate commit so we can see the diff from your code changes?
https://github.com/llvm/llvm-project/pull/92946
More information about the llvm-commits
mailing list