[SimplifyCFG] Regenerate test checks (NFC)

This commit is contained in:
Nikita Popov 2020-06-28 20:50:02 +02:00
parent 30e818852b
commit 8a71a5f127
4 changed files with 91 additions and 52 deletions

View File

@ -34,8 +34,8 @@ define i32 @t(i32 %m) nounwind readnone {
; FWD-LABEL: @t(
; FWD-NEXT: entry:
; FWD-NEXT: [[SWITCH:%.*]] = icmp ult i32 [[M:%.*]], 4
; FWD-NEXT: [[M_:%.*]] = select i1 [[SWITCH]], i32 [[M]], i32 4
; FWD-NEXT: ret i32 [[M_]]
; FWD-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[SWITCH]], i32 [[M]], i32 4
; FWD-NEXT: ret i32 [[SPEC_SELECT]]
;
entry:
switch i32 %m, label %sw.bb4 [

View File

@ -41,7 +41,7 @@ define i32 @f(i32 %c) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.f, i32 0, i32 [[SWITCH_TABLEIDX]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i32 15
@ -80,7 +80,7 @@ define i8 @char(i32 %c) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [9 x i8], [9 x i8]* @switch.table.char, i32 0, i32 [[SWITCH_TABLEIDX]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i8, i8* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i8, i8* [[SWITCH_GEP]], align 1
; CHECK-NEXT: ret i8 [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i8 15
@ -126,7 +126,7 @@ define void @h(i32 %x) {
; CHECK-NEXT: [[SWITCH_DOWNSHIFT:%.*]] = lshr i32 89655594, [[SWITCH_SHIFTAMT]]
; CHECK-NEXT: [[SWITCH_MASKED:%.*]] = trunc i32 [[SWITCH_DOWNSHIFT]] to i8
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x float], [4 x float]* @switch.table.h, i32 0, i32 [[X]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load float, float* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load float, float* [[SWITCH_GEP]], align 4
; CHECK-NEXT: br label [[SW_EPILOG]]
; CHECK: sw.epilog:
; CHECK-NEXT: [[A_0:%.*]] = phi i8 [ [[SWITCH_MASKED]], [[SWITCH_LOOKUP]] ], [ 7, [[ENTRY:%.*]] ]
@ -171,7 +171,7 @@ define i8* @foostring(i32 %x) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x i8*], [4 x i8*]* @switch.table.foostring, i32 0, i32 [[X]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i8*, i8** [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i8*, i8** [[SWITCH_GEP]], align 8
; CHECK-NEXT: ret i8* [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str4, i64 0, i64 0)
@ -209,7 +209,7 @@ define i32 @earlyreturncrash(i32 %x) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[SW_EPILOG:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.earlyreturncrash, i32 0, i32 [[X]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
; CHECK: sw.epilog:
; CHECK-NEXT: ret i32 7
@ -383,7 +383,7 @@ define i32 @large(i32 %x) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [199 x i32], [199 x i32]* @switch.table.large, i32 0, i32 [[SWITCH_TABLEIDX]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i32 0
@ -813,7 +813,7 @@ define i32 @cprop(i32 %x, i32 %y) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.cprop, i32 0, i32 [[SWITCH_TABLEIDX]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i32 123
@ -862,7 +862,7 @@ define i32 @unreachable_case(i32 %x) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [9 x i32], [9 x i32]* @switch.table.unreachable_case, i32 0, i32 [[X]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i32 2
@ -896,7 +896,7 @@ define i32 @unreachable_default(i32 %x) {
; CHECK-LABEL: @unreachable_default(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.unreachable_default, i32 0, i32 [[X:%.*]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
;
entry:
@ -976,7 +976,7 @@ define i32 @nodefaultnoholes(i32 %c) {
; CHECK-NEXT: unreachable
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.nodefaultnoholes, i32 0, i32 [[C]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
;
entry:
@ -1014,7 +1014,7 @@ define i32 @nodefaultwithholes(i32 %c) {
; CHECK-NEXT: br i1 [[SWITCH_LOBIT]], label [[SWITCH_LOOKUP:%.*]], label [[SW_DEFAULT]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.nodefaultwithholes, i32 0, i32 [[C]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
;
entry:
@ -1079,7 +1079,7 @@ define i32 @threecases(i32 %c) {
; CHECK-NEXT: br i1 [[TMP0]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.threecases, i32 0, i32 [[C]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: ret i32 [[SWITCH_LOAD]]
; CHECK: return:
; CHECK-NEXT: ret i32 3
@ -1550,7 +1550,7 @@ define i32 @covered_switch_with_bit_tests(i3) {
; CHECK: switch.lookup:
; CHECK-NEXT: [[SWITCH_TABLEIDX_ZEXT:%.*]] = zext i3 [[SWITCH_TABLEIDX]] to i4
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.covered_switch_with_bit_tests, i32 0, i4 [[SWITCH_TABLEIDX_ZEXT]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i32, i32* [[SWITCH_GEP]], align 4
; CHECK-NEXT: br label [[L6]]
; CHECK: l6:
; CHECK-NEXT: [[R:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[SWITCH_LOAD]], [[SWITCH_LOOKUP]] ]

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -simplifycfg -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
@ -5,36 +6,41 @@ declare i32 @__gxx_personality_v0(...)
declare void @fn()
; CHECK-LABEL: @test1
define void @test1() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @fn()
; CHECK-NEXT: to label [[INVOKE2:%.*]] unwind label [[LPAD2:%.*]]
; CHECK: invoke2:
; CHECK-NEXT: invoke void @fn()
; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD2]]
; CHECK: invoke.cont:
; CHECK-NEXT: ret void
; CHECK: lpad2:
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: ret void
;
entry:
; CHECK-LABEL: entry:
; CHECK: to label %invoke2 unwind label %lpad2
invoke void @fn()
to label %invoke2 unwind label %lpad1
to label %invoke2 unwind label %lpad1
invoke2:
; CHECK-LABEL: invoke2:
; CHECK: to label %invoke.cont unwind label %lpad2
invoke void @fn()
to label %invoke.cont unwind label %lpad2
to label %invoke.cont unwind label %lpad2
invoke.cont:
ret void
lpad1:
%exn = landingpad {i8*, i32}
cleanup
cleanup
br label %shared_resume
lpad2:
; CHECK-LABEL: lpad2:
; CHECK: landingpad { i8*, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: ret void
%exn2 = landingpad {i8*, i32}
cleanup
cleanup
br label %shared_resume
shared_resume:
@ -44,31 +50,48 @@ shared_resume:
; Don't trigger if blocks aren't the same/empty
define void @neg1() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @neg1
; CHECK-LABEL: @neg1(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @fn()
; CHECK-NEXT: to label [[INVOKE2:%.*]] unwind label [[LPAD1:%.*]]
; CHECK: invoke2:
; CHECK-NEXT: invoke void @fn()
; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD2:%.*]]
; CHECK: invoke.cont:
; CHECK-NEXT: ret void
; CHECK: lpad1:
; CHECK-NEXT: [[EXN:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: filter [0 x i8*] zeroinitializer
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: br label [[SHARED_RESUME:%.*]]
; CHECK: lpad2:
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[SHARED_RESUME]]
; CHECK: shared_resume:
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: ret void
;
entry:
; CHECK-LABEL: entry:
; CHECK: to label %invoke2 unwind label %lpad1
invoke void @fn()
to label %invoke2 unwind label %lpad1
to label %invoke2 unwind label %lpad1
invoke2:
; CHECK-LABEL: invoke2:
; CHECK: to label %invoke.cont unwind label %lpad2
invoke void @fn()
to label %invoke.cont unwind label %lpad2
to label %invoke.cont unwind label %lpad2
invoke.cont:
ret void
lpad1:
%exn = landingpad {i8*, i32}
filter [0 x i8*] zeroinitializer
filter [0 x i8*] zeroinitializer
call void @fn()
br label %shared_resume
lpad2:
%exn2 = landingpad {i8*, i32}
cleanup
cleanup
br label %shared_resume
shared_resume:
@ -78,30 +101,46 @@ shared_resume:
; Should not trigger when the landing pads are not the exact same
define void @neg2() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @neg2
; CHECK-LABEL: @neg2(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @fn()
; CHECK-NEXT: to label [[INVOKE2:%.*]] unwind label [[LPAD1:%.*]]
; CHECK: invoke2:
; CHECK-NEXT: invoke void @fn()
; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD2:%.*]]
; CHECK: invoke.cont:
; CHECK-NEXT: ret void
; CHECK: lpad1:
; CHECK-NEXT: [[EXN:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: filter [0 x i8*] zeroinitializer
; CHECK-NEXT: br label [[SHARED_RESUME:%.*]]
; CHECK: lpad2:
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[SHARED_RESUME]]
; CHECK: shared_resume:
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: ret void
;
entry:
; CHECK-LABEL: entry:
; CHECK: to label %invoke2 unwind label %lpad1
invoke void @fn()
to label %invoke2 unwind label %lpad1
to label %invoke2 unwind label %lpad1
invoke2:
; CHECK-LABEL: invoke2:
; CHECK: to label %invoke.cont unwind label %lpad2
invoke void @fn()
to label %invoke.cont unwind label %lpad2
to label %invoke.cont unwind label %lpad2
invoke.cont:
ret void
lpad1:
%exn = landingpad {i8*, i32}
filter [0 x i8*] zeroinitializer
filter [0 x i8*] zeroinitializer
br label %shared_resume
lpad2:
%exn2 = landingpad {i8*, i32}
cleanup
cleanup
br label %shared_resume
shared_resume:

View File

@ -11,7 +11,7 @@ define i32 @basic(i1 %cond_0, i32* %p) {
; CHECK-NEXT: [[DEOPTRET:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
; CHECK-NEXT: ret i32 [[DEOPTRET]]
; CHECK: guarded:
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]], align 4
; CHECK-NEXT: [[COND_1:%.*]] = icmp eq i32 [[V]], 0
; CHECK-NEXT: br i1 [[COND_1]], label [[RETURN:%.*]], label [[DEOPT]], !prof !0
; CHECK: return:
@ -84,7 +84,7 @@ define i32 @basic_swapped_branch(i1 %cond_0, i32* %p) {
; CHECK-NEXT: [[DEOPTRET:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
; CHECK-NEXT: ret i32 [[DEOPTRET]]
; CHECK: guarded:
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]], align 4
; CHECK-NEXT: [[COND_1:%.*]] = icmp eq i32 [[V]], 0
; CHECK-NEXT: br i1 [[COND_1]], label [[DEOPT]], label [[RETURN:%.*]], !prof !0
; CHECK: return:
@ -324,7 +324,7 @@ define i32 @neg_correlated(i1 %cond_0, i1 %cond_1, i32* %p) {
; CHECK-NEXT: [[DEOPTRET2:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
; CHECK-NEXT: ret i32 [[DEOPTRET2]]
; CHECK: guarded2:
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]], align 4
; CHECK-NEXT: [[COND_2:%.*]] = icmp eq i32 [[V]], 0
; CHECK-NEXT: br i1 [[COND_2]], label [[RETURN:%.*]], label [[DEOPT3:%.*]], !prof !0
; CHECK: deopt3:
@ -372,7 +372,7 @@ define i32 @trivial_wb(i1 %cond_0, i32* %p) {
; CHECK-NEXT: [[DEOPTRET:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
; CHECK-NEXT: ret i32 [[DEOPTRET]]
; CHECK: guarded:
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]], align 4
; CHECK-NEXT: [[COND_1:%.*]] = icmp eq i32 [[V]], 0
; CHECK-NEXT: br i1 [[COND_1]], label [[RETURN:%.*]], label [[DEOPT]], !prof !0
; CHECK: return:
@ -410,7 +410,7 @@ define i32 @swapped_wb(i1 %cond_0, i32* %p) {
; CHECK-NEXT: [[DEOPTRET:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
; CHECK-NEXT: ret i32 [[DEOPTRET]]
; CHECK: guarded:
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[P:%.*]], align 4
; CHECK-NEXT: [[COND_1:%.*]] = icmp eq i32 [[V]], 0
; CHECK-NEXT: br i1 [[COND_1]], label [[RETURN:%.*]], label [[DEOPT]], !prof !0
; CHECK: return: