diff --git a/llvm/test/Transforms/MergeICmps/X86/addressspaces.ll b/llvm/test/Transforms/MergeICmps/X86/addressspaces.ll index cc981902b2d35..28464c795ff23 100644 --- a/llvm/test/Transforms/MergeICmps/X86/addressspaces.ll +++ b/llvm/test/Transforms/MergeICmps/X86/addressspaces.ll @@ -3,41 +3,33 @@ target triple = "x86_64" ; First check that we try to from a memcmp. -define void @form_memcmp([2 x i64]* dereferenceable(16) %a, [2 x i64]* dereferenceable(16) %b) { +define void @form_memcmp(ptr dereferenceable(16) %a, ptr dereferenceable(16) %b) { ; CHECK-LABEL: @form_memcmp( ; CHECK-NEXT: bb0: -; CHECK-NEXT: [[PTR_A0:%.*]] = getelementptr inbounds [2 x i64], [2 x i64]* [[A:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[PTR_A1:%.*]] = getelementptr inbounds [2 x i64], [2 x i64]* [[A]], i64 0, i64 1 -; CHECK-NEXT: [[PTR_B0:%.*]] = getelementptr inbounds [2 x i64], [2 x i64]* [[B:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[PTR_B1:%.*]] = getelementptr inbounds [2 x i64], [2 x i64]* [[B]], i64 0, i64 1 +; CHECK-NEXT: [[PTR_A1:%.*]] = getelementptr inbounds [2 x i64], ptr [[A:%.*]], i64 0, i64 1 +; CHECK-NEXT: [[PTR_B1:%.*]] = getelementptr inbounds [2 x i64], ptr [[B:%.*]], i64 0, i64 1 ; CHECK-NEXT: br label %"bb1+bb2" ; CHECK: "bb1+bb2": -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [2 x i64], [2 x i64]* [[A]], i64 0, i64 0 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [2 x i64], [2 x i64]* [[B]], i64 0, i64 0 -; CHECK-NEXT: [[CSTR:%.*]] = bitcast i64* [[TMP0]] to i8* -; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i64* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A]], ptr [[B]], i64 16) ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[BB3:%.*]] ; CHECK: bb3: ; CHECK-NEXT: ret void ; bb0: - %ptr_a0 = getelementptr inbounds [2 x i64], [2 x i64]* %a, i64 0, i64 0 - %ptr_a1 = getelementptr inbounds [2 x i64], [2 x i64]* %a, i64 0, i64 1 - %ptr_b0 = getelementptr inbounds [2 x i64], [2 x i64]* %b, i64 0, i64 0 - %ptr_b1 = getelementptr inbounds [2 x i64], [2 x i64]* %b, i64 0, i64 1 + %ptr_a1 = getelementptr inbounds [2 x i64], ptr %a, i64 0, i64 1 + %ptr_b1 = getelementptr inbounds [2 x i64], ptr %b, i64 0, i64 1 br label %bb1 bb1: ; preds = %bb0 - %a0 = load i64, i64* %ptr_a0 - %b0 = load i64, i64* %ptr_b0 + %a0 = load i64, ptr %a + %b0 = load i64, ptr %b %cond0 = icmp eq i64 %a0, %b0 br i1 %cond0, label %bb2, label %bb3 bb2: ; preds = %bb1 - %a1 = load i64, i64* %ptr_a1 - %b1 = load i64, i64* %ptr_b1 + %a1 = load i64, ptr %ptr_a1 + %b1 = load i64, ptr %ptr_b1 %cond1 = icmp eq i64 %a1, %b1 br label %bb3 @@ -47,22 +39,20 @@ bb3: ; preds = %bb2, %bb1 } ; We can't use memcmp between arbitrary addressesspaces -define void @no_memcmp([2 x i64] addrspace(11)* dereferenceable(16) %a, [2 x i64] addrspace(11)* dereferenceable(16) %b) { +define void @no_memcmp(ptr addrspace(11) dereferenceable(16) %a, ptr addrspace(11) dereferenceable(16) %b) { ; CHECK-LABEL: @no_memcmp( ; CHECK-NEXT: bb0: -; CHECK-NEXT: [[PTR_A0:%.*]] = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* [[A:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[PTR_A1:%.*]] = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* [[A]], i64 0, i64 1 -; CHECK-NEXT: [[PTR_B0:%.*]] = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* [[B:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[PTR_B1:%.*]] = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* [[B]], i64 0, i64 1 +; CHECK-NEXT: [[PTR_A1:%.*]] = getelementptr inbounds [2 x i64], ptr addrspace(11) [[A:%.*]], i64 0, i64 1 +; CHECK-NEXT: [[PTR_B1:%.*]] = getelementptr inbounds [2 x i64], ptr addrspace(11) [[B:%.*]], i64 0, i64 1 ; CHECK-NEXT: br label [[BB1:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[A0:%.*]] = load i64, i64 addrspace(11)* [[PTR_A0]], align 4 -; CHECK-NEXT: [[B0:%.*]] = load i64, i64 addrspace(11)* [[PTR_B0]], align 4 +; CHECK-NEXT: [[A0:%.*]] = load i64, ptr addrspace(11) [[A]], align 4 +; CHECK-NEXT: [[B0:%.*]] = load i64, ptr addrspace(11) [[B]], align 4 ; CHECK-NEXT: [[COND0:%.*]] = icmp eq i64 [[A0]], [[B0]] ; CHECK-NEXT: br i1 [[COND0]], label [[BB2:%.*]], label [[BB3:%.*]] ; CHECK: bb2: -; CHECK-NEXT: [[A1:%.*]] = load i64, i64 addrspace(11)* [[PTR_A1]], align 4 -; CHECK-NEXT: [[B1:%.*]] = load i64, i64 addrspace(11)* [[PTR_B1]], align 4 +; CHECK-NEXT: [[A1:%.*]] = load i64, ptr addrspace(11) [[PTR_A1]], align 4 +; CHECK-NEXT: [[B1:%.*]] = load i64, ptr addrspace(11) [[PTR_B1]], align 4 ; CHECK-NEXT: [[COND1:%.*]] = icmp eq i64 [[A1]], [[B1]] ; CHECK-NEXT: br label [[BB3]] ; CHECK: bb3: @@ -70,21 +60,19 @@ define void @no_memcmp([2 x i64] addrspace(11)* dereferenceable(16) %a, [2 x i64 ; CHECK-NEXT: ret void ; bb0: - %ptr_a0 = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* %a, i64 0, i64 0 - %ptr_a1 = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* %a, i64 0, i64 1 - %ptr_b0 = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* %b, i64 0, i64 0 - %ptr_b1 = getelementptr inbounds [2 x i64], [2 x i64] addrspace(11)* %b, i64 0, i64 1 + %ptr_a1 = getelementptr inbounds [2 x i64], ptr addrspace(11) %a, i64 0, i64 1 + %ptr_b1 = getelementptr inbounds [2 x i64], ptr addrspace(11) %b, i64 0, i64 1 br label %bb1 bb1: ; preds = %bb0 - %a0 = load i64, i64 addrspace(11)* %ptr_a0 - %b0 = load i64, i64 addrspace(11)* %ptr_b0 + %a0 = load i64, ptr addrspace(11) %a + %b0 = load i64, ptr addrspace(11) %b %cond0 = icmp eq i64 %a0, %b0 br i1 %cond0, label %bb2, label %bb3 bb2: ; preds = %bb1 - %a1 = load i64, i64 addrspace(11)* %ptr_a1 - %b1 = load i64, i64 addrspace(11)* %ptr_b1 + %a1 = load i64, ptr addrspace(11) %ptr_a1 + %b1 = load i64, ptr addrspace(11) %ptr_b1 %cond1 = icmp eq i64 %a1, %b1 br label %bb3 diff --git a/llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll b/llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll index 54210232e4f51..09ef757cbdf9f 100644 --- a/llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll +++ b/llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll @@ -7,52 +7,46 @@ define zeroext i1 @opeq1( ; X86-LABEL: @opeq1( ; X86-NEXT: "entry+land.rhs.i+land.rhs.i.2+land.rhs.i.3": ; X86-NEXT: [[PTR:%.*]] = alloca i32, align 4 -; X86-NEXT: store i32 42, i32* [[PTR]], align 4 -; X86-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; X86-NEXT: store i32 42, ptr [[PTR]], align 4 +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A:%.*]], ptr [[B:%.*]], i64 16) ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: ; X86-NEXT: ret i1 [[TMP2]] ; - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { entry: %ptr = alloca i32 - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 ; Does other work, has no interference, merge block - store i32 42, i32* %ptr + store i32 42, ptr %ptr %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %2, %3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 2 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2 + %5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %4, %5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %6, %7 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/atomic.ll b/llvm/test/Transforms/MergeICmps/X86/atomic.ll index 9cbeb5d0b84ad..a2a948aa0e5f3 100644 --- a/llvm/test/Transforms/MergeICmps/X86/atomic.ll +++ b/llvm/test/Transforms/MergeICmps/X86/atomic.ll @@ -6,38 +6,34 @@ define zeroext i1 @opeq( ; CHECK-LABEL: @opeq( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; CHECK-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; CHECK-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; CHECK-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; CHECK: land.rhs.i: -; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, i32* [[SECOND_I]] seq_cst, align 4 -; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 1 +; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, ptr [[SECOND_I]] seq_cst, align 4 +; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; CHECK-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; CHECK-NEXT: br label [[OPEQ1_EXIT]] ; CHECK: opeq1.exit: ; CHECK-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; CHECK-NEXT: ret i1 [[TMP4]] ; - %S* nocapture readonly dereferenceable(8) %a, - %S* nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load atomic i32, i32* %second.i seq_cst, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load atomic i32, ptr %second.i seq_cst, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled-2.ll b/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled-2.ll index e23653228d8fa..3335f276c5ee9 100644 --- a/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled-2.ll +++ b/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled-2.ll @@ -3,7 +3,7 @@ target triple = "x86_64-unknown-linux-gnu" -%"struct.a::c" = type { i32, i32*, i8* } +%"struct.a::c" = type { i32, ptr, ptr } ; The entry block cannot be merged as the comparison is not continuous. ; While it compares the highest address, it should not be moved after the @@ -14,20 +14,16 @@ define i1 @test() { ; CHECK-NEXT: "land.lhs.true+entry": ; CHECK-NEXT: [[H:%.*]] = alloca %"struct.a::c", align 8 ; CHECK-NEXT: [[I:%.*]] = alloca %"struct.a::c", align 8 -; CHECK-NEXT: call void @init(%"struct.a::c"* [[H]]) -; CHECK-NEXT: call void @init(%"struct.a::c"* [[I]]) -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds %"struct.a::c", %"struct.a::c"* [[H]], i64 0, i32 1 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds %"struct.a::c", %"struct.a::c"* [[I]], i64 0, i32 1 -; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32** [[TMP0]] to i8* -; CHECK-NEXT: [[CSTR2:%.*]] = bitcast i32** [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR2]], i64 16) +; CHECK-NEXT: call void @init(ptr [[H]]) +; CHECK-NEXT: call void @init(ptr [[I]]) +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds %"struct.a::c", ptr [[H]], i64 0, i32 1 +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds %"struct.a::c", ptr [[I]], i64 0, i32 1 +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP0]], ptr [[TMP1]], i64 16) ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br i1 [[TMP2]], label [[LAND_RHS1:%.*]], label [[LAND_END:%.*]] ; CHECK: land.rhs1: -; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds %"struct.a::c", %"struct.a::c"* [[H]], i64 0, i32 0 -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds %"struct.a::c", %"struct.a::c"* [[I]], i64 0, i32 0 -; CHECK-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 4 -; CHECK-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 4 +; CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[H]], align 4 +; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[I]], align 4 ; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[TMP5]], [[TMP6]] ; CHECK-NEXT: br label [[LAND_END]] ; CHECK: land.end: @@ -37,28 +33,26 @@ define i1 @test() { entry: %h = alloca %"struct.a::c", align 8 %i = alloca %"struct.a::c", align 8 - call void @init(%"struct.a::c"* %h) - call void @init(%"struct.a::c"* %i) - %e = getelementptr inbounds %"struct.a::c", %"struct.a::c"* %h, i64 0, i32 2 - %v3 = load i8*, i8** %e, align 8 - %e2 = getelementptr inbounds %"struct.a::c", %"struct.a::c"* %i, i64 0, i32 2 - %v4 = load i8*, i8** %e2, align 8 - %cmp = icmp eq i8* %v3, %v4 + call void @init(ptr %h) + call void @init(ptr %i) + %e = getelementptr inbounds %"struct.a::c", ptr %h, i64 0, i32 2 + %v3 = load ptr, ptr %e, align 8 + %e2 = getelementptr inbounds %"struct.a::c", ptr %i, i64 0, i32 2 + %v4 = load ptr, ptr %e2, align 8 + %cmp = icmp eq ptr %v3, %v4 br i1 %cmp, label %land.lhs.true, label %land.end land.lhs.true: ; preds = %entry - %d = getelementptr inbounds %"struct.a::c", %"struct.a::c"* %h, i64 0, i32 1 - %v5 = load i32*, i32** %d, align 8 - %d3 = getelementptr inbounds %"struct.a::c", %"struct.a::c"* %i, i64 0, i32 1 - %v6 = load i32*, i32** %d3, align 8 - %cmp4 = icmp eq i32* %v5, %v6 + %d = getelementptr inbounds %"struct.a::c", ptr %h, i64 0, i32 1 + %v5 = load ptr, ptr %d, align 8 + %d3 = getelementptr inbounds %"struct.a::c", ptr %i, i64 0, i32 1 + %v6 = load ptr, ptr %d3, align 8 + %cmp4 = icmp eq ptr %v5, %v6 br i1 %cmp4, label %land.rhs, label %land.end land.rhs: ; preds = %land.lhs.true - %j = getelementptr inbounds %"struct.a::c", %"struct.a::c"* %h, i64 0, i32 0 - %v7 = load i32, i32* %j, align 8 - %j5 = getelementptr inbounds %"struct.a::c", %"struct.a::c"* %i, i64 0, i32 0 - %v8 = load i32, i32* %j5, align 8 + %v7 = load i32, ptr %h, align 8 + %v8 = load i32, ptr %i, align 8 %cmp6 = icmp eq i32 %v7, %v8 br label %land.end @@ -67,4 +61,4 @@ land.end: ; preds = %land.rhs, %land.lhs ret i1 %v9 } -declare void @init(%"struct.a::c"*) +declare void @init(ptr) diff --git a/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll b/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll index f097aed0d8af6..bc6beefb2caee 100644 --- a/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll +++ b/llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll @@ -9,63 +9,57 @@ define zeroext i1 @opeq1( ; CHECK-LABEL: @opeq1( -; CHECK-NEXT: entry3: -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 3 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 2 -; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[TMP0]], align 4 -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 4 +; CHECK-NEXT: entry2: +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A:%.*]], i64 0, i32 3 +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], ptr [[B:%.*]], i64 0, i32 2 +; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP1]], align 4 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; CHECK-NEXT: br i1 [[TMP4]], label %"land.rhs.i+land.rhs.i.2", label [[OPEQ1_EXIT:%.*]] ; CHECK: "land.rhs.i+land.rhs.i.2": -; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 0 -; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 0 -; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP5]] to i8* -; CHECK-NEXT: [[CSTR2:%.*]] = bitcast i32* [[TMP6]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR2]], i64 8) -; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[MEMCMP]], 0 -; CHECK-NEXT: br i1 [[TMP7]], label [[LAND_RHS_I_31:%.*]], label [[OPEQ1_EXIT]] +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A]], ptr [[B]], i64 8) +; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[MEMCMP]], 0 +; CHECK-NEXT: br i1 [[TMP5]], label [[LAND_RHS_I_31:%.*]], label [[OPEQ1_EXIT]] ; CHECK: land.rhs.i.31: -; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 3 -; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 3 -; CHECK-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 4 -; CHECK-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 4 -; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i32 [[TMP10]], [[TMP11]] +; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 3 +; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 3 +; CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP6]], align 4 +; CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP7]], align 4 +; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i32 [[TMP8]], [[TMP9]] ; CHECK-NEXT: br label [[OPEQ1_EXIT]] ; CHECK: opeq1.exit: -; CHECK-NEXT: [[TMP13:%.*]] = phi i1 [ [[TMP12]], [[LAND_RHS_I_31]] ], [ false, %"land.rhs.i+land.rhs.i.2" ], [ false, [[ENTRY3:%.*]] ] -; CHECK-NEXT: ret i1 [[TMP13]] +; CHECK-NEXT: [[TMP11:%.*]] = phi i1 [ [[TMP10]], [[LAND_RHS_I_31]] ], [ false, %"land.rhs.i+land.rhs.i.2" ], [ false, [[ENTRY2:%.*]] ] +; CHECK-NEXT: ret i1 [[TMP11]] ; - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 2 - %1 = load i32, i32* %first1.i, align 4 + %first.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %0 = load i32, ptr %first.i, align 4 + %first1.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2 + %1 = load i32, ptr %first1.i, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %3 = load i32, i32* %second2.i, align 4 + %2 = load i32, ptr %a, align 4 + %3 = load i32, ptr %b, align 4 %cmp3.i = icmp eq i32 %2, %3 br i1 %cmp3.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %5 = load i32, ptr %third2.i, align 4 %cmp4.i = icmp eq i32 %4, %5 br i1 %cmp4.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp5.i = icmp eq i32 %6, %7 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll b/llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll index f40787ae22dc0..6f24d581f8d70 100644 --- a/llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll +++ b/llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll @@ -8,23 +8,18 @@ target triple = "x86_64" ; bb1 references a gep introduced in bb0. The gep must remain available after ; the merge. -define i1 @bug(%Triple* nonnull dereferenceable(16) %lhs, %Triple* nonnull dereferenceable(16) %rhs) nofree nosync { +define i1 @bug(ptr nonnull dereferenceable(16) %lhs, ptr nonnull dereferenceable(16) %rhs) nofree nosync { ; CHECK-LABEL: @bug( ; CHECK-NEXT: bb0: -; CHECK-NEXT: [[GEP:%.*]] = getelementptr [[TRIPLE:%.*]], %Triple* [[RHS:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[L0_ADDR:%.*]] = getelementptr inbounds [[TRIPLE]], %Triple* [[LHS:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[L0:%.*]] = load i32, i32* [[L0_ADDR]], align 4 -; CHECK-NEXT: [[R0_ADDR:%.*]] = getelementptr inbounds [[TRIPLE]], %Triple* [[RHS]], i64 0, i32 0 -; CHECK-NEXT: [[R0:%.*]] = load i32, i32* [[R0_ADDR]], align 4 -; CHECK-NEXT: store i32 1, i32* @g, align 4 +; CHECK-NEXT: [[L0:%.*]] = load i32, ptr [[LHS:%.*]], align 4 +; CHECK-NEXT: [[R0:%.*]] = load i32, ptr [[RHS:%.*]], align 4 +; CHECK-NEXT: store i32 1, ptr @g, align 4 ; CHECK-NEXT: [[CMP0:%.*]] = icmp eq i32 [[L0]], [[R0]] ; CHECK-NEXT: br i1 [[CMP0]], label %"bb1+bb2", label [[FINAL:%.*]] ; CHECK: "bb1+bb2": -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[TRIPLE]], %Triple* [[LHS]], i64 0, i32 2 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[GEP]], i64 2 -; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[TRIPLE:%.*]], ptr [[LHS]], i64 0, i32 2 +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr [[RHS]], i64 2 +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP0]], ptr [[TMP1]], i64 8) ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[FINAL]] ; CHECK: final: @@ -32,28 +27,25 @@ define i1 @bug(%Triple* nonnull dereferenceable(16) %lhs, %Triple* nonnull deref ; CHECK-NEXT: ret i1 [[RET]] ; bb0: - %gep = getelementptr %Triple, %Triple* %rhs, i64 0, i32 0 - %l0_addr = getelementptr inbounds %Triple, %Triple* %lhs, i64 0, i32 0 - %l0 = load i32, i32* %l0_addr, align 4 - %r0_addr = getelementptr inbounds %Triple, %Triple* %rhs, i64 0, i32 0 - %r0 = load i32, i32* %r0_addr, align 4 - store i32 1, i32* @g + %l0 = load i32, ptr %lhs, align 4 + %r0 = load i32, ptr %rhs, align 4 + store i32 1, ptr @g %cmp0 = icmp eq i32 %l0, %r0 br i1 %cmp0, label %bb1, label %final bb1: ; preds = %bb0 - %l1_addr = getelementptr inbounds %Triple, %Triple* %lhs, i64 0, i32 2 - %l1 = load i32, i32* %l1_addr, align 4 - %r1_addr = getelementptr inbounds i32, i32* %gep, i64 2 - %r1 = load i32, i32* %r1_addr, align 4 + %l1_addr = getelementptr inbounds %Triple, ptr %lhs, i64 0, i32 2 + %l1 = load i32, ptr %l1_addr, align 4 + %r1_addr = getelementptr inbounds i32, ptr %rhs, i64 2 + %r1 = load i32, ptr %r1_addr, align 4 %cmp1 = icmp eq i32 %l1, %r1 br i1 %cmp1, label %bb2, label %final bb2: ; preds = %bb1 - %l2_addr = getelementptr inbounds %Triple, %Triple* %lhs, i64 0, i32 3 - %l2 = load i32, i32* %l2_addr, align 4 - %r2_addr = getelementptr inbounds i32, i32* %gep, i64 3 - %r2 = load i32, i32* %r2_addr, align 4 + %l2_addr = getelementptr inbounds %Triple, ptr %lhs, i64 0, i32 3 + %l2 = load i32, ptr %l2_addr, align 4 + %r2_addr = getelementptr inbounds i32, ptr %rhs, i64 3 + %r2 = load i32, ptr %r2_addr, align 4 %cmp2 = icmp eq i32 %l2, %r2 br label %final diff --git a/llvm/test/Transforms/MergeICmps/X86/gep-used-outside.ll b/llvm/test/Transforms/MergeICmps/X86/gep-used-outside.ll index 62185c8b501b2..b46526029d979 100644 --- a/llvm/test/Transforms/MergeICmps/X86/gep-used-outside.ll +++ b/llvm/test/Transforms/MergeICmps/X86/gep-used-outside.ll @@ -9,47 +9,43 @@ define zeroext i32 @opeq1( ; CHECK-LABEL: @opeq1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 1 -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; CHECK-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 1 -; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; CHECK-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A:%.*]], i64 0, i32 1 +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[FIRST_I]], align 4 +; CHECK-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], ptr [[B:%.*]], i64 0, i32 1 +; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[FIRST1_I]], align 4 ; CHECK-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; CHECK-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; CHECK: land.rhs.i: -; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 0 -; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 0 -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[A]], align 4 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[B]], align 4 ; CHECK-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; CHECK-NEXT: br label [[OPEQ1_EXIT]] ; CHECK: opeq1.exit: ; CHECK-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] -; CHECK-NEXT: [[TMP5:%.*]] = load i32, i32* [[FIRST_I]], align 4 +; CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[FIRST_I]], align 4 ; CHECK-NEXT: [[TMP6:%.*]] = select i1 [[TMP4]], i32 [[TMP5]], i32 0 ; CHECK-NEXT: ret i32 [[TMP6]] ; - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %1 = load i32, i32* %first1.i, align 4 + %first.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %0 = load i32, ptr %first.i, align 4 + %first1.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %1 = load i32, ptr %first1.i, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %3 = load i32, i32* %second2.i, align 4 + %2 = load i32, ptr %a, align 4 + %3 = load i32, ptr %b, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit opeq1.exit: %4 = phi i1 [ false, %entry ], [ %cmp3.i, %land.rhs.i] - %5 = load i32, i32* %first.i, align 4 + %5 = load i32, ptr %first.i, align 4 %6 = select i1 %4, i32 %5, i32 0 ret i32 %6 } diff --git a/llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll b/llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll index 18909d6b3d7e0..179d6e6dcfdf5 100644 --- a/llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll +++ b/llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll @@ -3,37 +3,31 @@ ; 8-byte int and 8-byte pointer should merge into a 16-byte memcmp. -%struct.outer = type { i64, %struct.inner* } +%struct.outer = type { i64, ptr } %struct.inner = type { i32, i32, i32 } ; Function Attrs: nounwind uwtable -define i1 @test(%struct.outer* align 8 dereferenceable(16) %o1, %struct.outer* align 8 dereferenceable(116) %o2) local_unnamed_addr nofree nosync { +define i1 @test(ptr align 8 dereferenceable(16) %o1, ptr align 8 dereferenceable(116) %o2) local_unnamed_addr nofree nosync { ; CHECK-LABEL: @test( ; CHECK-NEXT: "entry+if.then": -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_OUTER:%.*]], %struct.outer* [[O1:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_OUTER]], %struct.outer* [[O2:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[CSTR:%.*]] = bitcast i64* [[TMP0]] to i8* -; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i64* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[O1:%.*]], ptr [[O2:%.*]], i64 16) ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[IF_END5:%.*]] ; CHECK: if.end5: ; CHECK-NEXT: ret i1 [[TMP2]] ; entry: - %p1 = getelementptr inbounds %struct.outer, %struct.outer* %o1, i64 0, i32 0 - %0 = load i64, i64* %p1, align 8 - %p11 = getelementptr inbounds %struct.outer, %struct.outer* %o2, i64 0, i32 0 - %1 = load i64, i64* %p11, align 8 + %0 = load i64, ptr %o1, align 8 + %1 = load i64, ptr %o2, align 8 %cmp = icmp eq i64 %0, %1 br i1 %cmp, label %if.then, label %if.end5 if.then: ; preds = %entry - %p2 = getelementptr inbounds %struct.outer, %struct.outer* %o1, i64 0, i32 1 - %2 = load %struct.inner*, %struct.inner** %p2, align 8 - %p22 = getelementptr inbounds %struct.outer, %struct.outer* %o2, i64 0, i32 1 - %3 = load %struct.inner*, %struct.inner** %p22, align 8 - %cmp3 = icmp eq %struct.inner* %2, %3 + %p2 = getelementptr inbounds %struct.outer, ptr %o1, i64 0, i32 1 + %2 = load ptr, ptr %p2, align 8 + %p22 = getelementptr inbounds %struct.outer, ptr %o2, i64 0, i32 1 + %3 = load ptr, ptr %p22, align 8 + %cmp3 = icmp eq ptr %2, %3 br label %if.end5 if.end5: ; preds = %if.then, %entry @@ -41,10 +35,10 @@ if.end5: ; preds = %if.then, %entry ret i1 %rez.0 } ; Function Attrs: argmemonly nounwind -declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 +declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1 ; Function Attrs: argmemonly nounwind -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 +declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1 attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { argmemonly nounwind } diff --git a/llvm/test/Transforms/MergeICmps/X86/last-block-produce-no-value.ll b/llvm/test/Transforms/MergeICmps/X86/last-block-produce-no-value.ll index d63ef306fd89b..70fa7c3be1fc1 100644 --- a/llvm/test/Transforms/MergeICmps/X86/last-block-produce-no-value.ll +++ b/llvm/test/Transforms/MergeICmps/X86/last-block-produce-no-value.ll @@ -11,17 +11,15 @@ define zeroext i1 @opeq1( ; CHECK-LABEL: @opeq1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; CHECK-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; CHECK-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; CHECK-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; CHECK: land.rhs.i: -; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 1 +; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 4 +; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; CHECK-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; CHECK-NEXT: br i1 [[CMP3_I]], label [[LAND_RHS_I_2:%.*]], label [[OPEQ1_EXIT]] ; CHECK: land.rhs.i.2: @@ -30,21 +28,19 @@ define zeroext i1 @opeq1( ; CHECK-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ false, [[LAND_RHS_I]] ], [ [[CMP3_I]], [[LAND_RHS_I_2]] ] ; CHECK-NEXT: ret i1 [[TMP4]] ; - %S* nocapture readonly dereferenceable(12) %a, - %S* nocapture readonly dereferenceable(12) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(12) %a, + ptr nocapture readonly dereferenceable(12) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp3.i = icmp eq i32 %2, %3 br i1 %cmp3.i, label %land.rhs.i.2, label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll b/llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll index 347209b7d8f4e..4a6e734c6a371 100644 --- a/llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll +++ b/llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll @@ -9,68 +9,62 @@ declare void @foo(...) define zeroext i1 @opeq1( ; X86-LABEL: @opeq1( ; X86-NEXT: entry: -; X86-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; X86-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; X86-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; X86-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; X86-NEXT: call void (...) @foo() ; X86-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; X86-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; X86: land.rhs.i: -; X86-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; X86-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; X86-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; X86-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; X86-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 1 +; X86-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 4 +; X86-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; X86-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; X86-NEXT: call void (...) @foo() ; X86-NEXT: [[CMP2_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; X86-NEXT: br i1 [[CMP2_I]], label %"land.rhs.i.2+land.rhs.i.3", label [[OPEQ1_EXIT]] ; X86: "land.rhs.i.2+land.rhs.i.3": -; X86-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 2 -; X86-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 2 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP4]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP5]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) +; X86-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 2 +; X86-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 2 +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP4]], ptr [[TMP5]], i64 8) ; X86-NEXT: [[TMP6:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT]] ; X86: opeq1.exit: ; X86-NEXT: [[TMP7:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ false, [[LAND_RHS_I]] ], [ [[TMP6]], %"land.rhs.i.2+land.rhs.i.3" ] ; X86-NEXT: ret i1 [[TMP7]] ; - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 ; Does other work. call void (...) @foo() %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 ; Does other work. call void (...) @foo() %cmp2.i = icmp eq i32 %2, %3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 2 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2 + %5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %4, %5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %6, %7 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll b/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll index 7038ae011bf5d..0cbc8dce5bd51 100644 --- a/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll +++ b/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll @@ -8,11 +8,11 @@ target triple = "x86_64-grtev4-linux-gnu" declare void @other_work() -define i1 @test(i8* dereferenceable(2) %arg, i8* dereferenceable(2) %arg1) { +define i1 @test(ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1) { ; CHECK-LABEL: @test( ; CHECK-NEXT: "if+entry": ; CHECK-NEXT: call void @other_work() -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[ARG:%.*]], i8* [[ARG1:%.*]], i64 2) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[ARG:%.*]], ptr [[ARG1:%.*]], i64 2) ; CHECK-NEXT: [[TMP0:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[JOIN:%.*]] ; CHECK: join: @@ -20,16 +20,16 @@ define i1 @test(i8* dereferenceable(2) %arg, i8* dereferenceable(2) %arg1) { ; entry: call void @other_work() - %arg.off = getelementptr inbounds i8, i8* %arg, i64 1 - %arg1.off = getelementptr inbounds i8, i8* %arg1, i64 1 - %arg.off.val = load i8, i8* %arg.off - %arg1.off.val = load i8, i8* %arg1.off + %arg.off = getelementptr inbounds i8, ptr %arg, i64 1 + %arg1.off = getelementptr inbounds i8, ptr %arg1, i64 1 + %arg.off.val = load i8, ptr %arg.off + %arg1.off.val = load i8, ptr %arg1.off %cmp.off = icmp eq i8 %arg.off.val, %arg1.off.val br i1 %cmp.off, label %if, label %join if: - %arg.val = load i8, i8* %arg - %arg1.val = load i8, i8* %arg1 + %arg.val = load i8, ptr %arg + %arg1.val = load i8, ptr %arg1 %cmp = icmp eq i8 %arg.val, %arg1.val br label %join diff --git a/llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll b/llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll index bd0dbda1f7e3b..1ec8b20a89da1 100644 --- a/llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll +++ b/llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll @@ -7,50 +7,42 @@ define zeroext i1 @opeq1( ; X86-LABEL: @opeq1( ; X86-NEXT: "entry+land.rhs.i": -; X86-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) -; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A:%.*]], ptr [[B:%.*]], i64 8) +; X86-NEXT: [[TMP0:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: -; X86-NEXT: ret i1 [[TMP2]] +; X86-NEXT: ret i1 [[TMP0]] ; ; X86-NOBUILTIN-LABEL: @opeq1( ; X86-NOBUILTIN-NEXT: entry: -; X86-NOBUILTIN-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NOBUILTIN-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; X86-NOBUILTIN-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NOBUILTIN-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; X86-NOBUILTIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; X86-NOBUILTIN-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; X86-NOBUILTIN-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; X86-NOBUILTIN-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; X86-NOBUILTIN: land.rhs.i: -; X86-NOBUILTIN-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; X86-NOBUILTIN-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; X86-NOBUILTIN-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; X86-NOBUILTIN-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; X86-NOBUILTIN-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 1 +; X86-NOBUILTIN-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 4 +; X86-NOBUILTIN-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; X86-NOBUILTIN-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; X86-NOBUILTIN-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; X86-NOBUILTIN-NEXT: br label [[OPEQ1_EXIT]] ; X86-NOBUILTIN: opeq1.exit: ; X86-NOBUILTIN-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; X86-NOBUILTIN-NEXT: ret i1 [[TMP4]] ; - %S* nocapture readonly dereferenceable(8) %a, - %S* nocapture readonly dereferenceable(8) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr nofree nosync { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit @@ -67,50 +59,42 @@ opeq1.exit: define zeroext i1 @opeq1_inverse( ; X86-LABEL: @opeq1_inverse( ; X86-NEXT: "land.rhs.i+entry": -; X86-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) -; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A:%.*]], ptr [[B:%.*]], i64 8) +; X86-NEXT: [[TMP0:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: -; X86-NEXT: ret i1 [[TMP2]] +; X86-NEXT: ret i1 [[TMP0]] ; ; X86-NOBUILTIN-LABEL: @opeq1_inverse( ; X86-NOBUILTIN-NEXT: entry: -; X86-NOBUILTIN-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 1 -; X86-NOBUILTIN-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; X86-NOBUILTIN-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 1 -; X86-NOBUILTIN-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; X86-NOBUILTIN-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A:%.*]], i64 0, i32 1 +; X86-NOBUILTIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[FIRST_I]], align 4 +; X86-NOBUILTIN-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], ptr [[B:%.*]], i64 0, i32 1 +; X86-NOBUILTIN-NEXT: [[TMP1:%.*]] = load i32, ptr [[FIRST1_I]], align 4 ; X86-NOBUILTIN-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; X86-NOBUILTIN-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; X86-NOBUILTIN: land.rhs.i: -; X86-NOBUILTIN-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 0 -; X86-NOBUILTIN-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; X86-NOBUILTIN-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 0 -; X86-NOBUILTIN-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; X86-NOBUILTIN-NEXT: [[TMP2:%.*]] = load i32, ptr [[A]], align 4 +; X86-NOBUILTIN-NEXT: [[TMP3:%.*]] = load i32, ptr [[B]], align 4 ; X86-NOBUILTIN-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; X86-NOBUILTIN-NEXT: br label [[OPEQ1_EXIT]] ; X86-NOBUILTIN: opeq1.exit: ; X86-NOBUILTIN-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; X86-NOBUILTIN-NEXT: ret i1 [[TMP4]] ; - %S* nocapture readonly dereferenceable(8) %a, - %S* nocapture readonly dereferenceable(8) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr nofree nosync { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %1 = load i32, i32* %first1.i, align 4 + %first.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %0 = load i32, ptr %first.i, align 4 + %first1.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %1 = load i32, ptr %first1.i, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %3 = load i32, i32* %second2.i, align 4 + %2 = load i32, ptr %a, align 4 + %3 = load i32, ptr %b, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/pr36557.ll b/llvm/test/Transforms/MergeICmps/X86/pr36557.ll index 965220474bf29..d31fb97c7664b 100644 --- a/llvm/test/Transforms/MergeICmps/X86/pr36557.ll +++ b/llvm/test/Transforms/MergeICmps/X86/pr36557.ll @@ -15,66 +15,59 @@ $_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i = comdat any @.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 ; Function Attrs: uwtable -define linkonce_odr dso_local zeroext i1 @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i(%class.D* %this, %class.B* dereferenceable(8) %p1, %class.B* dereferenceable(8) %p2, i8*, i8*, i8*, i32) local_unnamed_addr #0 comdat align 2 { +define linkonce_odr dso_local zeroext i1 @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i(ptr %this, ptr dereferenceable(8) %p1, ptr dereferenceable(8) %p2, ptr, ptr, ptr, i32) local_unnamed_addr #0 comdat align 2 { ; X86-LABEL: @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i( ; X86-NEXT: entry: ; X86-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_C:%.*]], align 1 -; X86-NEXT: [[C_I:%.*]] = getelementptr inbounds [[CLASS_B:%.*]], %class.B* [[P2:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP4:%.*]] = load i32, i32* [[C_I]], align 4 -; X86-NEXT: [[C2_I:%.*]] = getelementptr inbounds [[CLASS_B]], %class.B* [[P1:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP5:%.*]] = load i32, i32* [[C2_I]], align 4 +; X86-NEXT: [[TMP4:%.*]] = load i32, ptr [[P2:%.*]], align 4 +; X86-NEXT: [[TMP5:%.*]] = load i32, ptr [[P1:%.*]], align 4 ; X86-NEXT: [[CMP_ENTRY:%.*]] = icmp eq i32 [[TMP4]], [[TMP5]] ; X86-NEXT: br i1 [[CMP_ENTRY]], label [[BB1:%.*]], label [[BB2:%.*]] ; X86: bb1: -; X86-NEXT: [[M_I:%.*]] = getelementptr inbounds [[CLASS_B]], %class.B* [[P2]], i64 0, i32 1 -; X86-NEXT: [[TMP6:%.*]] = load i32, i32* [[M_I]], align 4 -; X86-NEXT: [[M3_I:%.*]] = getelementptr inbounds [[CLASS_B]], %class.B* [[P1]], i64 0, i32 1 -; X86-NEXT: [[TMP7:%.*]] = load i32, i32* [[M3_I]], align 4 +; X86-NEXT: [[M_I:%.*]] = getelementptr inbounds [[CLASS_B:%.*]], ptr [[P2]], i64 0, i32 1 +; X86-NEXT: [[TMP6:%.*]] = load i32, ptr [[M_I]], align 4 +; X86-NEXT: [[M3_I:%.*]] = getelementptr inbounds [[CLASS_B]], ptr [[P1]], i64 0, i32 1 +; X86-NEXT: [[TMP7:%.*]] = load i32, ptr [[M3_I]], align 4 ; X86-NEXT: [[CMP1:%.*]] = icmp eq i32 [[TMP6]], [[TMP7]] ; X86-NEXT: br label [[BB2]] ; X86: bb2: ; X86-NEXT: [[TMP8:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP1]], [[BB1]] ] -; X86-NEXT: [[FAILUREREPORTINGMODE:%.*]] = getelementptr inbounds [[CLASS_D:%.*]], %class.D* [[THIS:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP9:%.*]] = load i32, i32* [[FAILUREREPORTINGMODE]], align 4 +; X86-NEXT: [[TMP9:%.*]] = load i32, ptr [[THIS:%.*]], align 4 ; X86-NEXT: [[COND:%.*]] = icmp eq i32 [[TMP9]], 0 ; X86-NEXT: br i1 [[COND]], label [[BB3:%.*]], label [[SW_EPILOG:%.*]] ; X86: bb3: ; X86-NEXT: br i1 [[CMP_ENTRY]], label [[BB4:%.*]], label [[BB5:%.*]] ; X86: bb4: -; X86-NEXT: [[M_I_I:%.*]] = getelementptr inbounds [[CLASS_B]], %class.B* [[P2]], i64 0, i32 1 -; X86-NEXT: [[TMP10:%.*]] = load i32, i32* [[M_I_I]], align 4 -; X86-NEXT: [[M3_I_I:%.*]] = getelementptr inbounds [[CLASS_B]], %class.B* [[P1]], i64 0, i32 1 -; X86-NEXT: [[TMP11:%.*]] = load i32, i32* [[M3_I_I]], align 4 +; X86-NEXT: [[M_I_I:%.*]] = getelementptr inbounds [[CLASS_B]], ptr [[P2]], i64 0, i32 1 +; X86-NEXT: [[TMP10:%.*]] = load i32, ptr [[M_I_I]], align 4 +; X86-NEXT: [[M3_I_I:%.*]] = getelementptr inbounds [[CLASS_B]], ptr [[P1]], i64 0, i32 1 +; X86-NEXT: [[TMP11:%.*]] = load i32, ptr [[M3_I_I]], align 4 ; X86-NEXT: [[CMP4:%.*]] = icmp eq i32 [[TMP10]], [[TMP11]] ; X86-NEXT: br label [[BB5]] ; X86: bb5: ; X86-NEXT: [[TMP12:%.*]] = phi i1 [ false, [[BB3]] ], [ [[CMP4]], [[BB4]] ] -; X86-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[CLASS_C]], %class.C* [[REF_TMP]], i64 0, i32 0 ; X86-NEXT: br label [[SW_EPILOG]] ; X86: sw.epilog: ; X86-NEXT: ret i1 [[TMP8]] ; entry: %ref.tmp = alloca %class.C, align 1 - %c.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 0 - %4 = load i32, i32* %c.i, align 4 - %c2.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 0 - %5 = load i32, i32* %c2.i, align 4 + %4 = load i32, ptr %p2, align 4 + %5 = load i32, ptr %p1, align 4 %cmp_entry = icmp eq i32 %4, %5 br i1 %cmp_entry, label %bb1, label %bb2 bb1: ; preds = %entry - %m.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 1 - %6 = load i32, i32* %m.i, align 4 - %m3.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 1 - %7 = load i32, i32* %m3.i, align 4 + %m.i = getelementptr inbounds %class.B, ptr %p2, i64 0, i32 1 + %6 = load i32, ptr %m.i, align 4 + %m3.i = getelementptr inbounds %class.B, ptr %p1, i64 0, i32 1 + %7 = load i32, ptr %m3.i, align 4 %cmp1 = icmp eq i32 %6, %7 br label %bb2 bb2: ; preds = %entry, %bb1 %8 = phi i1 [ false, %entry ], [ %cmp1, %bb1 ] - %failureReportingMode = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 0 - %9 = load i32, i32* %failureReportingMode, align 4 + %9 = load i32, ptr %this, align 4 %cond = icmp eq i32 %9, 0 br i1 %cond, label %bb3, label %sw.epilog @@ -82,16 +75,15 @@ bb3: ; preds = %bb2 br i1 %cmp_entry, label %bb4, label %bb5 bb4: ; preds = %bb3 - %m.i.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 1 - %10 = load i32, i32* %m.i.i, align 4 - %m3.i.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 1 - %11 = load i32, i32* %m3.i.i, align 4 + %m.i.i = getelementptr inbounds %class.B, ptr %p2, i64 0, i32 1 + %10 = load i32, ptr %m.i.i, align 4 + %m3.i.i = getelementptr inbounds %class.B, ptr %p1, i64 0, i32 1 + %11 = load i32, ptr %m3.i.i, align 4 %cmp4 = icmp eq i32 %10, %11 br label %bb5 bb5: ; preds = %bb3, %bb4 %12 = phi i1 [ false, %bb3 ], [ %cmp4, %bb4 ] - %13 = getelementptr inbounds %class.C, %class.C* %ref.tmp, i64 0, i32 0 br label %sw.epilog sw.epilog: ; preds = %bb2 diff --git a/llvm/test/Transforms/MergeICmps/X86/pr41917.ll b/llvm/test/Transforms/MergeICmps/X86/pr41917.ll index a6a8e8d6f0533..d4fd34afc1452 100644 --- a/llvm/test/Transforms/MergeICmps/X86/pr41917.ll +++ b/llvm/test/Transforms/MergeICmps/X86/pr41917.ll @@ -7,7 +7,7 @@ target triple = "i386-pc-windows-msvc19.11.0" %class.a = type { i32, i32, i32, i32, i32 } ; Function Attrs: nounwind optsize -define dso_local zeroext i1 @pr41917(%class.a* byval(%class.a) nocapture readonly align 4 %g, %class.a* byval(%class.a) nocapture readonly align 4 %p2) local_unnamed_addr #0 { +define dso_local zeroext i1 @pr41917(ptr byval(%class.a) nocapture readonly align 4 %g, ptr byval(%class.a) nocapture readonly align 4 %p2) local_unnamed_addr #0 { ; CHECK-LABEL: @pr41917( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CALL:%.*]] = tail call zeroext i1 @f2() #[[ATTR3:[0-9]+]] @@ -16,11 +16,9 @@ define dso_local zeroext i1 @pr41917(%class.a* byval(%class.a) nocapture readonl ; CHECK-NEXT: [[CALL1:%.*]] = tail call zeroext i1 @f2() #[[ATTR3]] ; CHECK-NEXT: br label %"land.end+land.rhs3" ; CHECK: "land.end+land.rhs3": -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_A:%.*]], %class.a* [[G:%.*]], i32 0, i32 1 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[CLASS_A]], %class.a* [[P2:%.*]], i32 0, i32 1 -; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i32 8) +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_A:%.*]], ptr [[G:%.*]], i32 0, i32 1 +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[CLASS_A]], ptr [[P2:%.*]], i32 0, i32 1 +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP0]], ptr [[TMP1]], i32 8) ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[LAND_END6:%.*]] ; CHECK: land.end6: @@ -35,18 +33,18 @@ land.rhs: ; preds = %entry br label %land.end land.end: ; preds = %land.rhs, %entry - %c = getelementptr inbounds %class.a, %class.a* %g, i32 0, i32 1 - %0 = load i32, i32* %c, align 4, !tbaa !3 - %c2 = getelementptr inbounds %class.a, %class.a* %p2, i32 0, i32 1 - %1 = load i32, i32* %c2, align 4, !tbaa !3 + %c = getelementptr inbounds %class.a, ptr %g, i32 0, i32 1 + %0 = load i32, ptr %c, align 4, !tbaa !3 + %c2 = getelementptr inbounds %class.a, ptr %p2, i32 0, i32 1 + %1 = load i32, ptr %c2, align 4, !tbaa !3 %cmp = icmp eq i32 %0, %1 br i1 %cmp, label %land.rhs3, label %land.end6 land.rhs3: ; preds = %land.end - %h = getelementptr inbounds %class.a, %class.a* %g, i32 0, i32 2 - %2 = load i32, i32* %h, align 4, !tbaa !8 - %h4 = getelementptr inbounds %class.a, %class.a* %p2, i32 0, i32 2 - %3 = load i32, i32* %h4, align 4, !tbaa !8 + %h = getelementptr inbounds %class.a, ptr %g, i32 0, i32 2 + %2 = load i32, ptr %h, align 4, !tbaa !8 + %h4 = getelementptr inbounds %class.a, ptr %p2, i32 0, i32 2 + %3 = load i32, ptr %h4, align 4, !tbaa !8 %cmp5 = icmp eq i32 %2, %3 br label %land.end6 diff --git a/llvm/test/Transforms/MergeICmps/X86/pr53959.ll b/llvm/test/Transforms/MergeICmps/X86/pr53959.ll index 1721d530445f5..23fe181be04d7 100644 --- a/llvm/test/Transforms/MergeICmps/X86/pr53959.ll +++ b/llvm/test/Transforms/MergeICmps/X86/pr53959.ll @@ -9,14 +9,12 @@ define i1 @d() { ; CHECK-LABEL: @d( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[G:%.*]] = alloca [8 x i64], align 16 -; CHECK-NEXT: [[IDX1:%.*]] = getelementptr inbounds [8 x i64], [8 x i64]* [[G]], i64 0, i64 0 -; CHECK-NEXT: [[V1:%.*]] = load i64, i64* [[IDX1]], align 8 -; CHECK-NEXT: [[IDX2:%.*]] = getelementptr inbounds [8 x i64], [8 x i64]* [[G]], i64 0, i64 0 -; CHECK-NEXT: [[V2:%.*]] = load i64, i64* [[IDX2]], align 8 +; CHECK-NEXT: [[V1:%.*]] = load i64, ptr [[G]], align 8 +; CHECK-NEXT: [[V2:%.*]] = load i64, ptr [[G]], align 8 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[V1]], [[V2]] ; CHECK-NEXT: br label [[SPLIT:%.*]] ; CHECK: split: -; CHECK-NEXT: [[X:%.*]] = load volatile i32, i32* @c, align 4 +; CHECK-NEXT: [[X:%.*]] = load volatile i32, ptr @c, align 4 ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[EXIT:%.*]] ; CHECK: if: ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0 @@ -27,15 +25,13 @@ define i1 @d() { ; entry: %g = alloca [8 x i64], align 16 - %idx1 = getelementptr inbounds [8 x i64], [8 x i64]* %g, i64 0, i64 0 - %v1 = load i64, i64* %idx1, align 8 - %idx2 = getelementptr inbounds [8 x i64], [8 x i64]* %g, i64 0, i64 0 - %v2 = load i64, i64* %idx2, align 8 + %v1 = load i64, ptr %g, align 8 + %v2 = load i64, ptr %g, align 8 %cmp = icmp eq i64 %v1, %v2 br label %split split: - %x = load volatile i32, i32* @c, align 4 + %x = load volatile i32, ptr @c, align 4 br i1 %cmp, label %if, label %exit if: diff --git a/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll b/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll index d317cbe3ba38b..c53d86d76ff3b 100644 --- a/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll +++ b/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll @@ -10,50 +10,44 @@ define zeroext i1 @opeq1( ; X86-LABEL: @opeq1( ; X86-NEXT: "entry+land.rhs.i+land.rhs.i.2+land.rhs.i.3": ; X86-NEXT: call void (...) @foo() #[[ATTR2:[0-9]+]] -; X86-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A:%.*]], ptr [[B:%.*]], i64 16) ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: ; X86-NEXT: ret i1 [[TMP2]] ; ; Make sure this call is moved to the beginning of the entry block. - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 ; Does other work. call void (...) @foo() inaccessiblememonly %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %2, %3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 2 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2 + %5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %4, %5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %6, %7 br label %opeq1.exit @@ -67,32 +61,31 @@ opeq1.exit: define zeroext i1 @opeq1_discontiguous( ; X86-LABEL: @opeq1_discontiguous( ; X86-NEXT: entry: -; X86-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 1 -; X86-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; X86-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; X86-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A:%.*]], i64 0, i32 1 +; X86-NEXT: [[TMP0:%.*]] = load i32, ptr [[FIRST_I]], align 4 +; X86-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; X86-NEXT: call void (...) @foo() #[[ATTR2]] ; X86-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; X86-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; X86: land.rhs.i: -; X86-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 2 -; X86-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; X86-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; X86-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; X86-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 2 +; X86-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 4 +; X86-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; X86-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; X86-NEXT: [[CMP2_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; X86-NEXT: br i1 [[CMP2_I]], label [[LAND_RHS_I_2:%.*]], label [[OPEQ1_EXIT]] ; X86: land.rhs.i.2: -; X86-NEXT: [[THIRD_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 2 -; X86-NEXT: [[TMP4:%.*]] = load i32, i32* [[THIRD_I]], align 4 -; X86-NEXT: [[THIRD2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 3 -; X86-NEXT: [[TMP5:%.*]] = load i32, i32* [[THIRD2_I]], align 4 +; X86-NEXT: [[THIRD_I:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 2 +; X86-NEXT: [[TMP4:%.*]] = load i32, ptr [[THIRD_I]], align 4 +; X86-NEXT: [[THIRD2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 3 +; X86-NEXT: [[TMP5:%.*]] = load i32, ptr [[THIRD2_I]], align 4 ; X86-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP4]], [[TMP5]] ; X86-NEXT: br i1 [[CMP3_I]], label [[LAND_RHS_I_3:%.*]], label [[OPEQ1_EXIT]] ; X86: land.rhs.i.3: -; X86-NEXT: [[FOURTH_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; X86-NEXT: [[TMP6:%.*]] = load i32, i32* [[FOURTH_I]], align 4 -; X86-NEXT: [[FOURTH2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 3 -; X86-NEXT: [[TMP7:%.*]] = load i32, i32* [[FOURTH2_I]], align 4 +; X86-NEXT: [[FOURTH_I:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 1 +; X86-NEXT: [[TMP6:%.*]] = load i32, ptr [[FOURTH_I]], align 4 +; X86-NEXT: [[FOURTH2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 3 +; X86-NEXT: [[TMP7:%.*]] = load i32, ptr [[FOURTH2_I]], align 4 ; X86-NEXT: [[CMP4_I:%.*]] = icmp eq i32 [[TMP6]], [[TMP7]] ; X86-NEXT: br label [[OPEQ1_EXIT]] ; X86: opeq1.exit: @@ -100,39 +93,38 @@ define zeroext i1 @opeq1_discontiguous( ; X86-NEXT: ret i1 [[TMP8]] ; ; Make sure this call is moved in the entry block. - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %first.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %0 = load i32, ptr %first.i, align 4 + %1 = load i32, ptr %b, align 4 ; Does other work. call void (...) @foo() inaccessiblememonly %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %2, %3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %4, %5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %6, %7 br label %opeq1.exit @@ -146,49 +138,43 @@ define zeroext i1 @opeq1_call_before_loads( ; X86-LABEL: @opeq1_call_before_loads( ; X86-NEXT: "entry+land.rhs.i+land.rhs.i.2+land.rhs.i.3": ; X86-NEXT: call void (...) @foo() -; X86-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A:%.*]], ptr [[B:%.*]], i64 16) ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: ; X86-NEXT: ret i1 [[TMP2]] ; ; Make sure this call is moved to the beginning of the entry block. - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { entry: call void (...) @foo() - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %2, %3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 2 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2 + %5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %4, %5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %6, %7 br label %opeq1.exit @@ -201,19 +187,15 @@ opeq1.exit: define zeroext i1 @opeq1_call_after_loads( ; X86-LABEL: @opeq1_call_after_loads( ; X86-NEXT: entry: -; X86-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; X86-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; X86-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; X86-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; X86-NEXT: call void (...) @foo() ; X86-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; X86-NEXT: br i1 [[CMP_I]], label %"land.rhs.i+land.rhs.i.2+land.rhs.i.3", label [[OPEQ1_EXIT:%.*]] ; X86: "land.rhs.i+land.rhs.i.2+land.rhs.i.3": -; X86-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; X86-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP2]] to i8* -; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP3]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 12) +; X86-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 1 +; X86-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP2]], ptr [[TMP3]], i64 12) ; X86-NEXT: [[TMP4:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT]] ; X86: opeq1.exit: @@ -221,38 +203,36 @@ define zeroext i1 @opeq1_call_after_loads( ; X86-NEXT: ret i1 [[TMP5]] ; ; Make sure this call is moved to the beginning of the entry block. - %S* nocapture readonly dereferenceable(16) %a, - %S* nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { + ptr nocapture readonly dereferenceable(16) %a, + ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 call void (...) @foo() %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %2, %3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: - %third.i = getelementptr inbounds %S, %S* %a, i64 0, i32 2 - %4 = load i32, i32* %third.i, align 4 - %third2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 2 - %5 = load i32, i32* %third2.i, align 4 + %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2 + %4 = load i32, ptr %third.i, align 4 + %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2 + %5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %4, %5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: - %fourth.i = getelementptr inbounds %S, %S* %a, i64 0, i32 3 - %6 = load i32, i32* %fourth.i, align 4 - %fourth2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 3 - %7 = load i32, i32* %fourth2.i, align 4 + %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3 + %6 = load i32, ptr %fourth.i, align 4 + %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3 + %7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %6, %7 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/tuple-four-int8.ll b/llvm/test/Transforms/MergeICmps/X86/tuple-four-int8.ll index a245e01551999..32a38ee16c945 100644 --- a/llvm/test/Transforms/MergeICmps/X86/tuple-four-int8.ll +++ b/llvm/test/Transforms/MergeICmps/X86/tuple-four-int8.ll @@ -24,53 +24,49 @@ define zeroext i1 @opeq( ; These 2 instructions are split. Then we can merge 3 bytes, instead of 2. ; CHECK: br label [[LAND_ELEM0:%.*]] ; CHECK: land.elem1: -; CHECK-NEXT: [[A_ELEM1_ADDR:%.*]] = getelementptr inbounds i8, i8* %a.base, i64 1 -; CHECK-NEXT: [[B_ELEM1_ADDR:%.*]] = getelementptr inbounds i8, i8* %b.base, i64 1 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[A_ELEM1_ADDR]], i8* [[B_ELEM1_ADDR]], i64 3) +; CHECK-NEXT: [[A_ELEM1_ADDR:%.*]] = getelementptr inbounds i8, ptr %a.base, i64 1 +; CHECK-NEXT: [[B_ELEM1_ADDR:%.*]] = getelementptr inbounds i8, ptr %b.base, i64 1 +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A_ELEM1_ADDR]], ptr [[B_ELEM1_ADDR]], i64 3) ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[OPEQ_EXIT:%.*]] ; CHECK: land.elem0: -; CHECK: [[A_BASE:%.*]] = getelementptr inbounds %"class.std::tuple", %"class.std::tuple"* [[A:%.*]], i64 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 -; CHECK: [[B_BASE:%.*]] = getelementptr inbounds %"class.std::tuple", %"class.std::tuple"* [[B:%.*]], i64 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 -; CHECK-NEXT: [[TMP3:%.*]] = load i8, i8* [[A_BASE]], align 1 -; CHECK-NEXT: [[TMP4:%.*]] = load i8, i8* [[B_BASE]], align 1 +; CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr [[A:%.*]], align 1 +; CHECK-NEXT: [[TMP4:%.*]] = load i8, ptr [[B:%.*]], align 1 ; CHECK-NEXT: [[CMP_ELEM0:%.*]] = icmp eq i8 [[TMP3]], [[TMP4]] ; CHECK-NEXT: br i1 [[CMP_ELEM0]], label [[LAND_ELEM1:%.*]], label [[OPEQ_EXIT]] ; CHECK: opeq.exit: ; CHECK-NEXT: [[TMP5:%.*]] = phi i1 [ [[CMP_ELEM0]], [[LAND_ELEM0]] ], [ [[TMP2]], [[LAND_ELEM1]] ] ; CHECK-NEXT: ret i1 [[TMP5]] ; - %"class.std::tuple"* nocapture readonly dereferenceable(4) %a, - %"class.std::tuple"* nocapture readonly dereferenceable(4) %b) local_unnamed_addr #1 { + ptr nocapture readonly dereferenceable(4) %a, + ptr nocapture readonly dereferenceable(4) %b) local_unnamed_addr #1 { entry: - %a.base = getelementptr inbounds %"class.std::tuple", %"class.std::tuple"* %a, i64 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 - %a.elem3.addr = getelementptr inbounds i8, i8* %a.base, i64 3 - %0 = load i8, i8* %a.elem3.addr, align 1 - %b.base = getelementptr inbounds %"class.std::tuple", %"class.std::tuple"* %b, i64 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 - %b.elem3.addr = getelementptr inbounds i8, i8* %b.base, i64 3 - %1 = load i8, i8* %b.elem3.addr, align 1 + %a.elem3.addr = getelementptr inbounds i8, ptr %a, i64 3 + %0 = load i8, ptr %a.elem3.addr, align 1 + %b.elem3.addr = getelementptr inbounds i8, ptr %b, i64 3 + %1 = load i8, ptr %b.elem3.addr, align 1 %cmp.elem3 = icmp eq i8 %0, %1 br i1 %cmp.elem3, label %land.elem2, label %opeq.exit land.elem2: - %a.elem2.addr = getelementptr inbounds i8, i8* %a.base, i64 2 - %2 = load i8, i8* %a.elem2.addr, align 1 - %b.elem2.addr = getelementptr inbounds i8, i8* %b.base, i64 2 - %3 = load i8, i8* %b.elem2.addr, align 1 + %a.elem2.addr = getelementptr inbounds i8, ptr %a, i64 2 + %2 = load i8, ptr %a.elem2.addr, align 1 + %b.elem2.addr = getelementptr inbounds i8, ptr %b, i64 2 + %3 = load i8, ptr %b.elem2.addr, align 1 %cmp.elem2 = icmp eq i8 %2, %3 br i1 %cmp.elem2, label %land.elem1, label %opeq.exit land.elem1: - %a.elem1.addr = getelementptr inbounds i8, i8* %a.base, i64 1 - %4 = load i8, i8* %a.elem1.addr, align 1 - %b.elem1.addr = getelementptr inbounds i8, i8* %b.base, i64 1 - %5 = load i8, i8* %b.elem1.addr, align 1 + %a.elem1.addr = getelementptr inbounds i8, ptr %a, i64 1 + %4 = load i8, ptr %a.elem1.addr, align 1 + %b.elem1.addr = getelementptr inbounds i8, ptr %b, i64 1 + %5 = load i8, ptr %b.elem1.addr, align 1 %cmp.elem1 = icmp eq i8 %4, %5 br i1 %cmp.elem1, label %land.elem0, label %opeq.exit land.elem0: - %6 = load i8, i8* %a.base, align 1 - %7 = load i8, i8* %b.base, align 1 + %6 = load i8, ptr %a, align 1 + %7 = load i8, ptr %b, align 1 %cmp.elem0 = icmp eq i8 %6, %7 br label %opeq.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/two-complex-bb.ll b/llvm/test/Transforms/MergeICmps/X86/two-complex-bb.ll index be113601ef376..c9b3ccc890e33 100644 --- a/llvm/test/Transforms/MergeICmps/X86/two-complex-bb.ll +++ b/llvm/test/Transforms/MergeICmps/X86/two-complex-bb.ll @@ -7,18 +7,16 @@ define zeroext i1 @twocomplexblocks( ; X86-LABEL: @twocomplexblocks( ; X86-NEXT: entry: -; X86-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; X86-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; X86-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; X86-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; X86-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; X86-NEXT: [[EXTRAWORK:%.*]] = add i32 [[TMP0]], [[TMP1]] ; X86-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; X86-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; X86: land.rhs.i: -; X86-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; X86-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; X86-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; X86-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; X86-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 1 +; X86-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 4 +; X86-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; X86-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; X86-NEXT: [[EXTRAWORK2:%.*]] = add i32 [[TMP2]], [[TMP3]] ; X86-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; X86-NEXT: br label [[OPEQ1_EXIT]] @@ -26,24 +24,22 @@ define zeroext i1 @twocomplexblocks( ; X86-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; X86-NEXT: ret i1 [[TMP4]] ; - %S* nocapture readonly dereferenceable(8) %a, - %S* nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { entry: ; This is a complex BCE Basic Block. - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %extrawork = add i32 %0, %1 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: ; This is a complex BCE Basic Block. - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %extrawork2 = add i32 %2, %3 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/X86/volatile.ll b/llvm/test/Transforms/MergeICmps/X86/volatile.ll index f6084c49e771b..08d7b05e710f1 100644 --- a/llvm/test/Transforms/MergeICmps/X86/volatile.ll +++ b/llvm/test/Transforms/MergeICmps/X86/volatile.ll @@ -6,38 +6,34 @@ define zeroext i1 @opeq( ; CHECK-LABEL: @opeq( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; CHECK-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 -; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; CHECK-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; CHECK-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; CHECK: land.rhs.i: -; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1 -; CHECK-NEXT: [[TMP2:%.*]] = load volatile i32, i32* [[SECOND_I]], align 4 -; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1 -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 1 +; CHECK-NEXT: [[TMP2:%.*]] = load volatile i32, ptr [[SECOND_I]], align 4 +; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 1 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; CHECK-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; CHECK-NEXT: br label [[OPEQ1_EXIT]] ; CHECK: opeq1.exit: ; CHECK-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; CHECK-NEXT: ret i1 [[TMP4]] ; - %S* nocapture readonly dereferenceable(8) %a, - %S* nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1 - %2 = load volatile i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1 + %2 = load volatile i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit diff --git a/llvm/test/Transforms/MergeICmps/pair-int32-int32.ll b/llvm/test/Transforms/MergeICmps/pair-int32-int32.ll index 38caaba860a4f..a8069fb52020b 100644 --- a/llvm/test/Transforms/MergeICmps/pair-int32-int32.ll +++ b/llvm/test/Transforms/MergeICmps/pair-int32-int32.ll @@ -6,38 +6,34 @@ define zeroext i1 @opeq1( ; NOEXPANSION-LABEL: @opeq1( ; NOEXPANSION-NEXT: entry: -; NOEXPANSION-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[A:%.*]], i64 0, i32 0 -; NOEXPANSION-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; NOEXPANSION-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[B:%.*]], i64 0, i32 0 -; NOEXPANSION-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; NOEXPANSION-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4 +; NOEXPANSION-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 4 ; NOEXPANSION-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; NOEXPANSION-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; NOEXPANSION: land.rhs.i: -; NOEXPANSION-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[A]], i64 0, i32 1 -; NOEXPANSION-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; NOEXPANSION-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[B]], i64 0, i32 1 -; NOEXPANSION-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; NOEXPANSION-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds %"struct.std::pair", ptr [[A]], i64 0, i32 1 +; NOEXPANSION-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 4 +; NOEXPANSION-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds %"struct.std::pair", ptr [[B]], i64 0, i32 1 +; NOEXPANSION-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 4 ; NOEXPANSION-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; NOEXPANSION-NEXT: br label [[OPEQ1_EXIT]] ; NOEXPANSION: opeq1.exit: ; NOEXPANSION-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; NOEXPANSION-NEXT: ret i1 [[TMP4]] ; - %"struct.std::pair"* nocapture readonly dereferenceable(8) %a, - %"struct.std::pair"* nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %a, i64 0, i32 0 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %b, i64 0, i32 0 - %1 = load i32, i32* %first1.i, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %a, i64 0, i32 1 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %b, i64 0, i32 1 - %3 = load i32, i32* %second2.i, align 4 + %second.i = getelementptr inbounds %"struct.std::pair", ptr %a, i64 0, i32 1 + %2 = load i32, ptr %second.i, align 4 + %second2.i = getelementptr inbounds %"struct.std::pair", ptr %b, i64 0, i32 1 + %3 = load i32, ptr %second2.i, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit @@ -50,38 +46,34 @@ opeq1.exit: define zeroext i1 @opeq1_inverse( ; NOEXPANSION-LABEL: @opeq1_inverse( ; NOEXPANSION-NEXT: entry: -; NOEXPANSION-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[A:%.*]], i64 0, i32 1 -; NOEXPANSION-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4 -; NOEXPANSION-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[B:%.*]], i64 0, i32 1 -; NOEXPANSION-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4 +; NOEXPANSION-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds %"struct.std::pair", ptr [[A:%.*]], i64 0, i32 1 +; NOEXPANSION-NEXT: [[TMP0:%.*]] = load i32, ptr [[FIRST_I]], align 4 +; NOEXPANSION-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds %"struct.std::pair", ptr [[B:%.*]], i64 0, i32 1 +; NOEXPANSION-NEXT: [[TMP1:%.*]] = load i32, ptr [[FIRST1_I]], align 4 ; NOEXPANSION-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] ; NOEXPANSION-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]] ; NOEXPANSION: land.rhs.i: -; NOEXPANSION-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[A]], i64 0, i32 0 -; NOEXPANSION-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4 -; NOEXPANSION-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[B]], i64 0, i32 0 -; NOEXPANSION-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4 +; NOEXPANSION-NEXT: [[TMP2:%.*]] = load i32, ptr [[A]], align 4 +; NOEXPANSION-NEXT: [[TMP3:%.*]] = load i32, ptr [[B]], align 4 ; NOEXPANSION-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]] ; NOEXPANSION-NEXT: br label [[OPEQ1_EXIT]] ; NOEXPANSION: opeq1.exit: ; NOEXPANSION-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ] ; NOEXPANSION-NEXT: ret i1 [[TMP4]] ; - %"struct.std::pair"* nocapture readonly dereferenceable(8) %a, - %"struct.std::pair"* nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { + ptr nocapture readonly dereferenceable(8) %a, + ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 { entry: - %first.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %a, i64 0, i32 1 - %0 = load i32, i32* %first.i, align 4 - %first1.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %b, i64 0, i32 1 - %1 = load i32, i32* %first1.i, align 4 + %first.i = getelementptr inbounds %"struct.std::pair", ptr %a, i64 0, i32 1 + %0 = load i32, ptr %first.i, align 4 + %first1.i = getelementptr inbounds %"struct.std::pair", ptr %b, i64 0, i32 1 + %1 = load i32, ptr %first1.i, align 4 %cmp.i = icmp eq i32 %0, %1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: - %second.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %a, i64 0, i32 0 - %2 = load i32, i32* %second.i, align 4 - %second2.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %b, i64 0, i32 0 - %3 = load i32, i32* %second2.i, align 4 + %2 = load i32, ptr %a, align 4 + %3 = load i32, ptr %b, align 4 %cmp3.i = icmp eq i32 %2, %3 br label %opeq1.exit