250 changes: 120 additions & 130 deletions llvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu"

declare void @bar(i32)

define void @foo() personality i32 (...)* @__gxx_personality_v0 {
define void @foo() personality ptr @__gxx_personality_v0 {
entry:
invoke void @bar(i32 undef)
to label %r unwind label %u
Expand All @@ -14,9 +14,9 @@ r: ; preds = %entry
ret void

u: ; preds = %entry
%val = landingpad { i8*, i32 }
%val = landingpad { ptr, i32 }
cleanup
resume { i8*, i32 } %val
resume { ptr, i32 } %val
}

declare i32 @__gxx_personality_v0(...)
66 changes: 33 additions & 33 deletions llvm/test/Transforms/SimplifyCFG/X86/MagicPointer.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
target datalayout = "e-p:64:64:64-p1:16:16:16-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"
target triple = "x86_64-apple-darwin10.0.0"

@.str = private constant [5 x i8] c"null\00" ; <[5 x i8]*> [#uses=2]
@.str1 = private constant [4 x i8] c"one\00" ; <[4 x i8]*> [#uses=2]
@.str2 = private constant [4 x i8] c"two\00" ; <[4 x i8]*> [#uses=2]
@.str3 = private constant [5 x i8] c"four\00" ; <[5 x i8]*> [#uses=2]
@.str = private constant [5 x i8] c"null\00" ; <ptr> [#uses=2]
@.str1 = private constant [4 x i8] c"one\00" ; <ptr> [#uses=2]
@.str2 = private constant [4 x i8] c"two\00" ; <ptr> [#uses=2]
@.str3 = private constant [5 x i8] c"four\00" ; <ptr> [#uses=2]

@.str_as1 = private addrspace(1) constant [5 x i8] c"null\00" ; <[5 x i8]*> [#uses=2]
@.str1_as1 = private addrspace(1) constant [4 x i8] c"one\00" ; <[4 x i8]*> [#uses=2]
@.str2_as1 = private addrspace(1) constant [4 x i8] c"two\00" ; <[4 x i8]*> [#uses=2]
@.str3_as1 = private addrspace(1) constant [5 x i8] c"four\00" ; <[5 x i8]*> [#uses=2]
@.str_as1 = private addrspace(1) constant [5 x i8] c"null\00" ; <ptr> [#uses=2]
@.str1_as1 = private addrspace(1) constant [4 x i8] c"one\00" ; <ptr> [#uses=2]
@.str2_as1 = private addrspace(1) constant [4 x i8] c"two\00" ; <ptr> [#uses=2]
@.str3_as1 = private addrspace(1) constant [5 x i8] c"four\00" ; <ptr> [#uses=2]

declare i32 @puts(i8*)
declare i32 @puts_as1(i8 addrspace(1)*)
declare i32 @puts(ptr)
declare i32 @puts_as1(ptr addrspace(1))

define void @f(i8* %x) nounwind ssp {
define void @f(ptr %x) nounwind ssp {
; CHECK-LABEL: @f(
; CHECK: switch i64 %magicptr
; CHECK: i64 0, label
Expand All @@ -29,43 +29,43 @@ define void @f(i8* %x) nounwind ssp {
; CHECK: }

entry:
%tobool = icmp eq i8* %x, null ; <i1> [#uses=1]
%tobool = icmp eq ptr %x, null ; <i1> [#uses=1]
br i1 %tobool, label %if.then, label %if.else

if.then: ; preds = %entry
%call = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call = call i32 @puts(ptr @.str) nounwind ; <i32> [#uses=0]
br label %if.end21

if.else: ; preds = %entry
%cmp = icmp eq i8* %x, inttoptr (i64 1 to i8*) ; <i1> [#uses=1]
%cmp = icmp eq ptr %x, inttoptr (i64 1 to ptr) ; <i1> [#uses=1]
br i1 %cmp, label %if.then2, label %if.else4

if.then2: ; preds = %if.else
%call3 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call3 = call i32 @puts(ptr @.str1) nounwind ; <i32> [#uses=0]
br label %if.end20

if.else4: ; preds = %if.else
%cmp6 = icmp eq i8* %x, inttoptr (i64 2 to i8*) ; <i1> [#uses=1]
%cmp6 = icmp eq ptr %x, inttoptr (i64 2 to ptr) ; <i1> [#uses=1]
br i1 %cmp6, label %if.then9, label %lor.lhs.false

lor.lhs.false: ; preds = %if.else4
%cmp8 = icmp eq i8* %x, inttoptr (i64 3 to i8*) ; <i1> [#uses=1]
%cmp8 = icmp eq ptr %x, inttoptr (i64 3 to ptr) ; <i1> [#uses=1]
br i1 %cmp8, label %if.then9, label %if.else11

if.then9: ; preds = %lor.lhs.false, %if.else4
%call10 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str2, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call10 = call i32 @puts(ptr @.str2) nounwind ; <i32> [#uses=0]
br label %if.end19

if.else11: ; preds = %lor.lhs.false
%cmp13 = icmp eq i8* %x, inttoptr (i64 4 to i8*) ; <i1> [#uses=1]
%cmp13 = icmp eq ptr %x, inttoptr (i64 4 to ptr) ; <i1> [#uses=1]
br i1 %cmp13, label %if.then14, label %if.else16

if.then14: ; preds = %if.else11
%call15 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str3, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call15 = call i32 @puts(ptr @.str3) nounwind ; <i32> [#uses=0]
br label %if.end

if.else16: ; preds = %if.else11
%call18 = call i32 @puts(i8* %x) nounwind ; <i32> [#uses=0]
%call18 = call i32 @puts(ptr %x) nounwind ; <i32> [#uses=0]
br label %if.end

if.end: ; preds = %if.else16, %if.then14
Expand All @@ -83,9 +83,9 @@ if.end21: ; preds = %if.end20, %if.then

; Is it useful to test a version where the ptrtoints are to the same
; size?
define void @f_as1(i8 addrspace(1)* %x) nounwind ssp {
define void @f_as1(ptr addrspace(1) %x) nounwind ssp {
; CHECK-LABEL: @f_as1(
; CHECK: ptrtoint i8 addrspace(1)* %x to i16
; CHECK: ptrtoint ptr addrspace(1) %x to i16
; CHECK: switch i16 %magicptr
; CHECK: i16 0, label
; CHECK: i16 1, label
Expand All @@ -95,43 +95,43 @@ define void @f_as1(i8 addrspace(1)* %x) nounwind ssp {
; CHECK: }

entry:
%tobool = icmp eq i8 addrspace(1)* %x, null ; <i1> [#uses=1]
%tobool = icmp eq ptr addrspace(1) %x, null ; <i1> [#uses=1]
br i1 %tobool, label %if.then, label %if.else

if.then: ; preds = %entry
%call = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([5 x i8], [5 x i8] addrspace(1)* @.str_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call = call i32 @puts_as1(ptr addrspace(1) @.str_as1) nounwind ; <i32> [#uses=0]
br label %if.end21

if.else: ; preds = %entry
%cmp = icmp eq i8 addrspace(1)* %x, inttoptr (i64 1 to i8 addrspace(1)*) ; <i1> [#uses=1]
%cmp = icmp eq ptr addrspace(1) %x, inttoptr (i64 1 to ptr addrspace(1)) ; <i1> [#uses=1]
br i1 %cmp, label %if.then2, label %if.else4

if.then2: ; preds = %if.else
%call3 = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([4 x i8], [4 x i8] addrspace(1)* @.str1_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call3 = call i32 @puts_as1(ptr addrspace(1) @.str1_as1) nounwind ; <i32> [#uses=0]
br label %if.end20

if.else4: ; preds = %if.else
%cmp6 = icmp eq i8 addrspace(1)* %x, inttoptr (i64 2 to i8 addrspace(1)*) ; <i1> [#uses=1]
%cmp6 = icmp eq ptr addrspace(1) %x, inttoptr (i64 2 to ptr addrspace(1)) ; <i1> [#uses=1]
br i1 %cmp6, label %if.then9, label %lor.lhs.false

lor.lhs.false: ; preds = %if.else4
%cmp8 = icmp eq i8 addrspace(1)* %x, inttoptr (i64 3 to i8 addrspace(1)*) ; <i1> [#uses=1]
%cmp8 = icmp eq ptr addrspace(1) %x, inttoptr (i64 3 to ptr addrspace(1)) ; <i1> [#uses=1]
br i1 %cmp8, label %if.then9, label %if.else11

if.then9: ; preds = %lor.lhs.false, %if.else4
%call10 = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([4 x i8], [4 x i8] addrspace(1)* @.str2_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call10 = call i32 @puts_as1(ptr addrspace(1) @.str2_as1) nounwind ; <i32> [#uses=0]
br label %if.end19

if.else11: ; preds = %lor.lhs.false
%cmp13 = icmp eq i8 addrspace(1)* %x, inttoptr (i64 4 to i8 addrspace(1)*) ; <i1> [#uses=1]
%cmp13 = icmp eq ptr addrspace(1) %x, inttoptr (i64 4 to ptr addrspace(1)) ; <i1> [#uses=1]
br i1 %cmp13, label %if.then14, label %if.else16

if.then14: ; preds = %if.else11
%call15 = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([5 x i8], [5 x i8] addrspace(1)* @.str3_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
%call15 = call i32 @puts_as1(ptr addrspace(1) @.str3_as1) nounwind ; <i32> [#uses=0]
br label %if.end

if.else16: ; preds = %if.else11
%call18 = call i32 @puts_as1(i8 addrspace(1)* %x) nounwind ; <i32> [#uses=0]
%call18 = call i32 @puts_as1(ptr addrspace(1) %x) nounwind ; <i32> [#uses=0]
br label %if.end

if.end: ; preds = %if.else16, %if.then14
Expand Down
20 changes: 9 additions & 11 deletions llvm/test/Transforms/SimplifyCFG/X86/PR29163.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@GV = external constant i64*
@GV = external constant ptr

define i64* @test1(i1 %cond, i8* %P) {
define ptr @test1(i1 %cond, ptr %P) {
entry:
br i1 %cond, label %if, label %then

then:
%bc = bitcast i8* %P to i64*
br label %join

if:
%load = load i64*, i64** @GV, align 8, !dereferenceable !0
%load = load ptr, ptr @GV, align 8, !dereferenceable !0
br label %join

join:
%phi = phi i64* [ %bc, %then ], [ %load, %if ]
ret i64* %phi
%phi = phi ptr [ %P, %then ], [ %load, %if ]
ret ptr %phi
}

; CHECK-LABEL: define i64* @test1(
; CHECK: %[[bc:.*]] = bitcast i8* %P to i64*
; CHECK: %[[load:.*]] = load i64*, i64** @GV, align 8{{$}}
; CHECK: %[[phi:.*]] = select i1 %cond, i64* %[[load]], i64* %[[bc]]
; CHECK: ret i64* %[[phi]]
; CHECK-LABEL: define ptr @test1(
; CHECK: %[[load:.*]] = load ptr, ptr @GV, align 8{{$}}
; CHECK: %[[phi:.*]] = select i1 %cond, ptr %[[load]], ptr %P
; CHECK: ret ptr %[[phi]]


!0 = !{i64 8}
8 changes: 4 additions & 4 deletions llvm/test/Transforms/SimplifyCFG/X86/PR30210.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare i32* @fn1(i32* returned)
declare ptr @fn1(ptr returned)

define i32 @test1(i1 %B) {
; CHECK-LABEL: @test1(
Expand All @@ -27,14 +27,14 @@ for.cond4.preheader.split.us: ; preds = %for.cond4.preheader
unreachable

for.cond4: ; preds = %for.end, %for.cond4.preheader
%phi = phi i32* [ %call, %for.end ], [ undef, %for.cond4.preheader ]
%call = call i32* @fn1(i32* %phi)
%phi = phi ptr [ %call, %for.end ], [ undef, %for.cond4.preheader ]
%call = call ptr @fn1(ptr %phi)
br label %for.cond5

for.cond5: ; preds = %for.cond5, %for.cond4
br i1 %B, label %for.cond5, label %for.end

for.end: ; preds = %for.cond5
%load = load i32, i32* %call, align 4
%load = load i32, ptr %call, align 4
br label %for.cond4
}
72 changes: 36 additions & 36 deletions llvm/test/Transforms/SimplifyCFG/X86/SpeculativeExec.ll
Original file line number Diff line number Diff line change
Expand Up @@ -64,68 +64,68 @@ bb3:
ret float %t5
}

define i8* @test4(i1* %dummy, i8* %a, i8* %b) {
define ptr @test4(ptr %dummy, ptr %a, ptr %b) {
; Test that we don't speculate an arbitrarily large number of unfolded constant
; expressions.
; CHECK-LABEL: @test4(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[COND1:%.*]] = load volatile i1, i1* [[DUMMY:%.*]], align 1
; CHECK-NEXT: [[COND1:%.*]] = load volatile i1, ptr [[DUMMY:%.*]], align 1
; CHECK-NEXT: br i1 [[COND1]], label [[IF:%.*]], label [[END:%.*]]
; CHECK: if:
; CHECK-NEXT: [[COND2:%.*]] = load volatile i1, i1* [[DUMMY]], align 1
; CHECK-NEXT: [[COND2:%.*]] = load volatile i1, ptr [[DUMMY]], align 1
; CHECK-NEXT: br i1 [[COND2]], label [[THEN:%.*]], label [[END]]
; CHECK: then:
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: [[X1:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY:%.*]] ], [ [[B:%.*]], [[IF]] ], [ inttoptr (i64 1 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X2:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 2 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X3:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 3 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X4:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 4 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X5:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 5 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X6:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 6 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X7:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 7 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X8:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 8 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X9:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 9 to i8*), [[THEN]] ]
; CHECK-NEXT: [[X10:%.*]] = phi i8* [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 10 to i8*), [[THEN]] ]
; CHECK-NEXT: ret i8* [[X10]]
; CHECK-NEXT: [[X1:%.*]] = phi ptr [ [[A:%.*]], [[ENTRY:%.*]] ], [ [[B:%.*]], [[IF]] ], [ inttoptr (i64 1 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X2:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 2 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X3:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 3 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X4:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 4 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X5:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 5 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X6:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 6 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X7:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 7 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X8:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 8 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X9:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 9 to ptr), [[THEN]] ]
; CHECK-NEXT: [[X10:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[B]], [[IF]] ], [ inttoptr (i64 10 to ptr), [[THEN]] ]
; CHECK-NEXT: ret ptr [[X10]]
;

entry:
%cond1 = load volatile i1, i1* %dummy
%cond1 = load volatile i1, ptr %dummy
br i1 %cond1, label %if, label %end

if:
%cond2 = load volatile i1, i1* %dummy
%cond2 = load volatile i1, ptr %dummy
br i1 %cond2, label %then, label %end

then:
br label %end

end:
%x1 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 1 to i8*), %then ]
%x2 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 2 to i8*), %then ]
%x3 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 3 to i8*), %then ]
%x4 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 4 to i8*), %then ]
%x5 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 5 to i8*), %then ]
%x6 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 6 to i8*), %then ]
%x7 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 7 to i8*), %then ]
%x8 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 8 to i8*), %then ]
%x9 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 9 to i8*), %then ]
%x10 = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 10 to i8*), %then ]

ret i8* %x10
%x1 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 1 to ptr), %then ]
%x2 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 2 to ptr), %then ]
%x3 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 3 to ptr), %then ]
%x4 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 4 to ptr), %then ]
%x5 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 5 to ptr), %then ]
%x6 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 6 to ptr), %then ]
%x7 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 7 to ptr), %then ]
%x8 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 8 to ptr), %then ]
%x9 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 9 to ptr), %then ]
%x10 = phi ptr [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 10 to ptr), %then ]

ret ptr %x10
}

define i32* @test5(i32 %a, i32 %b, i32 %c, i32* dereferenceable(10) %ptr1, i32* dereferenceable(10) %ptr2, i32** dereferenceable(10) align 8 %ptr3) nofree nosync {
define ptr @test5(i32 %a, i32 %b, i32 %c, ptr dereferenceable(10) %ptr1, ptr dereferenceable(10) %ptr2, ptr dereferenceable(10) align 8 %ptr3) nofree nosync {
; CHECK-LABEL: @test5(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[T1:%.*]] = icmp eq i32 [[B:%.*]], 0
; CHECK-NEXT: [[T2:%.*]] = icmp sgt i32 [[C:%.*]], 1
; CHECK-NEXT: [[T4_SEL:%.*]] = select i1 [[T1]], i32* [[PTR2:%.*]], i32* [[PTR1:%.*]]
; CHECK-NEXT: [[T4_SEL:%.*]] = select i1 [[T1]], ptr [[PTR2:%.*]], ptr [[PTR1:%.*]]
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[T1]], i1 [[T2]], i1 false
; CHECK-NEXT: [[T3:%.*]] = load i32*, i32** [[PTR3:%.*]], align 8
; CHECK-NEXT: [[T4:%.*]] = select i1 [[OR_COND]], i32* [[T3]], i32* [[T4_SEL]]
; CHECK-NEXT: ret i32* [[T4]]
; CHECK-NEXT: [[T3:%.*]] = load ptr, ptr [[PTR3:%.*]], align 8
; CHECK-NEXT: [[T4:%.*]] = select i1 [[OR_COND]], ptr [[T3]], ptr [[T4_SEL]]
; CHECK-NEXT: ret ptr [[T4]]
;
entry:
%t1 = icmp eq i32 %b, 0
Expand All @@ -136,12 +136,12 @@ bb1:
br i1 %t2, label %bb2, label %bb3

bb2:
%t3 = load i32*, i32** %ptr3, !dereferenceable !{i64 10}
%t3 = load ptr, ptr %ptr3, !dereferenceable !{i64 10}
br label %bb3

bb3:
%t4 = phi i32* [ %ptr1, %entry ], [ %ptr2, %bb1 ], [ %t3, %bb2 ]
ret i32* %t4
%t4 = phi ptr [ %ptr1, %entry ], [ %ptr2, %bb1 ], [ %t3, %bb2 ]
ret ptr %t4
}

define float @spec_select_fp5(float %a, float %b, float %c) {
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ entry:
to label %continue unwind label %unwind

unwind: ; preds = %entry
%tmp101 = landingpad { i8*, i32 }
%tmp101 = landingpad { ptr, i32 }
cleanup
br i1 %B, label %resume, label %then

then: ; preds = %cleanup1
br label %resume

resume: ; preds = %cleanup2, %then, %cleanup1, %unwind
%tmp104 = phi { i8*, i32 } [ %tmp101, %then ], [ %tmp106, %cleanup2 ], [ %tmp101, %unwind ]
;CHECK-NOT: resume { i8*, i32 } %tmp104
resume { i8*, i32 } %tmp104
%tmp104 = phi { ptr, i32 } [ %tmp101, %then ], [ %tmp106, %cleanup2 ], [ %tmp101, %unwind ]
;CHECK-NOT: resume { ptr, i32 } %tmp104
resume { ptr, i32 } %tmp104

continue: ; preds = %entry, %continue
;CHECK: continue: ; preds = %entry, %continue
Expand All @@ -32,7 +32,7 @@ continue: ; preds = %entry, %continue
to label %continue unwind label %cleanup2

cleanup2: ; preds = %continue
%tmp106 = landingpad { i8*, i32 }
%tmp106 = landingpad { ptr, i32 }
cleanup
br label %resume
}
Expand Down
30 changes: 15 additions & 15 deletions llvm/test/Transforms/SimplifyCFG/X86/combine-parallel-mem-md.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: norecurse nounwind uwtable
define void @Test(i32* nocapture %res, i32* nocapture readnone %c, i32* nocapture readonly %d, i32* nocapture readonly %p) #0 {
define void @Test(ptr nocapture %res, ptr nocapture readnone %c, ptr nocapture readonly %d, ptr nocapture readonly %p) #0 {
entry:
br label %for.body

; CHECK-LABEL: @Test
; CHECK: load i32, i32* {{.*}}, align 4, !llvm.access.group !0
; CHECK: load i32, i32* {{.*}}, align 4, !llvm.access.group !0
; CHECK: load i32, ptr {{.*}}, align 4, !llvm.access.group !0
; CHECK: load i32, ptr {{.*}}, align 4, !llvm.access.group !0
; CHECK: store i32 {{.*}}, align 4, !llvm.access.group !0
; CHECK-NOT: load
; CHECK-NOT: store

for.body: ; preds = %cond.end, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %cond.end ]
%arrayidx = getelementptr inbounds i32, i32* %p, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4, !llvm.access.group !10
%arrayidx = getelementptr inbounds i32, ptr %p, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !llvm.access.group !10
%cmp1 = icmp eq i32 %0, 0
br i1 %cmp1, label %cond.true, label %cond.false

cond.false: ; preds = %for.body
%arrayidx3 = getelementptr inbounds i32, i32* %res, i64 %indvars.iv
%v = load i32, i32* %arrayidx3, align 4, !llvm.access.group !10
%arrayidx7 = getelementptr inbounds i32, i32* %d, i64 %indvars.iv
%1 = load i32, i32* %arrayidx7, align 4, !llvm.access.group !10
%arrayidx3 = getelementptr inbounds i32, ptr %res, i64 %indvars.iv
%v = load i32, ptr %arrayidx3, align 4, !llvm.access.group !10
%arrayidx7 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
%1 = load i32, ptr %arrayidx7, align 4, !llvm.access.group !10
%add = add nsw i32 %1, %v
br label %cond.end

cond.true: ; preds = %for.body
%arrayidx4 = getelementptr inbounds i32, i32* %res, i64 %indvars.iv
%w = load i32, i32* %arrayidx4, align 4, !llvm.access.group !10
%arrayidx8 = getelementptr inbounds i32, i32* %d, i64 %indvars.iv
%2 = load i32, i32* %arrayidx8, align 4, !llvm.access.group !10
%arrayidx4 = getelementptr inbounds i32, ptr %res, i64 %indvars.iv
%w = load i32, ptr %arrayidx4, align 4, !llvm.access.group !10
%arrayidx8 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
%2 = load i32, ptr %arrayidx8, align 4, !llvm.access.group !10
%add2 = add nsw i32 %2, %w
br label %cond.end

cond.end: ; preds = %for.body, %cond.false
%cond = phi i32 [ %add, %cond.false ], [ %add2, %cond.true ]
%arrayidx9 = getelementptr inbounds i32, i32* %res, i64 %indvars.iv
store i32 %cond, i32* %arrayidx9, align 4, !llvm.access.group !10
%arrayidx9 = getelementptr inbounds i32, ptr %res, i64 %indvars.iv
store i32 %cond, ptr %arrayidx9, align 4, !llvm.access.group !10
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond = icmp eq i64 %indvars.iv.next, 16
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
Expand Down
34 changes: 16 additions & 18 deletions llvm/test/Transforms/SimplifyCFG/X86/critedge-assume.ll
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ target triple = "x86_64-unknown-linux-gnu"
%class.F = type { i8 }
%class.B = type { i8 }
%class.A = type { %class.C }
%class.C = type { i32 (...)** }
%class.C = type { ptr }

define void @foo(%class.F* %this, %class.B* %out) {
define void @foo(ptr %this, ptr %out) {
entry:
%call = tail call i32 @_ZNK1F5beginEv(%class.F* %this)
%call2 = tail call i32 @_ZNK1F3endEv(%class.F* %this)
%call = tail call i32 @_ZNK1F5beginEv(ptr %this)
%call2 = tail call i32 @_ZNK1F3endEv(ptr %this)
%cmp.i22 = icmp eq i32 %call, %call2
br i1 %cmp.i22, label %while.end, label %while.body.preheader

Expand All @@ -32,20 +32,18 @@ while.body.preheader:

while.body:
%frame_node.sroa.0.023 = phi i32 [ %inc.i, %_ZN10unique_ptrD2Ev.exit ], [ %call, %while.body.preheader ]
%call8 = tail call i8* @_Znwm(i64 8)
%call8 = tail call ptr @_Znwm(i64 8)
%inc.i = add nsw i32 %frame_node.sroa.0.023, 1
%cmp = icmp eq i32 %inc.i, %call2
br i1 %cmp, label %_ZN10unique_ptrD2Ev.exit, label %if.then

if.then:
tail call void @_ZN1B6appendEv(%class.B* %out)
tail call void @_ZN1B6appendEv(ptr %out)
br label %_ZN10unique_ptrD2Ev.exit

_ZN10unique_ptrD2Ev.exit:
%x1 = bitcast i8* %call8 to void (%class.A*)***
%vtable.i.i = load void (%class.A*)**, void (%class.A*)*** %x1, align 8
%x2 = bitcast void (%class.A*)** %vtable.i.i to i8*
%x3 = tail call i1 @llvm.type.test(i8* %x2, metadata !"foo")
%vtable.i.i = load ptr, ptr %call8, align 8
%x3 = tail call i1 @llvm.type.test(ptr %vtable.i.i, metadata !"foo")
; CHECK: call void @llvm.assume
; CHECK: call void @llvm.assume
tail call void @llvm.assume(i1 %x3) #5
Expand All @@ -58,21 +56,21 @@ while.end:
ret void
}

declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.start.p0(i64, ptr nocapture)

declare i32 @_ZNK1F5beginEv(%class.F*)
declare i32 @_ZNK1F5beginEv(ptr)

declare i32 @_ZNK1F3endEv(%class.F*)
declare i32 @_ZNK1F3endEv(ptr)

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)

declare noalias nonnull i8* @_Znwm(i64)
declare noalias nonnull ptr @_Znwm(i64)

declare void @_ZN1B6appendEv(%class.B*)
declare void @_ZN1B6appendEv(ptr)

declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.end.p0(i64, ptr nocapture)

declare i1 @llvm.type.test(i8*, metadata)
declare i1 @llvm.type.test(ptr, metadata)

declare void @llvm.assume(i1)

Expand Down
82 changes: 40 additions & 42 deletions llvm/test/Transforms/SimplifyCFG/X86/empty-cleanuppad.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ target triple = "x86_64-pc-windows-msvc18.0.0"
; In this case, both cleanup pads can be eliminated and the invoke can be
; converted to a call.
;
define void @f1() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define void @f1() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f1(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @g()
Expand Down Expand Up @@ -55,20 +55,20 @@ ehcleanup.1: ; preds = %ehcleanup
; should unwind to the caller (that is, exception handling continues with the
; parent frame of the caller).
;
define void @f2() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define void @f2() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[B:%.*]] = alloca [[STRUCT_S2:%.*]], align 1
; CHECK-NEXT: invoke void @g()
; CHECK-NEXT: to label [[TRY_CONT:%.*]] unwind label [[EHCLEANUP:%.*]]
; CHECK: ehcleanup:
; CHECK-NEXT: [[TMP0:%.*]] = cleanuppad within none []
; CHECK-NEXT: call void @"\01??1S2@@QEAA@XZ"(%struct.S2* [[B]])
; CHECK-NEXT: call void @"\01??1S2@@QEAA@XZ"(ptr [[B]])
; CHECK-NEXT: cleanupret from [[TMP0]] unwind label [[CATCH_DISPATCH:%.*]]
; CHECK: catch.dispatch:
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP1:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[TMP1:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[TMP1]] to label [[TRY_CONT]]
; CHECK: try.cont:
; CHECK-NEXT: ret void
Expand All @@ -82,14 +82,14 @@ invoke.cont: ; preds = %entry

ehcleanup: ; preds = %entry
%0 = cleanuppad within none []
call void @"\01??1S2@@QEAA@XZ"(%struct.S2* %b)
call void @"\01??1S2@@QEAA@XZ"(ptr %b)
cleanupret from %0 unwind label %catch.dispatch

catch.dispatch: ; preds = %ehcleanup
%cs1 = catchswitch within none [label %catch] unwind label %ehcleanup.1

catch: ; preds = %catch.dispatch
%1 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%1 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
catchret from %1 to label %catchret.dest

catchret.dest: ; preds = %catch
Expand Down Expand Up @@ -119,7 +119,7 @@ ehcleanup.1:
; In this case the inner cleanup pad should be eliminated and the invoke of g()
; should unwind directly to the catchpad.

define void @f3() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define void @f3() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = alloca [[STRUCT_S2:%.*]], align 1
Expand All @@ -128,13 +128,13 @@ define void @f3() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*
; CHECK: catch.dispatch:
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind label [[EHCLEANUP_1:%.*]]
; CHECK: catch:
; CHECK-NEXT: [[CP2:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[CP2:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[CP2]] to label [[TRY_CONT]]
; CHECK: try.cont:
; CHECK-NEXT: ret void
; CHECK: ehcleanup.1:
; CHECK-NEXT: [[CP3:%.*]] = cleanuppad within none []
; CHECK-NEXT: call void @"\01??1S2@@QEAA@XZ"(%struct.S2* [[A]])
; CHECK-NEXT: call void @"\01??1S2@@QEAA@XZ"(ptr [[A]])
; CHECK-NEXT: cleanupret from [[CP3]] unwind to caller
;
entry:
Expand All @@ -152,7 +152,7 @@ catch.dispatch: ; preds = %ehcleanup
%cs1 = catchswitch within none [label %catch] unwind label %ehcleanup.1

catch: ; preds = %catch.dispatch
%cp2 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%cp2 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
catchret from %cp2 to label %catchret.dest

catchret.dest: ; preds = %catch
Expand All @@ -163,7 +163,7 @@ try.cont: ; preds = %catchret.dest, %inv

ehcleanup.1:
%cp3 = cleanuppad within none []
call void @"\01??1S2@@QEAA@XZ"(%struct.S2* %a)
call void @"\01??1S2@@QEAA@XZ"(ptr %a)
cleanupret from %cp3 unwind to caller
}

Expand All @@ -186,7 +186,7 @@ ehcleanup.1:
; Note: The cleanuppad simplification will insert an unconditional branch here
; but it will be eliminated, placing the following invoke in the entry BB.
;
define void @f4() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define void @f4() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f4(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @g()
Expand All @@ -195,7 +195,7 @@ define void @f4() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*
; CHECK: catch.dispatch:
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[TMP0]] to label [[TRY_CONT]]
; CHECK: try.cont:
; CHECK-NEXT: ret void
Expand All @@ -212,7 +212,7 @@ catch.dispatch: ; preds = %invoke.cont
%cs1 = catchswitch within none [label %catch] unwind label %ehcleanup

catch: ; preds = %catch.dispatch
%0 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%0 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
catchret from %0 to label %try.cont

try.cont: ; preds = %catch, %invoke.cont
Expand Down Expand Up @@ -242,7 +242,7 @@ ehcleanup:
; In this case, the cleanup pad should be eliminated and the PHI node in the
; cleanup pad should be sunk into the catch dispatch block.
;
define i32 @f6() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define i32 @f6() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f6(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @g()
Expand All @@ -254,7 +254,7 @@ define i32 @f6() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
; CHECK-NEXT: [[STATE_0:%.*]] = phi i32 [ 2, [[INVOKE_CONT]] ], [ 1, [[ENTRY:%.*]] ]
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[TMP0]] to label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[STATE_0]], [[CATCH:%.*]] ], [ 0, [[INVOKE_CONT]] ]
Expand All @@ -277,7 +277,7 @@ catch.dispatch: ; preds = %ehcleanup
%cs1 = catchswitch within none [label %catch] unwind to caller

catch: ; preds = %catch.dispatch
%1 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%1 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
catchret from %1 to label %return

return: ; preds = %invoke.cont, %catch
Expand Down Expand Up @@ -306,7 +306,7 @@ return: ; preds = %invoke.cont, %catch
; In this case, the cleanup pad should be eliminated and the PHI node in the
; cleanup pad should be merged with the PHI node in the catch dispatch block.
;
define i32 @f7() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define i32 @f7() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f7(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @g()
Expand All @@ -321,7 +321,7 @@ define i32 @f7() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
; CHECK-NEXT: [[STATE_1:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ 3, [[INVOKE_CONT_1]] ], [ 2, [[INVOKE_CONT]] ]
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[TMP0]] to label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[STATE_1]], [[CATCH:%.*]] ], [ 0, [[INVOKE_CONT_1]] ]
Expand Down Expand Up @@ -349,7 +349,7 @@ catch.dispatch: ; preds = %ehcleanup, %entry
%cs1 = catchswitch within none [label %catch] unwind to caller

catch: ; preds = %catch.dispatch
%1 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%1 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
catchret from %1 to label %return

return: ; preds = %invoke.cont.1, %catch
Expand Down Expand Up @@ -384,7 +384,7 @@ return: ; preds = %invoke.cont.1, %cat
; should have an incoming value entry for path from 'foo' that references the
; PHI node itself.
;
define void @f8() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define void @f8() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f8(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @g()
Expand All @@ -396,7 +396,7 @@ define void @f8() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*
; CHECK-NEXT: [[X:%.*]] = phi i32 [ 2, [[INVOKE_CONT]] ], [ 1, [[ENTRY:%.*]] ], [ [[X]], [[CATCH_CONT:%.*]] ]
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: call void @use_x(i32 [[X]])
; CHECK-NEXT: catchret from [[TMP0]] to label [[CATCH_CONT]]
; CHECK: catch.cont:
Expand All @@ -422,7 +422,7 @@ catch.dispatch: ; preds = %ehcleanup, %catch.c
%cs1 = catchswitch within none [label %catch] unwind to caller

catch: ; preds = %catch.dispatch
%1 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%1 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
call void @use_x(i32 %x)
catchret from %1 to label %catch.cont

Expand All @@ -433,46 +433,44 @@ catch.cont: ; preds = %catch
return: ; preds = %invoke.cont, %catch.cont
ret void
}
define i32 @f9() personality i32 (...)* @__CxxFrameHandler3 {
define i32 @f9() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f9(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[S:%.*]] = alloca i8, align 1
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[S]])
; CHECK-NEXT: [[BC:%.*]] = bitcast i8* [[S]] to %struct.S2*
; CHECK-NEXT: invoke void @"\01??1S2@@QEAA@XZ"(%struct.S2* [[BC]])
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr nonnull [[S]])
; CHECK-NEXT: invoke void @"\01??1S2@@QEAA@XZ"(ptr [[S]])
; CHECK-NEXT: to label [[TRY_CONT:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
; CHECK: catch.dispatch:
; CHECK-NEXT: [[CATCH_SWITCH:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[CATCH_PAD:%.*]] = catchpad within [[CATCH_SWITCH]] [i8* null, i32 0, i8* null]
; CHECK-NEXT: [[CATCH_PAD:%.*]] = catchpad within [[CATCH_SWITCH]] [ptr null, i32 0, ptr null]
; CHECK-NEXT: catchret from [[CATCH_PAD]] to label [[TRY_CONT]]
; CHECK: try.cont:
; CHECK-NEXT: ret i32 0
;
entry:
%s = alloca i8, align 1
call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %s)
%bc = bitcast i8* %s to %struct.S2*
invoke void @"\01??1S2@@QEAA@XZ"(%struct.S2* %bc)
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s)
invoke void @"\01??1S2@@QEAA@XZ"(ptr %s)
to label %try.cont unwind label %ehcleanup

ehcleanup:
%cleanup.pad = cleanuppad within none []
call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %s)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s)
cleanupret from %cleanup.pad unwind label %catch.dispatch

catch.dispatch:
%catch.switch = catchswitch within none [label %catch] unwind to caller

catch:
%catch.pad = catchpad within %catch.switch [i8* null, i32 0, i8* null]
%catch.pad = catchpad within %catch.switch [ptr null, i32 0, ptr null]
catchret from %catch.pad to label %try.cont

try.cont:
ret i32 0
}

define void @f10(i32 %V) personality i32 (...)* @__CxxFrameHandler3 {
define void @f10(i32 %V) personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f10(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @g()
Expand Down Expand Up @@ -501,7 +499,7 @@ cleanupret2:
; This case tests the handling of an empty cleanup pad that
; contains a lifetime_end intrinsic and does not dominate its
; successor.
define void @f11() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define void @f11() personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @f11(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @g()
Expand All @@ -515,7 +513,7 @@ define void @f11() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8
; CHECK: catch.dispatch:
; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [i8* null, i32 64, i8* null]
; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[TMP0]] to label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: ret void
Expand All @@ -533,16 +531,16 @@ invoke.cont2: ; preds = %invoke.cont
to label %return unwind label %catch.dispatch

ehcleanup: ; preds = %invoke.cont, %entry
%x = phi i8* [ undef, %invoke.cont ], [ undef, %entry ]
%x = phi ptr [ undef, %invoke.cont ], [ undef, %entry ]
%0 = cleanuppad within none []
call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %x)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %x)
cleanupret from %0 unwind label %catch.dispatch

catch.dispatch: ; preds = %ehcleanup, %invoke.cont
%cs1 = catchswitch within none [label %catch] unwind to caller

catch: ; preds = %catch.dispatch
%1 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
%1 = catchpad within %cs1 [ptr null, i32 u0x40, ptr null]
catchret from %1 to label %return

return: ; preds = %invoke.cont, %catch.cont
Expand All @@ -551,11 +549,11 @@ return: ; preds = %invoke.cont, %catch

%struct.S = type { i8 }
%struct.S2 = type { i8 }
declare void @"\01??1S2@@QEAA@XZ"(%struct.S2*)
declare void @"\01??1S2@@QEAA@XZ"(ptr)
declare void @g()
declare void @use_x(i32 %x)

declare i32 @__CxxFrameHandler3(...)

declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
34 changes: 17 additions & 17 deletions llvm/test/Transforms/SimplifyCFG/X86/invalidate-dom.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ target triple = "x86_64-unknown-linux-gnu"
@f = external global i32, align 4
@g = external global i32, align 4

define i32* @a(i32 %h) #0 {
define ptr @a(i32 %h) #0 {
entry:
%h.addr = alloca i32, align 4
store i32 %h, i32* %h.addr, align 4
%tmp0 = load i32, i32* %h.addr, align 4
store i32 %h, ptr %h.addr, align 4
%tmp0 = load i32, ptr %h.addr, align 4
switch i32 %tmp0, label %sw.default [
i32 4, label %sw.bb
i32 3, label %sw.bb1
Expand All @@ -31,8 +31,8 @@ sw.bb1: ; preds = %entry
sw.bb3: ; preds = %entry
%call4 = call i32 (...) @c()
%conv = sext i32 %call4 to i64
%tmp1 = inttoptr i64 %conv to i32*
ret i32* %tmp1
%tmp1 = inttoptr i64 %conv to ptr
ret ptr %tmp1

sw.default: ; preds = %entry
unreachable
Expand All @@ -48,41 +48,41 @@ entry:
define internal i32 @j() #0 {
entry:
%i = alloca i32, align 4
store i32 0, i32* %i, align 4
store i32 0, ptr %i, align 4
br label %for.cond

for.cond: ; preds = %for.body, %entry
%tmp0 = load i32, i32* %i, align 4
%tmp1 = load i32, i32* @f, align 4
%tmp0 = load i32, ptr %i, align 4
%tmp1 = load i32, ptr @f, align 4
%cmp = icmp ult i32 %tmp0, %tmp1
br i1 %cmp, label %for.body, label %for.cond.cleanup

for.cond.cleanup: ; preds = %for.cond
%tmp2 = load i32, i32* @f, align 4
%call3 = call i32* @a(i32 %tmp2)
%tmp2 = load i32, ptr @f, align 4
%call3 = call ptr @a(i32 %tmp2)
ret i32 undef

for.body: ; preds = %for.cond
%call = call i32 (...) @c()
%call1 = call i32 (...) @c()
%call2 = call i32 (...) @c()
%tmp3 = load i32, i32* @b, align 4
%tmp4 = load i32, i32* @g, align 4
%tmp3 = load i32, ptr @b, align 4
%tmp4 = load i32, ptr @g, align 4
%sub = sub nsw i32 %tmp4, %tmp3
store i32 %sub, i32* @g, align 4
%tmp5 = load i32, i32* %i, align 4
store i32 %sub, ptr @g, align 4
%tmp5 = load i32, ptr %i, align 4
%inc = add i32 %tmp5, 1
store i32 %inc, i32* %i, align 4
store i32 %inc, ptr %i, align 4
br label %for.cond
}

declare i32 @c(...) #0

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

attributes #0 = { "use-soft-float"="false" }
attributes #1 = { "target-cpu"="x86-64" }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/SimplifyCFG/X86/merge-cleanuppads.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc18.0.0"

; Function Attrs: uwtable
define void @test1() #0 personality i32 (...)* @__CxxFrameHandler3 {
define void @test1() #0 personality ptr @__CxxFrameHandler3 {
entry:
invoke void @may_throw(i32 3)
to label %invoke.cont unwind label %ehcleanup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
target triple = "x86_64-unknown-linux-gnu"

; More interesting test, here we can merge the invokes.
define void @t1_mergeable_invoke() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
define void @t1_mergeable_invoke() personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @t1_mergeable_invoke(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C0:%.*]] = call i1 @cond(), !dbg [[DBG12:![0-9]+]]
; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[C0]], metadata [[META9:![0-9]+]], metadata !DIExpression()), !dbg [[DBG12]]
; CHECK-NEXT: br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]], !dbg [[DBG13:![0-9]+]]
; CHECK: lpad:
; CHECK-NEXT: [[EH:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: [[EH:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup, !dbg [[DBG14:![0-9]+]]
; CHECK-NEXT: call void @destructor(), !dbg [[DBG15:![0-9]+]]
; CHECK-NEXT: resume { i8*, i32 } [[EH]], !dbg [[DBG16:![0-9]+]]
; CHECK-NEXT: resume { ptr, i32 } [[EH]], !dbg [[DBG16:![0-9]+]]
; CHECK: if.else:
; CHECK-NEXT: [[C1:%.*]] = call i1 @cond(), !dbg [[DBG17:![0-9]+]]
; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[C1]], metadata [[META11:![0-9]+]], metadata !DIExpression()), !dbg [[DBG17]]
Expand All @@ -41,9 +41,9 @@ invoke.cont0:
unreachable

lpad:
%eh = landingpad { i8*, i32 } cleanup
%eh = landingpad { ptr, i32 } cleanup
call void @destructor()
resume { i8*, i32 } %eh
resume { ptr, i32 } %eh

if.else:
%c1 = call i1 @cond()
Expand Down

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions llvm/test/Transforms/SimplifyCFG/X86/merge-cond-stores-cost.ll
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -mtriple=x86_64-unknown-unknown < %s -simplifycfg-merge-cond-stores=true -simplifycfg-merge-cond-stores-aggressively=false -phi-node-folding-threshold=2 -S | FileCheck %s

define void @test_costly(i32* %p, i32 %a, i32 %b, i32 %c, i32 %d) {
define void @test_costly(ptr %p, i32 %a, i32 %b, i32 %c, i32 %d) {
; CHECK-LABEL: @test_costly(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[X1:%.*]] = icmp eq i32 [[A:%.*]], 0
; CHECK-NEXT: br i1 [[X1]], label [[FALLTHROUGH:%.*]], label [[YES1:%.*]]
; CHECK: yes1:
; CHECK-NEXT: [[VAL0:%.*]] = sdiv i32 [[D:%.*]], [[C:%.*]]
; CHECK-NEXT: store i32 [[VAL0]], i32* [[P:%.*]], align 4
; CHECK-NEXT: store i32 [[VAL0]], ptr [[P:%.*]], align 4
; CHECK-NEXT: br label [[FALLTHROUGH]]
; CHECK: fallthrough:
; CHECK-NEXT: [[X2:%.*]] = icmp eq i32 [[B:%.*]], 0
; CHECK-NEXT: br i1 [[X2]], label [[END:%.*]], label [[YES2:%.*]]
; CHECK: yes2:
; CHECK-NEXT: [[VAL1:%.*]] = sdiv i32 [[C]], [[D]]
; CHECK-NEXT: store i32 [[VAL1]], i32* [[P]], align 4
; CHECK-NEXT: store i32 [[VAL1]], ptr [[P]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: ret void
Expand All @@ -26,7 +26,7 @@ entry:

yes1:
%val0 = sdiv i32 %d, %c
store i32 %val0, i32* %p
store i32 %val0, ptr %p
br label %fallthrough

fallthrough:
Expand All @@ -35,7 +35,7 @@ fallthrough:

yes2:
%val1 = sdiv i32 %c, %d
store i32 %val1, i32* %p
store i32 %val1, ptr %p
br label %end

end:
Expand Down
14 changes: 6 additions & 8 deletions llvm/test/Transforms/SimplifyCFG/X86/pr39187-g.ll
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
; CHECK-LABEL: entry
; CHECK: %foo = alloca i32, align 4
; CHECK: %face = alloca i8, align 1
; CHECK: %foo.0..sroa_cast = bitcast i32* %foo to i8*
; CHECK: store volatile i32 0, i32* %foo, align 4
; CHECK: %foo.0. = load volatile i32, i32* %foo, align 4, !dbg !16
; CHECK: store volatile i32 0, ptr %foo, align 4
; CHECK: %foo.0. = load volatile i32, ptr %foo, align 4, !dbg !16
; CHECK: %cmp = icmp eq i32 %foo.0., 4, !dbg !16
; CHECK: %frombool = zext i1 %cmp to i8, !dbg !16
; CHECK: call void @llvm.dbg.value(metadata i8 %frombool, metadata !13, metadata !DIExpression()), !dbg !16
Expand All @@ -53,9 +52,8 @@ define dso_local i32 @main() local_unnamed_addr #0 !dbg !7 {
entry:
%foo = alloca i32, align 4
%face = alloca i8, align 1
%foo.0..sroa_cast = bitcast i32* %foo to i8*
store volatile i32 0, i32* %foo, align 4
%foo.0. = load volatile i32, i32* %foo, align 4, !dbg !26
store volatile i32 0, ptr %foo, align 4
%foo.0. = load volatile i32, ptr %foo, align 4, !dbg !26
%cmp = icmp eq i32 %foo.0., 4, !dbg !26
%frombool = zext i1 %cmp to i8, !dbg !26
call void @llvm.dbg.value(metadata i8 %frombool, metadata !15, metadata !DIExpression()), !dbg !26
Expand All @@ -72,8 +70,8 @@ if.else: ; preds = %entry

if.end: ; preds = %if.else, %if.then
%beards.0 = phi i32 [ 8, %if.then ], [ 4, %if.else ]
store volatile i8 %frombool, i8* %face, align 1
%face.0. = load volatile i8, i8* %face, align 1
store volatile i8 %frombool, ptr %face, align 1
%face.0. = load volatile i8, ptr %face, align 1
%0 = and i8 %face.0., 1
%tobool3 = icmp eq i8 %0, 0
%cond4 = select i1 %tobool3, i32 0, i32 %beards.0
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Transforms/SimplifyCFG/X86/remove-debug-2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ target triple = "x86_64-unknown-linux-gnu"
define i32 @foo(i32) !dbg !6 {
%2 = alloca i32, align 4
%3 = alloca i32, align 4
store i32 %0, i32* %2, align 4
store i32 1, i32* %3, align 4, !dbg !14
%4 = load i32, i32* %2, align 4, !dbg !15
store i32 %0, ptr %2, align 4
store i32 1, ptr %3, align 4, !dbg !14
%4 = load i32, ptr %2, align 4, !dbg !15
%5 = icmp ne i32 %4, 0, !dbg !15
br i1 %5, label %6, label %7, !dbg !17

; <label>:6: ; preds = %1
store i32 0, i32* %3, align 4, !dbg !18
store i32 0, ptr %3, align 4, !dbg !18
br label %7, !dbg !19

; <label>:7: ; preds = %6, %1
%8 = load i32, i32* %3, align 4, !dbg !20
%8 = load i32, ptr %3, align 4, !dbg !20
ret i32 %8, !dbg !21
}

Expand Down
16 changes: 8 additions & 8 deletions llvm/test/Transforms/SimplifyCFG/X86/remove-debug.ll
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: uwtable
define void @_Z3fooi(i32) #0 !dbg !6 {
; CHECK: load i32, i32* %2, align 4, !dbg ![[LOAD:[0-9]+]], !tbaa
; CHECK: store i32 %5, i32* @x, align 4, !dbg ![[BAR:[0-9]+]], !tbaa
; CHECK: load i32, ptr %2, align 4, !dbg ![[LOAD:[0-9]+]], !tbaa
; CHECK: store i32 %5, ptr @x, align 4, !dbg ![[BAR:[0-9]+]], !tbaa
; CHECK: call void @_Z3barv(), !dbg ![[BAR]]
; CHECK: call void @_Z3bazv(), !dbg ![[BAZ:[0-9]+]]
%2 = alloca i32, align 4
store i32 %0, i32* %2, align 4, !tbaa !8
%3 = load i32, i32* %2, align 4, !dbg !12, !tbaa !8
store i32 %0, ptr %2, align 4, !tbaa !8
%3 = load i32, ptr %2, align 4, !dbg !12, !tbaa !8
%4 = icmp eq i32 %3, 0, !dbg !13
br i1 %4, label %5, label %7, !dbg !12

; <label>:5:
%6 = load i32, i32* %2, align 4, !dbg !14, !tbaa !8
store i32 %6, i32* @x, align 4, !dbg !15, !tbaa !8
%6 = load i32, ptr %2, align 4, !dbg !14, !tbaa !8
store i32 %6, ptr @x, align 4, !dbg !15, !tbaa !8
call void @_Z3barv(), !dbg !16
br label %9, !dbg !17

; <label>:7:
%8 = load i32, i32* %2, align 4, !dbg !18, !tbaa !8
store i32 %8, i32* @x, align 4, !dbg !19, !tbaa !8
%8 = load i32, ptr %2, align 4, !dbg !18, !tbaa !8
store i32 %8, ptr @x, align 4, !dbg !19, !tbaa !8
call void @_Z3barv(), !dbg !20
call void @_Z3bazv(), !dbg !21
br label %9
Expand Down
276 changes: 134 additions & 142 deletions llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions llvm/test/Transforms/SimplifyCFG/X86/switch-to-lookup-bitcast.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ target triple = "x86_64-unknown-linux-gnu"
@alloc1 = private unnamed_addr constant <{ [1 x i8] }> <{ [1 x i8] c"B" }>, align 1
@alloc2 = private unnamed_addr constant <{ [1 x i8] }> <{ [1 x i8] c"C" }>, align 1

define { [0 x i8]*, i64 } @switch_to_lookup_bitcast(i8 %0) unnamed_addr {
define { ptr, i64 } @switch_to_lookup_bitcast(i8 %0) unnamed_addr {
; CHECK-LABEL: @switch_to_lookup_bitcast(
; CHECK-NEXT: start:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [3 x [0 x i8]*], [3 x [0 x i8]*]* @switch.table.switch_to_lookup_bitcast, i32 0, i8 [[TMP0:%.*]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load [0 x i8]*, [0 x i8]** [[SWITCH_GEP]], align 8
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { [0 x i8]*, i64 } undef, [0 x i8]* [[SWITCH_LOAD]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { [0 x i8]*, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { [0 x i8]*, i64 } [[TMP2]]
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [3 x ptr], ptr @switch.table.switch_to_lookup_bitcast, i32 0, i8 [[TMP0:%.*]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load ptr, ptr [[SWITCH_GEP]], align 8
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { ptr, i64 } undef, ptr [[SWITCH_LOAD]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { ptr, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { ptr, i64 } [[TMP2]]
;
start:
switch i8 %0, label %default [
Expand All @@ -35,8 +35,8 @@ default:
unreachable

end:
%.sroa.0.0 = phi [0 x i8]* [ bitcast (<{ [1 x i8] }>* @alloc0 to [0 x i8]*), %bb0 ], [ bitcast (<{ [1 x i8] }>* @alloc1 to [0 x i8]*), %bb1 ], [ bitcast (<{ [1 x i8] }>* @alloc2 to [0 x i8]*), %bb2 ]
%1 = insertvalue { [0 x i8]*, i64 } undef, [0 x i8]* %.sroa.0.0, 0
%2 = insertvalue { [0 x i8]*, i64 } %1, i64 1, 1
ret { [0 x i8]*, i64 } %2
%.sroa.0.0 = phi ptr [ @alloc0, %bb0 ], [ @alloc1, %bb1 ], [ @alloc2, %bb2 ]
%1 = insertvalue { ptr, i64 } undef, ptr %.sroa.0.0, 0
%2 = insertvalue { ptr, i64 } %1, i64 1, 1
ret { ptr, i64 } %2
}
56 changes: 28 additions & 28 deletions llvm/test/Transforms/SimplifyCFG/X86/switch-to-lookup-gep.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ target triple = "x86_64-unknown-linux-gnu"
@alloc1 = private unnamed_addr constant <{ [2 x i8] }> <{ [2 x i8] c"B2" }>, align 1
@alloc2 = private unnamed_addr constant <{ [2 x i8] }> <{ [2 x i8] c"C3" }>, align 1

define { i8*, i64 } @switch_to_lookup_gep(i8 %0) unnamed_addr {
define { ptr, i64 } @switch_to_lookup_gep(i8 %0) unnamed_addr {
; CHECK-LABEL: @switch_to_lookup_gep(
; CHECK-NEXT: start:
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [3 x i8*], [3 x i8*]* @switch.table.switch_to_lookup_gep, i32 0, i8 [[TMP0:%.*]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i8*, i8** [[SWITCH_GEP]], align 8
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { i8*, i64 } undef, i8* [[SWITCH_LOAD]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { i8*, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { i8*, i64 } [[TMP2]]
; CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [3 x ptr], ptr @switch.table.switch_to_lookup_gep, i32 0, i8 [[TMP0:%.*]]
; CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load ptr, ptr [[SWITCH_GEP]], align 8
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { ptr, i64 } undef, ptr [[SWITCH_LOAD]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { ptr, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { ptr, i64 } [[TMP2]]
;
start:
switch i8 %0, label %default [
Expand All @@ -35,13 +35,13 @@ default:
unreachable

end:
%.sroa.0.0 = phi i8* [ getelementptr inbounds (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc0, i32 0, i32 0, i32 1), %bb0 ], [ getelementptr inbounds (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc1, i32 0, i32 0, i32 1), %bb1 ], [ getelementptr inbounds (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc2, i32 0, i32 0, i32 1), %bb2 ]
%1 = insertvalue { i8*, i64 } undef, i8* %.sroa.0.0, 0
%2 = insertvalue { i8*, i64 } %1, i64 1, 1
ret { i8*, i64 } %2
%.sroa.0.0 = phi ptr [ getelementptr inbounds (<{ [2 x i8] }>, ptr @alloc0, i32 0, i32 0, i32 1), %bb0 ], [ getelementptr inbounds (<{ [2 x i8] }>, ptr @alloc1, i32 0, i32 0, i32 1), %bb1 ], [ getelementptr inbounds (<{ [2 x i8] }>, ptr @alloc2, i32 0, i32 0, i32 1), %bb2 ]
%1 = insertvalue { ptr, i64 } undef, ptr %.sroa.0.0, 0
%2 = insertvalue { ptr, i64 } %1, i64 1, 1
ret { ptr, i64 } %2
}

define { i8*, i64 } @switch_to_lookup_gep_oob(i8 %0) unnamed_addr {
define { ptr, i64 } @switch_to_lookup_gep_oob(i8 %0) unnamed_addr {
; CHECK-LABEL: @switch_to_lookup_gep_oob(
; CHECK-NEXT: start:
; CHECK-NEXT: switch i8 [[TMP0:%.*]], label [[DEFAULT:%.*]] [
Expand All @@ -56,10 +56,10 @@ define { i8*, i64 } @switch_to_lookup_gep_oob(i8 %0) unnamed_addr {
; CHECK: default:
; CHECK-NEXT: unreachable
; CHECK: end:
; CHECK-NEXT: [[DOTSROA_0_0:%.*]] = phi i8* [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc1, i32 0, i32 0, i32 4), [[BB1]] ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc2, i32 0, i32 0, i32 4), [[BB2]] ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc0, i32 0, i32 0, i32 4), [[START:%.*]] ]
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { i8*, i64 } undef, i8* [[DOTSROA_0_0]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { i8*, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { i8*, i64 } [[TMP2]]
; CHECK-NEXT: [[DOTSROA_0_0:%.*]] = phi ptr [ getelementptr (<{ [2 x i8] }>, ptr @alloc1, i32 0, i32 0, i32 4), [[BB1]] ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc2, i32 0, i32 0, i32 4), [[BB2]] ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc0, i32 0, i32 0, i32 4), [[START:%.*]] ]
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { ptr, i64 } undef, ptr [[DOTSROA_0_0]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { ptr, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { ptr, i64 } [[TMP2]]
;
start:
switch i8 %0, label %default [
Expand All @@ -81,13 +81,13 @@ default:
unreachable

end:
%.sroa.0.0 = phi i8* [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc0, i32 0, i32 0, i32 4), %bb0 ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc1, i32 0, i32 0, i32 4), %bb1 ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc2, i32 0, i32 0, i32 4), %bb2 ]
%1 = insertvalue { i8*, i64 } undef, i8* %.sroa.0.0, 0
%2 = insertvalue { i8*, i64 } %1, i64 1, 1
ret { i8*, i64 } %2
%.sroa.0.0 = phi ptr [ getelementptr (<{ [2 x i8] }>, ptr @alloc0, i32 0, i32 0, i32 4), %bb0 ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc1, i32 0, i32 0, i32 4), %bb1 ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc2, i32 0, i32 0, i32 4), %bb2 ]
%1 = insertvalue { ptr, i64 } undef, ptr %.sroa.0.0, 0
%2 = insertvalue { ptr, i64 } %1, i64 1, 1
ret { ptr, i64 } %2
}

define { i8*, i64 } @switch_to_lookup_gep_ptrtoint(i8 %0) unnamed_addr {
define { ptr, i64 } @switch_to_lookup_gep_ptrtoint(i8 %0) unnamed_addr {
; CHECK-LABEL: @switch_to_lookup_gep_ptrtoint(
; CHECK-NEXT: start:
; CHECK-NEXT: switch i8 [[TMP0:%.*]], label [[DEFAULT:%.*]] [
Expand All @@ -102,10 +102,10 @@ define { i8*, i64 } @switch_to_lookup_gep_ptrtoint(i8 %0) unnamed_addr {
; CHECK: default:
; CHECK-NEXT: unreachable
; CHECK: end:
; CHECK-NEXT: [[DOTSROA_0_0:%.*]] = phi i8* [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc1, i32 0, i32 0, i64 ptrtoint (<{ [2 x i8] }>* @alloc0 to i64)), [[BB1]] ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc2, i32 0, i32 0, i64 ptrtoint (<{ [2 x i8] }>* @alloc0 to i64)), [[BB2]] ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc0, i32 0, i32 0, i64 ptrtoint (<{ [2 x i8] }>* @alloc0 to i64)), [[START:%.*]] ]
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { i8*, i64 } undef, i8* [[DOTSROA_0_0]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { i8*, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { i8*, i64 } [[TMP2]]
; CHECK-NEXT: [[DOTSROA_0_0:%.*]] = phi ptr [ getelementptr (<{ [2 x i8] }>, ptr @alloc1, i32 0, i32 0, i64 ptrtoint (ptr @alloc0 to i64)), [[BB1]] ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc2, i32 0, i32 0, i64 ptrtoint (ptr @alloc0 to i64)), [[BB2]] ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc0, i32 0, i32 0, i64 ptrtoint (ptr @alloc0 to i64)), [[START:%.*]] ]
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { ptr, i64 } undef, ptr [[DOTSROA_0_0]], 0
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { ptr, i64 } [[TMP1]], i64 1, 1
; CHECK-NEXT: ret { ptr, i64 } [[TMP2]]
;
start:
switch i8 %0, label %default [
Expand All @@ -127,8 +127,8 @@ default:
unreachable

end:
%.sroa.0.0 = phi i8* [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc0, i32 0, i32 0, i64 ptrtoint (<{ [2 x i8] }>* @alloc0 to i64)), %bb0 ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc1, i32 0, i32 0, i64 ptrtoint (<{ [2 x i8] }>* @alloc0 to i64)), %bb1 ], [ getelementptr (<{ [2 x i8] }>, <{ [2 x i8] }>* @alloc2, i32 0, i32 0, i64 ptrtoint (<{ [2 x i8] }>* @alloc0 to i64)), %bb2 ]
%1 = insertvalue { i8*, i64 } undef, i8* %.sroa.0.0, 0
%2 = insertvalue { i8*, i64 } %1, i64 1, 1
ret { i8*, i64 } %2
%.sroa.0.0 = phi ptr [ getelementptr (<{ [2 x i8] }>, ptr @alloc0, i32 0, i32 0, i64 ptrtoint (ptr @alloc0 to i64)), %bb0 ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc1, i32 0, i32 0, i64 ptrtoint (ptr @alloc0 to i64)), %bb1 ], [ getelementptr (<{ [2 x i8] }>, ptr @alloc2, i32 0, i32 0, i64 ptrtoint (ptr @alloc0 to i64)), %bb2 ]
%1 = insertvalue { ptr, i64 } undef, ptr %.sroa.0.0, 0
%2 = insertvalue { ptr, i64 } %1, i64 1, 1
ret { ptr, i64 } %2
}
12 changes: 6 additions & 6 deletions llvm/test/Transforms/SimplifyCFG/X86/switch-to-lookup-globals.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ define i1 @zot(i32 %arg) {
; CHECK-NEXT: %0 = icmp ult i32 %arg, 3
; CHECK-NEXT: br i1 %0, label %switch.lookup, label %bb6
; CHECK: switch.lookup:
; CHECK-NEXT: %switch.gep = getelementptr inbounds [3 x %struct.ham*], [3 x %struct.ham*]* @switch.table.zot, i32 0, i32 %arg
; CHECK-NEXT: %switch.load = load %struct.ham*, %struct.ham** %switch.gep, align 8
; CHECK-NEXT: %switch.gep = getelementptr inbounds [3 x ptr], ptr @switch.table.zot, i32 0, i32 %arg
; CHECK-NEXT: %switch.load = load ptr, ptr %switch.gep, align 8
; CHECK-NEXT: br label %bb6
; CHECK: bb6:
; CHECK-NEXT: %tmp7 = phi %struct.ham* [ %switch.load, %switch.lookup ], [ null, %bb ]
; CHECK-NEXT: %tmp8 = icmp eq %struct.ham* %tmp7, bitcast (i32* getelementptr inbounds ([75 x { i32, i32, i32, i8, i8 }], [75 x { i32, i32, i32, i8, i8 }]* @global, i64 1, i64 0, i32 0) to %struct.ham*)
; CHECK-NEXT: %tmp7 = phi ptr [ %switch.load, %switch.lookup ], [ null, %bb ]
; CHECK-NEXT: %tmp8 = icmp eq ptr %tmp7, getelementptr inbounds ([75 x { i32, i32, i32, i8, i8 }], ptr @global, i64 1, i64 0, i32 0)
; CHECK-NEXT: ret i1 %tmp8
;
bb:
Expand All @@ -37,7 +37,7 @@ bb5: ; preds = %bb3
br label %bb6

bb6: ; preds = %bb5, %bb3, %bb1, %bb
%tmp7 = phi %struct.ham* [ null, %bb5 ], [ bitcast (i32* getelementptr inbounds ([75 x { i32, i32, i32, i8, i8 }], [75 x { i32, i32, i32, i8, i8 }]* @global, i64 0, i64 6, i32 0) to %struct.ham*), %bb ], [ null, %bb1 ], [ null, %bb3 ]
%tmp8 = icmp eq %struct.ham* %tmp7, bitcast (i32* getelementptr inbounds ([75 x { i32, i32, i32, i8, i8 }], [75 x { i32, i32, i32, i8, i8 }]* @global, i64 1, i64 0, i32 0) to %struct.ham*)
%tmp7 = phi ptr [ null, %bb5 ], [ getelementptr inbounds ([75 x { i32, i32, i32, i8, i8 }], ptr @global, i64 0, i64 6, i32 0), %bb ], [ null, %bb1 ], [ null, %bb3 ]
%tmp8 = icmp eq ptr %tmp7, getelementptr inbounds ([75 x { i32, i32, i32, i8, i8 }], ptr @global, i64 1, i64 0, i32 0)
ret i1 %tmp8
}
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimplifyCFG/X86/unreachable-blocks.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ entry:

while_block: ; preds = %and_if_cont2, %and_if_cont
%newlen = sub i32 %newlen, 1
%newptr = getelementptr i8, i8* %newptr, i64 1
%newptr = getelementptr i8, ptr %newptr, i64 1
%test = icmp sgt i32 %newlen, 0
br i1 %test, label %and_if1, label %and_if_cont2

and_if1: ; preds = %while_block
%char = load i8, i8* %newptr
%char = load i8, ptr %newptr
%test2 = icmp ule i8 %char, 32
br label %and_if_cont2

Expand Down
40 changes: 20 additions & 20 deletions llvm/test/Transforms/SimplifyCFG/annotations.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

; The branch in %cont has !annotation metadata. Make sure generated AND
; has !annotation metadata.
define i32 @test_preserve_and(i8* %a, i8* %b, i8* %c, i8* %d) {
define i32 @test_preserve_and(ptr %a, ptr %b, ptr %c, ptr %d) {
; CHECK-LABEL: define {{.*}} @test_preserve_and({{.*}}
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8* [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_2:%.*]] = icmp uge ptr [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[C_1]], i1 [[C_2]], i1 false, !annotation !0
; CHECK-NEXT: br i1 [[OR_COND]], label [[CONT1:%.*]], label [[TRAP:%.*]], !annotation !0
; CHECK: trap: ; preds = %entry
Expand All @@ -17,11 +17,11 @@ define i32 @test_preserve_and(i8* %a, i8* %b, i8* %c, i8* %d) {
; CHECK-NEXT: ret i32 0
;
entry:
%c.1 = icmp ult i8* %a, %b, !annotation !0
%c.1 = icmp ult ptr %a, %b, !annotation !0
br i1 %c.1, label %cont, label %trap, !annotation !0

cont: ; preds = %entry
%c.2 = icmp uge i8* %c, %d, !annotation !0
%c.2 = icmp uge ptr %c, %d, !annotation !0
br i1 %c.2, label %cont1, label %trap, !annotation !0

trap: ; preds = %cont, %entry
Expand All @@ -35,11 +35,11 @@ cont1: ; preds = %cont

; The branch in %cont has !annotation metadata. Make sure generated OR
; has !annotation metadata.
define i32 @test_preserve_or(i8* %a, i8* %b, i8* %c, i8* %d) {
define i32 @test_preserve_or(ptr %a, ptr %b, ptr %c, ptr %d) {
; CHECK-LABEL: define {{.*}} @test_preserve_or({{.*}}
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8* [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[C_1:%.*]] = icmp uge ptr [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_2:%.*]] = icmp uge ptr [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[C_1]], i1 true, i1 [[C_2]], !annotation !0
; CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT1:%.*]], !annotation !0
; CHECK: trap: ; preds = %entry
Expand All @@ -50,11 +50,11 @@ define i32 @test_preserve_or(i8* %a, i8* %b, i8* %c, i8* %d) {
; CHECK-NEXT: ret i32 0
;
entry:
%c.1 = icmp ult i8* %a, %b, !annotation !0
%c.1 = icmp ult ptr %a, %b, !annotation !0
br i1 %c.1, label %cont, label %trap, !annotation !0

cont: ; preds = %entry
%c.2 = icmp uge i8* %c, %d, !annotation !0
%c.2 = icmp uge ptr %c, %d, !annotation !0
br i1 %c.2, label %trap, label %cont1, !annotation !0

trap: ; preds = %cont, %entry
Expand All @@ -68,13 +68,13 @@ cont1: ; preds = %cont

; The branch in %cont has !annotation metadata. Make sure generated negation
; and OR have !annotation metadata.
define i32 @test_preserve_or_not(i8* %a, i8* %b, i8* %c, i8* %d) {
define i32 @test_preserve_or_not(ptr %a, ptr %b, ptr %c, ptr %d) {
; CHECK-LABEL: define {{.*}} @test_preserve_or_not({{.*}}
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8* [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_2:%.*]] = xor i1 [[C_1]], true
; CHECK-NEXT: [[C_2_NOT:%.*]] = xor i1 [[C_2]], true, !annotation !0
; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[C_3:%.*]] = icmp uge ptr [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[C_2_NOT]], i1 true, i1 [[C_3]], !annotation !0
; CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT1:%.*]], !annotation !0
; CHECK: trap: ; preds = %entry
Expand All @@ -85,12 +85,12 @@ define i32 @test_preserve_or_not(i8* %a, i8* %b, i8* %c, i8* %d) {
; CHECK-NEXT: ret i32 0
;
entry:
%c.1 = icmp ult i8* %a, %b, !annotation !0
%c.1 = icmp ult ptr %a, %b, !annotation !0
%c.2 = xor i1 %c.1, true
br i1 %c.2, label %cont, label %trap, !annotation !0

cont: ; preds = %entry
%c.3 = icmp uge i8* %c, %d, !annotation !0
%c.3 = icmp uge ptr %c, %d, !annotation !0
br i1 %c.3, label %trap, label %cont1, !annotation !0

trap: ; preds = %cont, %entry
Expand All @@ -105,13 +105,13 @@ cont1: ; preds = %cont

; The branch in %cont has no !annotation metadata. Make sure generated negation
; and OR do not have !annotation metadata.
define i32 @test_or_not_no_annotation(i8* %a, i8* %b, i8* %c, i8* %d) {
define i32 @test_or_not_no_annotation(ptr %a, ptr %b, ptr %c, ptr %d) {
; CHECK-LABEL: define {{.*}} @test_or_not_no_annotation({{.*}}
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8* [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[A:%.*]], [[B:%.*]], !annotation !0
; CHECK-NEXT: [[C_2:%.*]] = xor i1 [[C_1]], true
; CHECK-NEXT: [[C_2_NOT:%.*]] = xor i1 [[C_2]], true
; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[C_3:%.*]] = icmp uge ptr [[C:%.*]], [[D:%.*]], !annotation !0
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[C_2_NOT]], i1 true, i1 [[C_3]]
; CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT1:%.*]], !annotation !0
; CHECK: trap: ; preds = %entry
Expand All @@ -122,12 +122,12 @@ define i32 @test_or_not_no_annotation(i8* %a, i8* %b, i8* %c, i8* %d) {
; CHECK-NEXT: ret i32 0
;
entry:
%c.1 = icmp ult i8* %a, %b, !annotation !0
%c.1 = icmp ult ptr %a, %b, !annotation !0
%c.2 = xor i1 %c.1, true
br i1 %c.2, label %cont, label %trap, !annotation !0

cont: ; preds = %entry
%c.3 = icmp uge i8* %c, %d, !annotation !0
%c.3 = icmp uge ptr %c, %d, !annotation !0
br i1 %c.3, label %trap, label %cont1

trap: ; preds = %cont, %entry
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimplifyCFG/attr-convergent.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
;
; CHECK: call void @barrier
; CHECK-NOT: call void @barrier
define void @check(i1 %cond, i32* %out) {
define void @check(i1 %cond, ptr %out) {
entry:
br i1 %cond, label %if.then, label %if.end

if.then:
store i32 5, i32* %out
store i32 5, ptr %out
br label %if.end

if.end:
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Transforms/SimplifyCFG/attr-noduplicate.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
; CHECK-LABEL: @noduplicate
; CHECK: call void @barrier
; CHECK-NOT: call void @barrier
define void @noduplicate(i32 %cond, i32* %out) {
define void @noduplicate(i32 %cond, ptr %out) {
entry:
%out1 = getelementptr i32, i32* %out, i32 1
%out2 = getelementptr i32, i32* %out, i32 2
%out1 = getelementptr i32, ptr %out, i32 1
%out2 = getelementptr i32, ptr %out, i32 2
%cmp = icmp eq i32 %cond, 0
br i1 %cmp, label %if.then, label %if.end

if.then:
store i32 5, i32* %out
store i32 5, ptr %out
br label %if.end

if.end:
call void @barrier() #0
br i1 %cmp, label %cond.end, label %cond.false

cond.false:
store i32 5, i32* %out1
store i32 5, ptr %out1
br label %cond.end

cond.end:
%value = phi i32 [ 1, %cond.false ], [ 0, %if.end ]
store i32 %value, i32* %out2
store i32 %value, ptr %out2
ret void
}

Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Transforms/SimplifyCFG/basictest.ll
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ define i8 @test6f() {
; CHECK-LABEL: @test6f(
; CHECK-NEXT: bb0:
; CHECK-NEXT: [[R:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[TMP:%.*]] = call i8 @test6g(i8* [[R]])
; CHECK-NEXT: [[TMP:%.*]] = call i8 @test6g(ptr [[R]])
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i8 [[TMP]], 0
; CHECK-NEXT: [[TMP3:%.*]] = load i8, i8* [[R]], align 1
; CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr [[R]], align 1
; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i8 [[TMP3]], 1
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TMP1]], i1 true, i1 [[TMP4]]
; CHECK-NEXT: [[TMP6:%.*]] = select i1 [[OR_COND]], i8 0, i8 1
Expand All @@ -117,11 +117,11 @@ define i8 @test6f() {

bb0:
%r = alloca i8, align 1
%tmp = call i8 @test6g(i8* %r)
%tmp = call i8 @test6g(ptr %r)
%tmp1 = icmp eq i8 %tmp, 0
br i1 %tmp1, label %bb2, label %bb1
bb1:
%tmp3 = load i8, i8* %r, align 1, !range !2, !tbaa !10, !dbg !5
%tmp3 = load i8, ptr %r, align 1, !range !2, !tbaa !10, !dbg !5
%tmp4 = icmp eq i8 %tmp3, 1
br i1 %tmp4, label %bb2, label %bb3
bb2:
Expand All @@ -130,7 +130,7 @@ bb3:
%tmp6 = phi i8 [ 0, %bb2 ], [ 1, %bb1 ]
ret i8 %tmp6
}
declare i8 @test6g(i8*)
declare i8 @test6g(ptr)

!llvm.dbg.cu = !{!3}
!llvm.module.flags = !{!8, !9}
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s

%0 = type { i32*, i32* }
%0 = type { ptr, ptr }

@0 = external hidden constant [5 x %0], align 4

Expand All @@ -16,8 +16,8 @@ define void @foo(i32) nounwind ssp !dbg !0 {
; CHECK-NEXT: [[TMP3:%.*]] = shl i32 1, [[TMP0]]
; CHECK-NEXT: [[TMP4:%.*]] = and i32 [[TMP3]], 31
; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP4]], 0
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [5 x %0], [5 x %0]* @[[GLOB0:[0-9]+]], i32 0, i32 [[TMP0]]
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq %0* [[TMP6]], null
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [5 x %0], ptr @[[GLOB0:[0-9]+]], i32 0, i32 [[TMP0]]
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq ptr [[TMP6]], null
; CHECK-NEXT: [[OR_COND2:%.*]] = select i1 [[TMP5]], i1 true, i1 [[TMP7]]
; CHECK-NEXT: br i1 [[OR_COND2]], label [[COMMON_RET]], label [[BB4:%.*]]
; CHECK: common.ret:
Expand All @@ -42,9 +42,9 @@ BB2: ; preds = %BB1


BB3: ; preds = %BB2
%6 = getelementptr inbounds [5 x %0], [5 x %0]* @0, i32 0, i32 %0, !dbg !6
call void @llvm.dbg.value(metadata %0* %6, metadata !7, metadata !{}), !dbg !12
%7 = icmp eq %0* %6, null, !dbg !13
%6 = getelementptr inbounds [5 x %0], ptr @0, i32 0, i32 %0, !dbg !6
call void @llvm.dbg.value(metadata ptr %6, metadata !7, metadata !{}), !dbg !12
%7 = icmp eq ptr %6, null, !dbg !13
br i1 %7, label %BB5, label %BB4, !dbg !13

BB4: ; preds = %BB3
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/SimplifyCFG/branch-fold-threshold.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; RUN: opt %s -passes='simplifycfg<bonus-inst-threshold=2>' -S | FileCheck %s --check-prefix=AGGRESSIVE
; RUN: opt %s -passes='simplifycfg<bonus-inst-threshold=4>' -S | FileCheck %s --check-prefix=WAYAGGRESSIVE

define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) {
define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, ptr %input) {
; NORMAL-LABEL: @foo(
; AGGRESSIVE-LABEL: @foo(
entry:
Expand All @@ -23,7 +23,7 @@ lor.lhs.false:
; AGGRESSIVE-NOT: br i1

cond.false:
%0 = load i32, i32* %input, align 4
%0 = load i32, ptr %input, align 4
br label %cond.end

cond.end:
Expand All @@ -35,7 +35,7 @@ declare void @distinct_a();
declare void @distinct_b();

;; Like foo, but have to duplicate into multiple predecessors
define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) {
define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d, ptr %input) {
; NORMAL-LABEL: @bar(
; AGGRESSIVE-LABEL: @bar(
entry:
Expand Down Expand Up @@ -74,7 +74,7 @@ lor.lhs.false:
; WAYAGGRESSIVE-NOT: br i1

cond.false:
%0 = load i32, i32* %input, align 4
%0 = load i32, ptr %input, align 4
br label %cond.end

cond.end:
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/SimplifyCFG/branch-fold.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s

define void @test(i32* %P, i32* %Q, i1 %A, i1 %B) {
define void @test(ptr %P, ptr %Q, i1 %A, i1 %B) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A_NOT:%.*]] = xor i1 [[A:%.*]], true
Expand All @@ -10,7 +10,7 @@ define void @test(i32* %P, i32* %Q, i1 %A, i1 %B) {
; CHECK: common.ret:
; CHECK-NEXT: ret void
; CHECK: b:
; CHECK-NEXT: store i32 123, i32* [[P:%.*]], align 4
; CHECK-NEXT: store i32 123, ptr [[P:%.*]], align 4
; CHECK-NEXT: br label [[COMMON_RET]]
;

Expand All @@ -19,7 +19,7 @@ entry:
a:
br i1 %B, label %b, label %c
b:
store i32 123, i32* %P
store i32 123, ptr %P
ret void
c:
ret void
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ F: ; preds = %A, %E
ret i32 123
}

define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
define i32 @test3(i32 %X, i1 %D, ptr %AP, ptr %BP) {
; CHECK-LABEL: @test3(
; CHECK-NEXT: E:
; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[X:%.*]], 0
Expand All @@ -82,8 +82,8 @@ define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
; CHECK-NEXT: ret i32 [[COMMON_RET_OP]]
; CHECK: B.critedge:
; CHECK-NEXT: call void @f3()
; CHECK-NEXT: [[XX_C:%.*]] = load i32, i32* [[AP:%.*]], align 4
; CHECK-NEXT: store i32 [[XX_C]], i32* [[BP:%.*]], align 4
; CHECK-NEXT: [[XX_C:%.*]] = load i32, ptr [[AP:%.*]], align 4
; CHECK-NEXT: store i32 [[XX_C]], ptr [[BP:%.*]], align 4
; CHECK-NEXT: call void @f2()
; CHECK-NEXT: br label [[COMMON_RET:%.*]]
; CHECK: F:
Expand All @@ -95,8 +95,8 @@ E:
br i1 %C, label %T, label %F
T: ; preds = %A, %E
call void @f3( )
%XX = load i32, i32* %AP ; <i32> [#uses=1]
store i32 %XX, i32* %BP
%XX = load i32, ptr %AP ; <i32> [#uses=1]
store i32 %XX, ptr %BP
br i1 %C, label %B, label %A
A: ; preds = %T
call void @f1( )
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimplifyCFG/cleanup-phis.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ target triple = "wasm32-unknown-unknown"
; This is a regression test for a bug in which we used phis() without
; make_early_inc_range() in a for loop while deleting phi nodes.

define void @cleanup_phis() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) {
define void @cleanup_phis() personality ptr @__gxx_wasm_personality_v0 {
bb0:
invoke void @foo()
to label %bb1 unwind label %ehcleanup
Expand All @@ -33,7 +33,7 @@ catchswitch: ; preds = %ehcleanup
%1 = catchswitch within none [label %catch] unwind to caller

catch: ; preds = %catchswitch
%2 = catchpad within %1 [i8* null]
%2 = catchpad within %1 [ptr null]
call void @bar(i32 %phi0, i32 %phi1)
unreachable
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimplifyCFG/common-code-hoisting.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ declare void @f0()
declare void @f1()
declare void @f2()

declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)

define void @_Z4loopi(i1 %cmp) {
; HOIST-LABEL: @_Z4loopi(
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Transforms/SimplifyCFG/constantexprs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
%struct.j = type { %struct.c }
%struct.c = type { %struct.a }
%struct.a = type { i8 }
%struct.e = type { %struct.a* }
%struct.e = type { ptr }

$_ZN1eC2EPK1a = comdat any

@_ZN12_GLOBAL__N_12anE = internal global %"struct.(anonymous namespace)::aj" zeroinitializer, align 1

declare dso_local i32 @_Zeq1eS_(%struct.a*, %struct.a*) local_unnamed_addr #2
declare dso_local i32 @_Zeq1eS_(ptr, ptr) local_unnamed_addr #2

define internal fastcc %struct.a* @_ZNK1jIiN12_GLOBAL__N_12ajEE2aeERKi() unnamed_addr #0 align 2 {
define internal fastcc ptr @_ZNK1jIiN12_GLOBAL__N_12ajEE2aeERKi() unnamed_addr #0 align 2 {
; CHECK-LABEL: @_ZNK1jIiN12_GLOBAL__N_12ajEE2aeERKi
entry:
%call = call i32 @_Zeq1eS_(%struct.a* null, %struct.a* null)
%call = call i32 @_Zeq1eS_(ptr null, ptr null)
%tobool = icmp eq i32 %call, 0
br i1 %tobool, label %cond.false, label %cond.end

cond.false: ; preds = %entry
br label %cond.end

cond.end: ; preds = %entry, %cond.false
%retval.sroa.0.0 = phi %struct.a* [ null, %cond.false ], [ extractelement (<1 x %struct.a*> inttoptr (<1 x i64> bitcast (i64 ptrtoint (%"struct.(anonymous namespace)::aj"* @_ZN12_GLOBAL__N_12anE to i64) to <1 x i64>) to <1 x %struct.a*>), i64 0), %entry ]
ret %struct.a* %retval.sroa.0.0
%retval.sroa.0.0 = phi ptr [ null, %cond.false ], [ extractelement (<1 x ptr> inttoptr (<1 x i64> bitcast (i64 ptrtoint (ptr @_ZN12_GLOBAL__N_12anE to i64) to <1 x i64>) to <1 x ptr>), i64 0), %entry ]
ret ptr %retval.sroa.0.0
}
82 changes: 41 additions & 41 deletions llvm/test/Transforms/SimplifyCFG/dbginfo.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,82 @@
; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s

%llvm.dbg.anchor.type = type { i32, i32 }
%llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
%llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
%llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
%llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
%llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* }
%llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
%llvm.dbg.basictype.type = type { i32, ptr, ptr, ptr, i32, i64, i64, i64, i32, i32 }
%llvm.dbg.compile_unit.type = type { i32, ptr, i32, ptr, ptr, ptr, i1, i1, ptr }
%llvm.dbg.composite.type = type { i32, ptr, ptr, ptr, i32, i64, i64, i64, i32, ptr, ptr }
%llvm.dbg.derivedtype.type = type { i32, ptr, ptr, ptr, i32, i64, i64, i64, i32, ptr }
%llvm.dbg.global_variable.type = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i1, i1, ptr }
%llvm.dbg.subprogram.type = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i1, i1 }
%llvm.dbg.subrange.type = type { i32, i64, i64 }
%struct.Group = type { %struct.Scene, %struct.Sphere, %"struct.std::list<Scene*,std::allocator<Scene*> >" }
%struct.Ray = type { %struct.Vec, %struct.Vec }
%struct.Scene = type { i32 (...)** }
%struct.Scene = type { ptr }
%struct.Sphere = type { %struct.Scene, %struct.Vec, double }
%struct.Vec = type { double, double, double }
%struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
%struct.__false_type = type <{ i8 }>
%"struct.__gnu_cxx::new_allocator<Scene*>" = type <{ i8 }>
%"struct.__gnu_cxx::new_allocator<std::_List_node<Scene*> >" = type <{ i8 }>
%struct.__si_class_type_info_pseudo = type { %struct.__type_info_pseudo, %"struct.std::type_info"* }
%struct.__type_info_pseudo = type { i8*, i8* }
%struct.__si_class_type_info_pseudo = type { %struct.__type_info_pseudo, ptr }
%struct.__type_info_pseudo = type { ptr, ptr }
%"struct.std::Hit" = type { double, %struct.Vec }
%"struct.std::_List_base<Scene*,std::allocator<Scene*> >" = type { %"struct.std::_List_base<Scene*,std::allocator<Scene*> >::_List_impl" }
%"struct.std::_List_base<Scene*,std::allocator<Scene*> >::_List_impl" = type { %"struct.std::_List_node_base" }
%"struct.std::_List_const_iterator<Scene*>" = type { %"struct.std::_List_node_base"* }
%"struct.std::_List_iterator<Scene*>" = type { %"struct.std::_List_node_base"* }
%"struct.std::_List_node<Scene*>" = type { %"struct.std::_List_node_base", %struct.Scene* }
%"struct.std::_List_node_base" = type { %"struct.std::_List_node_base"*, %"struct.std::_List_node_base"* }
%"struct.std::_List_const_iterator<Scene*>" = type { ptr }
%"struct.std::_List_iterator<Scene*>" = type { ptr }
%"struct.std::_List_node<Scene*>" = type { %"struct.std::_List_node_base", ptr }
%"struct.std::_List_node_base" = type { ptr, ptr }
%"struct.std::allocator<Scene*>" = type <{ i8 }>
%"struct.std::allocator<std::_List_node<Scene*> >" = type <{ i8 }>
%"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i8, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"* }
%"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
%"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }
%"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
%"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"struct.std::basic_ostream<char,std::char_traits<char> >" = type { ptr, %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"struct.std::locale" }
%"struct.std::ctype<char>" = type { %"struct.std::locale::facet", ptr, i8, ptr, ptr, ptr, i8, [256 x i8], [256 x i8], i8 }
%"struct.std::ios_base" = type { ptr, i32, i32, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"struct.std::locale" }
%"struct.std::ios_base::Init" = type <{ i8 }>
%"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
%"struct.std::ios_base::_Words" = type { i8*, i32 }
%"struct.std::ios_base::_Callback_list" = type { ptr, ptr, i32, i32 }
%"struct.std::ios_base::_Words" = type { ptr, i32 }
%"struct.std::list<Scene*,std::allocator<Scene*> >" = type { %"struct.std::_List_base<Scene*,std::allocator<Scene*> >" }
%"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
%"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
%"struct.std::locale::facet" = type { i32 (...)**, i32 }
%"struct.std::locale" = type { ptr }
%"struct.std::locale::_Impl" = type { i32, ptr, i32, ptr, ptr }
%"struct.std::locale::facet" = type { ptr, i32 }
%"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
%"struct.std::num_put<char,std::ostreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
%"struct.std::numeric_limits<double>" = type <{ i8 }>
%"struct.std::type_info" = type { i32 (...)**, i8* }
@llvm.dbg.subprogram947 = external constant %llvm.dbg.subprogram.type ; <%llvm.dbg.subprogram.type*> [#uses=1]
%"struct.std::type_info" = type { ptr, ptr }
@llvm.dbg.subprogram947 = external constant %llvm.dbg.subprogram.type ; <ptr> [#uses=1]

declare void @llvm.dbg.func.start({ }*) nounwind
declare void @llvm.dbg.func.start(ptr) nounwind

declare void @llvm.dbg.region.end({ }*) nounwind
declare void @llvm.dbg.region.end(ptr) nounwind

declare void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(%struct.__false_type*) nounwind
declare void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(ptr) nounwind

define void @_ZNSaIP5SceneED1Ev(%struct.__false_type* %this) nounwind {
define void @_ZNSaIP5SceneED1Ev(ptr %this) nounwind {
; CHECK-LABEL: @_ZNSaIP5SceneED1Ev(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca %struct.__false_type*, align 8
; CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
; CHECK-NEXT: %"alloca point" = bitcast i32 0 to i32
; CHECK-NEXT: call void @llvm.dbg.func.start({}* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram947 to {}*))
; CHECK-NEXT: store %struct.__false_type* [[THIS:%.*]], %struct.__false_type** [[THIS_ADDR]], align 8
; CHECK-NEXT: [[TMP0:%.*]] = load %struct.__false_type*, %struct.__false_type** [[THIS_ADDR]], align 4
; CHECK-NEXT: call void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(%struct.__false_type* [[TMP0]]) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: call void @llvm.dbg.region.end({}* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram947 to {}*))
; CHECK-NEXT: call void @llvm.dbg.func.start(ptr @llvm.dbg.subprogram947)
; CHECK-NEXT: store ptr [[THIS:%.*]], ptr [[THIS_ADDR]], align 8
; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS_ADDR]], align 4
; CHECK-NEXT: call void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(ptr [[TMP0]]) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: call void @llvm.dbg.region.end(ptr @llvm.dbg.subprogram947)
; CHECK-NEXT: ret void
;
entry:
%this_addr = alloca %struct.__false_type* ; <%struct.__false_type**> [#uses=2]
%this_addr = alloca ptr ; <ptr> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram947 to { }*))
store %struct.__false_type* %this, %struct.__false_type** %this_addr
%0 = load %struct.__false_type*, %struct.__false_type** %this_addr, align 4 ; <%struct.__false_type*> [#uses=1]
call void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(%struct.__false_type* %0) nounwind
call void @llvm.dbg.func.start(ptr @llvm.dbg.subprogram947)
store ptr %this, ptr %this_addr
%0 = load ptr, ptr %this_addr, align 4 ; <ptr> [#uses=1]
call void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(ptr %0) nounwind
br label %bb

bb: ; preds = %entry
br label %return

return: ; preds = %bb
call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram947 to { }*))
call void @llvm.dbg.region.end(ptr @llvm.dbg.subprogram947)
ret void
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ entry:
; CHECK-NEXT: entry:
; CHECK-NEXT: ret void

%label = bitcast i8* blockaddress(@test_indirectbr, %L1) to i8*
indirectbr i8* %label, [label %L1, label %L2]
%label = bitcast ptr blockaddress(@test_indirectbr, %L1) to ptr
indirectbr ptr %label, [label %L1, label %L2]

L1: ; preds = %entry
ret void
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ define void @bar(i32 %aa) {
entry:
%aa.addr = alloca i32, align 4
%bb = alloca i32, align 4
store i32 %aa, i32* %aa.addr, align 4
store i32 0, i32* %bb, align 4
store i32 %aa, ptr %aa.addr, align 4
store i32 0, ptr %bb, align 4
%tobool = icmp ne i32 %aa, 0
br i1 %tobool, label %if.then, label %if.end

Expand All @@ -18,15 +18,15 @@ if.then: ; preds = %entry
br label %if.end

if.end: ; preds = %if.then, %entry
store i32 1, i32* %bb, align 4
store i32 1, ptr %bb, align 4
br i1 %tobool, label %if.then.1, label %if.end.1 ; "line 10" to -debugify

if.then.1: ; preds = %if.end
call void @foo()
br label %if.end.1

if.end.1: ; preds = %if.then.1, %if.end
store i32 2, i32* %bb, align 4
store i32 2, ptr %bb, align 4
br label %for.end

for.end: ; preds = %if.end.1
Expand Down
36 changes: 18 additions & 18 deletions llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare i32 @__gxx_personality_v0(...)
declare void @fn()


define void @test1() personality i32 (...)* @__gxx_personality_v0 {
define void @test1() personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @fn()
Expand All @@ -17,7 +17,7 @@ define void @test1() personality i32 (...)* @__gxx_personality_v0 {
; CHECK: common.ret:
; CHECK-NEXT: ret void
; CHECK: lpad2:
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: br label [[COMMON_RET]]
Expand All @@ -34,12 +34,12 @@ invoke.cont:
ret void

lpad1:
%exn = landingpad {i8*, i32}
%exn = landingpad {ptr, i32}
cleanup
br label %shared_resume

lpad2:
%exn2 = landingpad {i8*, i32}
%exn2 = landingpad {ptr, i32}
cleanup
br label %shared_resume

Expand All @@ -49,7 +49,7 @@ shared_resume:
}

; Don't trigger if blocks aren't the same/empty
define void @neg1() personality i32 (...)* @__gxx_personality_v0 {
define void @neg1() personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @neg1(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @fn()
Expand All @@ -60,12 +60,12 @@ define void @neg1() personality i32 (...)* @__gxx_personality_v0 {
; CHECK: common.ret:
; CHECK-NEXT: ret void
; CHECK: lpad1:
; CHECK-NEXT: [[EXN:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: filter [0 x i8*] zeroinitializer
; CHECK-NEXT: [[EXN:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: filter [0 x ptr] zeroinitializer
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: br label [[SHARED_RESUME:%.*]]
; CHECK: lpad2:
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[SHARED_RESUME]]
; CHECK: shared_resume:
Expand All @@ -84,13 +84,13 @@ invoke.cont:
ret void

lpad1:
%exn = landingpad {i8*, i32}
filter [0 x i8*] zeroinitializer
%exn = landingpad {ptr, i32}
filter [0 x ptr] zeroinitializer
call void @fn()
br label %shared_resume

lpad2:
%exn2 = landingpad {i8*, i32}
%exn2 = landingpad {ptr, i32}
cleanup
br label %shared_resume

Expand All @@ -100,7 +100,7 @@ shared_resume:
}

; Should not trigger when the landing pads are not the exact same
define void @neg2() personality i32 (...)* @__gxx_personality_v0 {
define void @neg2() personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @neg2(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @fn()
Expand All @@ -111,11 +111,11 @@ define void @neg2() personality i32 (...)* @__gxx_personality_v0 {
; CHECK: common.ret:
; CHECK-NEXT: ret void
; CHECK: lpad1:
; CHECK-NEXT: [[EXN:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: filter [0 x i8*] zeroinitializer
; CHECK-NEXT: [[EXN:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: filter [0 x ptr] zeroinitializer
; CHECK-NEXT: br label [[SHARED_RESUME:%.*]]
; CHECK: lpad2:
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: [[EXN2:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[SHARED_RESUME]]
; CHECK: shared_resume:
Expand All @@ -134,12 +134,12 @@ invoke.cont:
ret void

lpad1:
%exn = landingpad {i8*, i32}
filter [0 x i8*] zeroinitializer
%exn = landingpad {ptr, i32}
filter [0 x ptr] zeroinitializer
br label %shared_resume

lpad2:
%exn2 = landingpad {i8*, i32}
%exn2 = landingpad {ptr, i32}
cleanup
br label %shared_resume

Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/SimplifyCFG/empty-catchpad.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare void @f()
declare void @llvm.foo(i32) nounwind
declare void @ProcessCLRException()

define void @test1() personality void ()* @ProcessCLRException {
define void @test1() personality ptr @ProcessCLRException {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @f()
Expand Down Expand Up @@ -37,7 +37,7 @@ exit:
; Remove unreachble catch2, leave catch1 as-is

; Remove both catchpads and the catchswitch from exn.dispatch
define void @test2() personality void ()* @ProcessCLRException {
define void @test2() personality ptr @ProcessCLRException {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @f()
Expand Down Expand Up @@ -92,7 +92,7 @@ exit:

; Same as @test2, but exn.dispatch catchswitch has an unwind dest that
; preds need to be reidrected to
define void @test3() personality void ()* @ProcessCLRException {
define void @test3() personality ptr @ProcessCLRException {
; CHECK-LABEL: @test3(
; CHECK-NEXT: entry:
; CHECK-NEXT: invoke void @f()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -passes=simplifycfg -bonus-inst-threshold=1 | FileCheck %s

declare i8* @llvm.strip.invariant.group.p0i8(i8*)
declare ptr @llvm.strip.invariant.group.p0(ptr)

declare void @g1()
declare void @g2()

define void @f(i8* %a, i8* %b, i1 %c, i1 %d, i1 %e) {
define void @f(ptr %a, ptr %b, i1 %c, i1 %d, i1 %e) {
; CHECK-LABEL: @f(
; CHECK-NEXT: [[A1:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* [[A:%.*]])
; CHECK-NEXT: [[B1:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* [[B:%.*]])
; CHECK-NEXT: [[I:%.*]] = icmp eq i8* [[A1]], [[B1]]
; CHECK-NEXT: [[A1:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr [[A:%.*]])
; CHECK-NEXT: [[B1:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr [[B:%.*]])
; CHECK-NEXT: [[I:%.*]] = icmp eq ptr [[A1]], [[B1]]
; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[C:%.*]], i1 [[I]], i1 false
; CHECK-NEXT: br i1 [[OR_COND]], label [[L2:%.*]], label [[L3:%.*]]
; CHECK: l2:
Expand All @@ -24,9 +24,9 @@ define void @f(i8* %a, i8* %b, i1 %c, i1 %d, i1 %e) {
;
br i1 %c, label %l1, label %l3
l1:
%a1 = call i8* @llvm.strip.invariant.group.p0i8(i8* %a)
%b1 = call i8* @llvm.strip.invariant.group.p0i8(i8* %b)
%i = icmp eq i8* %a1, %b1
%a1 = call ptr @llvm.strip.invariant.group.p0(ptr %a)
%b1 = call ptr @llvm.strip.invariant.group.p0(ptr %b)
%i = icmp eq ptr %a1, %b1
br i1 %i, label %l2, label %l3
l2:
call void @g1()
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimplifyCFG/gepcost.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define void @f(i1 %c) {
; CHECK-NEXT: entr:
; CHECK-NEXT: br i1 %c, label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[PAT:%.*]] = getelementptr [16 x i8], [16 x i8]* @glob
; CHECK-NEXT: [[PAT:%.*]] = getelementptr [16 x i8], ptr @glob
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
Expand All @@ -20,7 +20,7 @@ entr:
br i1 %c, label %next, label %exit

next:
%pat = getelementptr [16 x i8], [16 x i8]* @glob
%pat = getelementptr [16 x i8], ptr @glob
br label %exit

exit:
Expand Down
18 changes: 9 additions & 9 deletions llvm/test/Transforms/SimplifyCFG/guards.ll
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ false:
ret i32 20
}

define i32 @f_2(i1 %c, i32* %buf) {
define i32 @f_2(i1 %c, ptr %buf) {
; CHECK-LABEL: @f_2(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[C:%.*]], label [[GUARD_BLOCK:%.*]], label [[MERGE_BLOCK:%.*]]
Expand All @@ -53,7 +53,7 @@ entry:

guard_block:
call void(i1, ...) @llvm.experimental.guard(i1 false) [ "deopt"() ]
%val = load i32, i32* %buf
%val = load i32, ptr %buf
br label %merge_block

merge_block:
Expand All @@ -62,31 +62,31 @@ merge_block:

}

define i32 @f_3(i1* %c, i32* %buf) {
define i32 @f_3(ptr %c, ptr %buf) {
; CHECK-LABEL: @f_3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C0:%.*]] = load volatile i1, i1* [[C:%.*]], align 1
; CHECK-NEXT: [[C0:%.*]] = load volatile i1, ptr [[C:%.*]], align 1
; CHECK-NEXT: br i1 [[C0]], label [[GUARD_BLOCK:%.*]], label [[MERGE_BLOCK:%.*]]
; CHECK: guard_block:
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 false) [ "deopt"() ]
; CHECK-NEXT: unreachable
; CHECK: merge_block:
; CHECK-NEXT: [[C1:%.*]] = load volatile i1, i1* [[C]], align 1
; CHECK-NEXT: [[C1:%.*]] = load volatile i1, ptr [[C]], align 1
; CHECK-NEXT: [[DOT:%.*]] = select i1 [[C1]], i32 50, i32 100
; CHECK-NEXT: ret i32 [[DOT]]
;
entry:
%c0 = load volatile i1, i1* %c
%c0 = load volatile i1, ptr %c
br i1 %c0, label %guard_block, label %merge_block

guard_block:
call void(i1, ...) @llvm.experimental.guard(i1 false) [ "deopt"() ]
%val = load i32, i32* %buf
%c2 = load volatile i1, i1* %c
%val = load i32, ptr %buf
%c2 = load volatile i1, ptr %c
br i1 %c2, label %left, label %right

merge_block:
%c1 = load volatile i1, i1* %c
%c1 = load volatile i1, ptr %c
br i1 %c1, label %left, label %right

left:
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Transforms/SimplifyCFG/hoist-common-code.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@

declare void @bar(i32)

define void @test(i1 %P, i32* %Q) {
define void @test(i1 %P, ptr %Q) {
; CHECK-LABEL: @test(
; CHECK-NEXT: common.ret:
; CHECK-NEXT: store i32 1, i32* [[Q:%.*]], align 4
; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[Q]], align 4
; CHECK-NEXT: store i32 1, ptr [[Q:%.*]], align 4
; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[Q]], align 4
; CHECK-NEXT: call void @bar(i32 [[A]])
; CHECK-NEXT: ret void
;
br i1 %P, label %T, label %F
T: ; preds = %0
store i32 1, i32* %Q
%A = load i32, i32* %Q ; <i32> [#uses=1]
store i32 1, ptr %Q
%A = load i32, ptr %Q ; <i32> [#uses=1]
call void @bar( i32 %A )
ret void
F: ; preds = %0
store i32 1, i32* %Q
%B = load i32, i32* %Q ; <i32> [#uses=1]
store i32 1, ptr %Q
%B = load i32, ptr %Q ; <i32> [#uses=1]
call void @bar( i32 %B )
ret void
}
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -hoist-common-insts=true -S < %s | FileCheck %s
; Verify that we don't crash due an invalid !dbg location on the hoisted llvm.dbg.value

define i64 @caller(i64* %ptr, i64 %flag) !dbg !10 {
define i64 @caller(ptr %ptr, i64 %flag) !dbg !10 {
init:
%v9 = icmp eq i64 %flag, 0
br i1 %v9, label %a, label %b

; CHECK: %vala = load i64, i64* %ptr
; CHECK: %vala = load i64, ptr %ptr
; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %vala, metadata [[MD:![0-9]*]]
; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %vala, metadata [[MD]]
; CHECK-NEXT: %valbmasked = and i64 %vala, 1

a: ; preds = %init
%vala = load i64, i64* %ptr, align 8
%vala = load i64, ptr %ptr, align 8
call void @llvm.dbg.value(metadata i64 %vala, metadata !8, metadata !DIExpression()), !dbg !12
br label %test.exit

b: ; preds = %init
%valb = load i64, i64* %ptr, align 8
%valb = load i64, ptr %ptr, align 8
call void @llvm.dbg.value(metadata i64 %valb, metadata !8, metadata !DIExpression()), !dbg !13
%valbmasked = and i64 %valb, 1
br label %test.exit
Expand Down
Loading