[llvm] Reland [SimplifyCFG] Delete the unnecessary range check for small mask operation (PR #70542)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 18:13:56 PDT 2023
================
@@ -107,3 +103,61 @@ lor.end:
%0 = phi i8 [ 15, %sw.bb0 ], [ 6, %sw.bb1 ], [ 7, %sw.bb2 ], [ 0, %default ]
ret i8 %0
}
+
+; Negative test: The default branch is reachable, but has no result.
+define i1 @switch_lookup_with_small_i1_default_no_results(i32 %x) {
+; CHECK-LABEL: @switch_lookup_with_small_i1_default_no_results(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 15
+; CHECK-NEXT: ret i1 false
+;
+entry:
+ %and = and i32 %x, 15
+ switch i32 %and, label %default [
+ i32 4, label %phi.end
+ i32 2, label %phi.end
+ i32 10, label %phi.end
+ i32 9, label %phi.end
+ i32 1, label %sw.bb1.i
+ i32 3, label %sw.bb1.i
+ i32 5, label %sw.bb1.i
+ i32 0, label %sw.bb1.i
+ i32 6, label %sw.bb1.i
+ i32 7, label %sw.bb1.i
+ i32 8, label %sw.bb1.i
+ ]
+
+sw.bb1.i: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry
+ br label %phi.end
+
+default: ; preds = %entry
+ unreachable
----------------
vfdff wrote:
ok, thanks very much for detail case, I'll update this.
https://github.com/llvm/llvm-project/pull/70542
More information about the llvm-commits
mailing list