From 6402fc22e1bccd0984beadfe931511175bac688c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 16 Dec 2022 12:12:19 +0100 Subject: [PATCH] [TBAA] Convert tests to opaque pointers (NFC) --- .../Analysis/TypeBasedAliasAnalysis/PR17620.ll | 20 +- .../Analysis/TypeBasedAliasAnalysis/aggregates.ll | 56 ++- .../Analysis/TypeBasedAliasAnalysis/aliastest.ll | 32 +- .../TypeBasedAliasAnalysis/argument-promotion.ll | 24 +- .../test/Analysis/TypeBasedAliasAnalysis/cyclic.ll | 6 +- llvm/test/Analysis/TypeBasedAliasAnalysis/dse.ll | 52 +-- .../TypeBasedAliasAnalysis/dynamic-indices.ll | 70 ++-- .../TypeBasedAliasAnalysis/functionattrs.ll | 52 +-- .../gvn-nonlocal-type-mismatch.ll | 54 +-- .../Analysis/TypeBasedAliasAnalysis/intrinsics.ll | 18 +- llvm/test/Analysis/TypeBasedAliasAnalysis/licm.ll | 23 +- .../Analysis/TypeBasedAliasAnalysis/memcpyopt.ll | 14 +- .../TypeBasedAliasAnalysis/placement-tbaa.ll | 79 ++-- .../Analysis/TypeBasedAliasAnalysis/precedence.ll | 20 +- llvm/test/Analysis/TypeBasedAliasAnalysis/sink.ll | 12 +- .../TypeBasedAliasAnalysis/tbaa-path-new.ll | 119 +++--- .../Analysis/TypeBasedAliasAnalysis/tbaa-path.ll | 422 ++++++++++----------- 17 files changed, 519 insertions(+), 554 deletions(-) diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/PR17620.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/PR17620.ll index 7de014b..67d81e7 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/PR17620.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/PR17620.ll @@ -3,29 +3,29 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" %structA = type { %structB } -%structB = type { i32*, %classT } -%classT = type { %classO, %classJ*, i8 } +%structB = type { ptr, %classT } +%classT = type { %classO, ptr, i8 } %classO = type { i32 } %classJ = type { i8 } %classA = type { %classB } %classB = type { i8 } %classC = type { %classD, %structA } -%classD = type { %structA* } +%classD = type { ptr } ; Function Attrs: ssp uwtable -define %structA** @test(%classA* %this, i32** %p1) #0 align 2 { +define ptr @test(ptr %this, ptr %p1) #0 align 2 { entry: ; CHECK-LABEL: @test -; CHECK: load i32*, i32** %p1, align 8, !tbaa -; CHECK: load i32*, i32** getelementptr (%classC, %classC* null, i32 0, i32 1, i32 0, i32 0), align 8, !tbaa +; CHECK: load ptr, ptr %p1, align 8, !tbaa +; CHECK: load ptr, ptr getelementptr (%classC, ptr null, i32 0, i32 1, i32 0, i32 0), align 8, !tbaa ; CHECK: call void @callee - %0 = load i32*, i32** %p1, align 8, !tbaa !1 - %1 = load i32*, i32** getelementptr (%classC, %classC* null, i32 0, i32 1, i32 0, i32 0), align 8, !tbaa !5 - call void @callee(i32* %0, i32* %1) + %0 = load ptr, ptr %p1, align 8, !tbaa !1 + %1 = load ptr, ptr getelementptr (%classC, ptr null, i32 0, i32 1, i32 0, i32 0), align 8, !tbaa !5 + call void @callee(ptr %0, ptr %1) unreachable } -declare void @callee(i32*, i32*) #1 +declare void @callee(ptr, ptr) #1 attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/aggregates.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/aggregates.ll index 96d80e6..4049c78 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/aggregates.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/aggregates.ll @@ -12,7 +12,7 @@ %D = type { i16 } ; struct D { short s; }; ; int vs. A::i => MayAlias. -define i32 @f1(i32* %i, %A* %a) { +define i32 @f1(ptr %i, ptr %a) { entry: ; CHECK-LABEL: f1 ; CHECK: MayAlias: store i32 7, {{.*}} <-> store i32 5, @@ -21,15 +21,14 @@ entry: ; OPT: store i32 7, ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - store i32 5, i32* %i, align 4, !tbaa !3 ; TAG_int - %A_i = getelementptr inbounds %A, %A* %a, i64 0, i32 0 - store i32 7, i32* %A_i, align 4, !tbaa !5 ; TAG_A_i - %0 = load i32, i32* %i, align 4, !tbaa !3 ; TAG_int + store i32 5, ptr %i, align 4, !tbaa !3 ; TAG_int + store i32 7, ptr %a, align 4, !tbaa !5 ; TAG_A_i + %0 = load i32, ptr %i, align 4, !tbaa !3 ; TAG_int ret i32 %0 } ; int vs. B::a => MayAlias. -define i32 @f2(i32* %i, %B* %b) { +define i32 @f2(ptr %i, ptr %b) { entry: ; CHECK-LABEL: f2 ; CHECK: MayAlias: store i32 7, {{.*}} <-> store i32 5, @@ -38,15 +37,14 @@ entry: ; OPT: store i32 7, ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - store i32 5, i32* %i, align 4, !tbaa !3 ; TAG_int - %B_a = getelementptr inbounds %B, %B* %b, i64 0, i32 0, i32 0 - store i32 7, i32* %B_a, align 4, !tbaa !7 ; TAG_B_a - %0 = load i32, i32* %i, align 4, !tbaa !3 ; TAG_int + store i32 5, ptr %i, align 4, !tbaa !3 ; TAG_int + store i32 7, ptr %b, align 4, !tbaa !7 ; TAG_B_a + %0 = load i32, ptr %i, align 4, !tbaa !3 ; TAG_int ret i32 %0 } ; int vs. C::b => MayAlias. -define i32 @f3(i32* %i, %C* %c) { +define i32 @f3(ptr %i, ptr %c) { entry: ; CHECK-LABEL: f3 ; CHECK: MayAlias: store i32 7, {{.*}} <-> store i32 5, @@ -55,15 +53,14 @@ entry: ; OPT: store i32 7, ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - store i32 5, i32* %i, align 4, !tbaa !3 ; TAG_int - %C_b = getelementptr inbounds %C, %C* %c, i64 0, i32 0, i32 0, i32 0 - store i32 7, i32* %C_b, align 4, !tbaa !9 ; TAG_C_b - %0 = load i32, i32* %i, align 4, !tbaa !3 ; TAG_int + store i32 5, ptr %i, align 4, !tbaa !3 ; TAG_int + store i32 7, ptr %c, align 4, !tbaa !9 ; TAG_C_b + %0 = load i32, ptr %i, align 4, !tbaa !3 ; TAG_int ret i32 %0 } ; A vs. C::b => MayAlias. -define i32 @f4(%A* %a, %C* %c) { +define i32 @f4(ptr %a, ptr %c) { entry: ; CHECK-LABEL: f4 ; CHECK: MayAlias: store i32 7, {{.*}} <-> store i32 5, @@ -72,16 +69,14 @@ entry: ; OPT: store i32 7, ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - %ap = getelementptr inbounds %A, %A* %a, i64 0, i32 0 - store i32 5, i32* %ap, align 4, !tbaa !10 ; TAG_A - %C_b = getelementptr inbounds %C, %C* %c, i64 0, i32 0, i32 0, i32 0 - store i32 7, i32* %C_b, align 4, !tbaa !9 ; TAG_C_b - %0 = load i32, i32* %ap, align 4, !tbaa !10 ; TAG_A + store i32 5, ptr %a, align 4, !tbaa !10 ; TAG_A + store i32 7, ptr %c, align 4, !tbaa !9 ; TAG_C_b + %0 = load i32, ptr %a, align 4, !tbaa !10 ; TAG_A ret i32 %0 } ; short vs. C::b => NoAlias. -define i32 @f5(i32* %i, %C* %c) { +define i32 @f5(ptr %i, ptr %c) { entry: ; CHECK-LABEL: f5 ; CHECK: NoAlias: store i32 7, {{.*}} <-> store i32 5, @@ -89,15 +84,14 @@ entry: ; OPT: store i32 5, ; OPT: store i32 7, ; OPT: ret i32 5 - store i32 5, i32* %i, align 4, !tbaa !12 ; TAG_short - %C_b = getelementptr inbounds %C, %C* %c, i64 0, i32 0, i32 0, i32 0 - store i32 7, i32* %C_b, align 4, !tbaa !9 ; TAG_C_b - %0 = load i32, i32* %i, align 4, !tbaa !12 ; TAG_short + store i32 5, ptr %i, align 4, !tbaa !12 ; TAG_short + store i32 7, ptr %c, align 4, !tbaa !9 ; TAG_C_b + %0 = load i32, ptr %i, align 4, !tbaa !12 ; TAG_short ret i32 %0 } ; C vs. D => NoAlias. -define i32 @f6(%C* %c, %D* %d) { +define i32 @f6(ptr %c, ptr %d) { entry: ; CHECK-LABEL: f6 ; CHECK: NoAlias: store i16 7, {{.*}} <-> store i32 5, @@ -105,11 +99,9 @@ entry: ; OPT: store i32 5, ; OPT: store i16 7, ; OPT: ret i32 5 - %cp = getelementptr inbounds %C, %C* %c, i64 0, i32 0, i32 0, i32 0 - store i32 5, i32* %cp, align 4, !tbaa !13 ; TAG_C - %dp = getelementptr inbounds %D, %D* %d, i64 0, i32 0 - store i16 7, i16* %dp, align 4, !tbaa !15 ; TAG_D - %0 = load i32, i32* %cp, align 4, !tbaa !13 ; TAG_C + store i32 5, ptr %c, align 4, !tbaa !13 ; TAG_C + store i16 7, ptr %d, align 4, !tbaa !15 ; TAG_D + %0 = load i32, ptr %c, align 4, !tbaa !13 ; TAG_C ret i32 %0 } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll index d61a59c..e737441 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll @@ -4,20 +4,20 @@ ; CHECK: @test0_yes ; CHECK: add i8 %x, %x -define i8 @test0_yes(i8* %a, i8* %b) nounwind { - %x = load i8, i8* %a, !tbaa !1 - store i8 0, i8* %b, !tbaa !2 - %y = load i8, i8* %a, !tbaa !1 +define i8 @test0_yes(ptr %a, ptr %b) nounwind { + %x = load i8, ptr %a, !tbaa !1 + store i8 0, ptr %b, !tbaa !2 + %y = load i8, ptr %a, !tbaa !1 %z = add i8 %x, %y ret i8 %z } ; CHECK: @test0_no ; CHECK: add i8 %x, %y -define i8 @test0_no(i8* %a, i8* %b) nounwind { - %x = load i8, i8* %a, !tbaa !3 - store i8 0, i8* %b, !tbaa !4 - %y = load i8, i8* %a, !tbaa !3 +define i8 @test0_no(ptr %a, ptr %b) nounwind { + %x = load i8, ptr %a, !tbaa !3 + store i8 0, ptr %b, !tbaa !4 + %y = load i8, ptr %a, !tbaa !3 %z = add i8 %x, %y ret i8 %z } @@ -26,20 +26,20 @@ define i8 @test0_no(i8* %a, i8* %b) nounwind { ; CHECK: @test1_yes ; CHECK: add i8 %x, %x -define i8 @test1_yes(i8* %a, i8* %b) nounwind { - %x = load i8, i8* %a, !tbaa !5 - store i8 0, i8* %b - %y = load i8, i8* %a, !tbaa !5 +define i8 @test1_yes(ptr %a, ptr %b) nounwind { + %x = load i8, ptr %a, !tbaa !5 + store i8 0, ptr %b + %y = load i8, ptr %a, !tbaa !5 %z = add i8 %x, %y ret i8 %z } ; CHECK: @test1_no ; CHECK: add i8 %x, %y -define i8 @test1_no(i8* %a, i8* %b) nounwind { - %x = load i8, i8* %a, !tbaa !6 - store i8 0, i8* %b - %y = load i8, i8* %a, !tbaa !6 +define i8 @test1_no(ptr %a, ptr %b) nounwind { + %x = load i8, ptr %a, !tbaa !6 + store i8 0, ptr %b + %y = load i8, ptr %a, !tbaa !6 %z = add i8 %x, %y ret i8 %z } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll index bc7db24..a9932ef 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll @@ -4,31 +4,31 @@ target datalayout = "E-p:64:64:64" ; CHECK: test ; CHECK-NOT: alloca -define internal i32 @test(i32* %X, i32* %Y, i32* %Q) { - store i32 77, i32* %Q, !tbaa !2 - %A = load i32, i32* %X, !tbaa !1 - %B = load i32, i32* %Y, !tbaa !1 +define internal i32 @test(ptr %X, ptr %Y, ptr %Q) { + store i32 77, ptr %Q, !tbaa !2 + %A = load i32, ptr %X, !tbaa !1 + %B = load i32, ptr %Y, !tbaa !1 %C = add i32 %A, %B ret i32 %C } ; CHECK: caller ; CHECK-NOT: alloca -define internal i32 @caller(i32* %B, i32* %Q) { +define internal i32 @caller(ptr %B, ptr %Q) { %A = alloca i32 - store i32 78, i32* %Q, !tbaa !2 - store i32 1, i32* %A, !tbaa !1 - %C = call i32 @test(i32* %A, i32* %B, i32* %Q) + store i32 78, ptr %Q, !tbaa !2 + store i32 1, ptr %A, !tbaa !1 + %C = call i32 @test(ptr %A, ptr %B, ptr %Q) ret i32 %C } ; CHECK: callercaller ; CHECK-NOT: alloca -define i32 @callercaller(i32* %Q) { +define i32 @callercaller(ptr %Q) { %B = alloca i32 - store i32 2, i32* %B, !tbaa !1 - store i32 79, i32* %Q, !tbaa !2 - %X = call i32 @caller(i32* %B, i32* %Q) + store i32 2, ptr %B, !tbaa !1 + store i32 79, ptr %Q, !tbaa !2 + %X = call i32 @caller(ptr %B, ptr %Q) ret i32 %X } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll index a39fb928..2dcdd2d 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll @@ -1,16 +1,16 @@ ; RUN: not opt -passes=instcombine < %s 2>&1 | FileCheck %s ; CHECK: Access type node must be a valid scalar type -define void @test6(i32* %gi) #0 { +define void @test6(ptr %gi) #0 { entry: - store i32 42, i32* %gi, align 4, !tbaa !0 + store i32 42, ptr %gi, align 4, !tbaa !0 br label %for.cond for.cond: ; preds = %for.body, %entry br i1 undef, label %for.body, label %for.end for.body: ; preds = %for.cond - store i32 undef, i32* %gi, align 4, !tbaa !2 + store i32 undef, ptr %gi, align 4, !tbaa !2 br label %for.cond for.end: ; preds = %for.cond diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/dse.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/dse.ll index 196ec35..0ae5b93 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/dse.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/dse.ll @@ -4,48 +4,48 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" ; DSE should make use of TBAA. ; CHECK: @test0_yes -; CHECK-NEXT: load i8, i8* %b -; CHECK-NEXT: store i8 1, i8* %a +; CHECK-NEXT: load i8, ptr %b +; CHECK-NEXT: store i8 1, ptr %a ; CHECK-NEXT: ret i8 %y -define i8 @test0_yes(i8* %a, i8* %b) nounwind { - store i8 0, i8* %a, !tbaa !1 - %y = load i8, i8* %b, !tbaa !2 - store i8 1, i8* %a, !tbaa !1 +define i8 @test0_yes(ptr %a, ptr %b) nounwind { + store i8 0, ptr %a, !tbaa !1 + %y = load i8, ptr %b, !tbaa !2 + store i8 1, ptr %a, !tbaa !1 ret i8 %y } ; CHECK: @test0_no -; CHECK-NEXT: store i8 0, i8* %a -; CHECK-NEXT: load i8, i8* %b -; CHECK-NEXT: store i8 1, i8* %a +; CHECK-NEXT: store i8 0, ptr %a +; CHECK-NEXT: load i8, ptr %b +; CHECK-NEXT: store i8 1, ptr %a ; CHECK-NEXT: ret i8 %y -define i8 @test0_no(i8* %a, i8* %b) nounwind { - store i8 0, i8* %a, !tbaa !3 - %y = load i8, i8* %b, !tbaa !4 - store i8 1, i8* %a, !tbaa !3 +define i8 @test0_no(ptr %a, ptr %b) nounwind { + store i8 0, ptr %a, !tbaa !3 + %y = load i8, ptr %b, !tbaa !4 + store i8 1, ptr %a, !tbaa !3 ret i8 %y } ; CHECK: @test1_yes -; CHECK-NEXT: load i8, i8* %b -; CHECK-NEXT: store i8 1, i8* %a +; CHECK-NEXT: load i8, ptr %b +; CHECK-NEXT: store i8 1, ptr %a ; CHECK-NEXT: ret i8 %y -define i8 @test1_yes(i8* %a, i8* %b) nounwind { - store i8 0, i8* %a - %y = load i8, i8* %b, !tbaa !5 - store i8 1, i8* %a +define i8 @test1_yes(ptr %a, ptr %b) nounwind { + store i8 0, ptr %a + %y = load i8, ptr %b, !tbaa !5 + store i8 1, ptr %a ret i8 %y } ; CHECK: @test1_no -; CHECK-NEXT: store i8 0, i8* %a -; CHECK-NEXT: load i8, i8* %b -; CHECK-NEXT: store i8 1, i8* %a +; CHECK-NEXT: store i8 0, ptr %a +; CHECK-NEXT: load i8, ptr %b +; CHECK-NEXT: store i8 1, ptr %a ; CHECK-NEXT: ret i8 %y -define i8 @test1_no(i8* %a, i8* %b) nounwind { - store i8 0, i8* %a - %y = load i8, i8* %b, !tbaa !6 - store i8 1, i8* %a +define i8 @test1_no(ptr %a, ptr %b) nounwind { + store i8 0, ptr %a + %y = load i8, ptr %b, !tbaa !6 + store i8 1, ptr %a ret i8 %y } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll index 64af5f9..09b7ff5 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll @@ -12,10 +12,10 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 ; CHECK: define void @vrlh( ; CHECK: for.end: -; CHECK: %arrayidx31 = getelementptr inbounds %union.vector_t, %union.vector_t* %t, i64 0, i32 0, i64 1 -; CHECK: %tmp32 = load i64, i64* %arrayidx31, align 8, !tbaa [[TAG:!.*]] +; CHECK: %arrayidx31 = getelementptr inbounds %union.vector_t, ptr %t, i64 0, i32 0, i64 1 +; CHECK: %tmp32 = load i64, ptr %arrayidx31, align 8, !tbaa [[TAG:!.*]] -define void @vrlh(%union.vector_t* %va, %union.vector_t* %vb, %union.vector_t* %vd) nounwind { +define void @vrlh(ptr %va, ptr %vb, ptr %vd) nounwind { entry: %t = alloca %union.vector_t, align 8 br label %for.body @@ -24,23 +24,20 @@ for.body: ; preds = %entry, %for.body %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ] %sub = sub nsw i32 7, %i.01 %idxprom = sext i32 %sub to i64 - %half = bitcast %union.vector_t* %vb to [8 x i16]* - %arrayidx = getelementptr inbounds [8 x i16], [8 x i16]* %half, i64 0, i64 %idxprom - %tmp4 = load i16, i16* %arrayidx, align 2, !tbaa !10 + %arrayidx = getelementptr inbounds [8 x i16], ptr %vb, i64 0, i64 %idxprom + %tmp4 = load i16, ptr %arrayidx, align 2, !tbaa !10 %conv = zext i16 %tmp4 to i32 %and = and i32 %conv, 15 %sub6 = sub nsw i32 7, %i.01 %idxprom7 = sext i32 %sub6 to i64 - %half9 = bitcast %union.vector_t* %va to [8 x i16]* - %arrayidx10 = getelementptr inbounds [8 x i16], [8 x i16]* %half9, i64 0, i64 %idxprom7 - %tmp11 = load i16, i16* %arrayidx10, align 2, !tbaa !10 + %arrayidx10 = getelementptr inbounds [8 x i16], ptr %va, i64 0, i64 %idxprom7 + %tmp11 = load i16, ptr %arrayidx10, align 2, !tbaa !10 %conv12 = zext i16 %tmp11 to i32 %shl = shl i32 %conv12, %and %sub15 = sub nsw i32 7, %i.01 %idxprom16 = sext i32 %sub15 to i64 - %half18 = bitcast %union.vector_t* %va to [8 x i16]* - %arrayidx19 = getelementptr inbounds [8 x i16], [8 x i16]* %half18, i64 0, i64 %idxprom16 - %tmp20 = load i16, i16* %arrayidx19, align 2, !tbaa !10 + %arrayidx19 = getelementptr inbounds [8 x i16], ptr %va, i64 0, i64 %idxprom16 + %tmp20 = load i16, ptr %arrayidx19, align 2, !tbaa !10 %conv21 = zext i16 %tmp20 to i32 %sub23 = sub nsw i32 16, %and %shr = lshr i32 %conv21, %sub23 @@ -48,22 +45,19 @@ for.body: ; preds = %entry, %for.body %conv24 = trunc i32 %or to i16 %sub26 = sub nsw i32 7, %i.01 %idxprom27 = sext i32 %sub26 to i64 - %half28 = bitcast %union.vector_t* %t to [8 x i16]* - %arrayidx29 = getelementptr inbounds [8 x i16], [8 x i16]* %half28, i64 0, i64 %idxprom27 - store i16 %conv24, i16* %arrayidx29, align 2, !tbaa !10 + %arrayidx29 = getelementptr inbounds [8 x i16], ptr %t, i64 0, i64 %idxprom27 + store i16 %conv24, ptr %arrayidx29, align 2, !tbaa !10 %inc = add nsw i32 %i.01, 1 %cmp = icmp slt i32 %inc, 8 br i1 %cmp, label %for.body, label %for.end for.end: ; preds = %for.body - %arrayidx31 = getelementptr inbounds %union.vector_t, %union.vector_t* %t, i64 0, i32 0, i64 1 - %tmp32 = load i64, i64* %arrayidx31, align 8, !tbaa !10 - %arrayidx35 = getelementptr inbounds %union.vector_t, %union.vector_t* %vd, i64 0, i32 0, i64 1 - store i64 %tmp32, i64* %arrayidx35, align 8, !tbaa !10 - %arrayidx37 = getelementptr inbounds %union.vector_t, %union.vector_t* %t, i64 0, i32 0, i64 0 - %tmp38 = load i64, i64* %arrayidx37, align 8, !tbaa !10 - %arrayidx41 = getelementptr inbounds %union.vector_t, %union.vector_t* %vd, i64 0, i32 0, i64 0 - store i64 %tmp38, i64* %arrayidx41, align 8, !tbaa !10 + %arrayidx31 = getelementptr inbounds %union.vector_t, ptr %t, i64 0, i32 0, i64 1 + %tmp32 = load i64, ptr %arrayidx31, align 8, !tbaa !10 + %arrayidx35 = getelementptr inbounds %union.vector_t, ptr %vd, i64 0, i32 0, i64 1 + store i64 %tmp32, ptr %arrayidx35, align 8, !tbaa !10 + %tmp38 = load i64, ptr %t, align 8, !tbaa !10 + store i64 %tmp38, ptr %vd, align 8, !tbaa !10 ret void } @@ -73,25 +67,23 @@ for.end: ; preds = %for.body ; CHECK: ret i32 0 -define i32 @test0(%struct.X* %a) nounwind { +define i32 @test0(ptr %a) nounwind { entry: - %i = getelementptr inbounds %struct.X, %struct.X* %a, i64 0, i32 0 - store i32 0, i32* %i, align 4, !tbaa !4 + store i32 0, ptr %a, align 4, !tbaa !4 br label %for.body for.body: ; preds = %entry, %for.body %i2.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %f = getelementptr inbounds %struct.X, %struct.X* %a, i64 %i2.01, i32 1 - %tmp6 = load float, float* %f, align 4, !tbaa !5 + %f = getelementptr inbounds %struct.X, ptr %a, i64 %i2.01, i32 1 + %tmp6 = load float, ptr %f, align 4, !tbaa !5 %mul = fmul float %tmp6, 0x40019999A0000000 - store float %mul, float* %f, align 4, !tbaa !5 + store float %mul, ptr %f, align 4, !tbaa !5 %inc = add nsw i64 %i2.01, 1 %cmp = icmp slt i64 %inc, 10000 br i1 %cmp, label %for.body, label %for.end for.end: ; preds = %for.body - %i9 = getelementptr inbounds %struct.X, %struct.X* %a, i64 0, i32 0 - %tmp10 = load i32, i32* %i9, align 4, !tbaa !4 + %tmp10 = load i32, ptr %a, align 4, !tbaa !4 ret i32 %tmp10 } @@ -101,25 +93,25 @@ for.end: ; preds = %for.body ; CHECK: ret float 0x3FD3333340000000 -define float @test1(%struct.X* %a) nounwind { +define float @test1(ptr %a) nounwind { entry: - %f = getelementptr inbounds %struct.X, %struct.X* %a, i64 0, i32 1 - store float 0x3FD3333340000000, float* %f, align 4, !tbaa !5 + %f = getelementptr inbounds %struct.X, ptr %a, i64 0, i32 1 + store float 0x3FD3333340000000, ptr %f, align 4, !tbaa !5 br label %for.body for.body: ; preds = %entry, %for.body %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %i5 = getelementptr inbounds %struct.X, %struct.X* %a, i64 %i.01, i32 0 - %tmp6 = load i32, i32* %i5, align 4, !tbaa !4 + %i5 = getelementptr inbounds %struct.X, ptr %a, i64 %i.01, i32 0 + %tmp6 = load i32, ptr %i5, align 4, !tbaa !4 %mul = mul nsw i32 %tmp6, 3 - store i32 %mul, i32* %i5, align 4, !tbaa !4 + store i32 %mul, ptr %i5, align 4, !tbaa !4 %inc = add nsw i64 %i.01, 1 %cmp = icmp slt i64 %inc, 10000 br i1 %cmp, label %for.body, label %for.end for.end: ; preds = %for.body - %f9 = getelementptr inbounds %struct.X, %struct.X* %a, i64 0, i32 1 - %tmp10 = load float, float* %f9, align 4, !tbaa !5 + %f9 = getelementptr inbounds %struct.X, ptr %a, i64 0, i32 1 + %tmp10 = load float, ptr %f9, align 4, !tbaa !5 ret float %tmp10 } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll index 7f8f7e8..86e7f8c 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll @@ -9,30 +9,30 @@ ; invalid, as it's possible that this only happens after optimization on a ; code path which isn't ever executed. -; CHECK: define void @test0_yes(i32* nocapture %p) #0 { -define void @test0_yes(i32* %p) nounwind { - store i32 0, i32* %p, !tbaa !1 +; CHECK: define void @test0_yes(ptr nocapture %p) #0 { +define void @test0_yes(ptr %p) nounwind { + store i32 0, ptr %p, !tbaa !1 ret void } -; CHECK: define void @test0_no(i32* nocapture writeonly %p) #1 { -define void @test0_no(i32* %p) nounwind { - store i32 0, i32* %p, !tbaa !2 +; CHECK: define void @test0_no(ptr nocapture writeonly %p) #1 { +define void @test0_no(ptr %p) nounwind { + store i32 0, ptr %p, !tbaa !2 ret void } ; Add the readnone attribute, since there's just a call to a function which ; TBAA says only accesses constant memory. -; CHECK: define void @test1_yes(i32* nocapture %p) #2 { -define void @test1_yes(i32* %p) nounwind { - call void @callee(i32* %p), !tbaa !1 +; CHECK: define void @test1_yes(ptr nocapture %p) #2 { +define void @test1_yes(ptr %p) nounwind { + call void @callee(ptr %p), !tbaa !1 ret void } -; CHECK: define void @test1_no(i32* %p) #3 { -define void @test1_no(i32* %p) nounwind { - call void @callee(i32* %p), !tbaa !2 +; CHECK: define void @test1_no(ptr %p) #3 { +define void @test1_no(ptr %p) nounwind { + call void @callee(ptr %p), !tbaa !2 ret void } @@ -43,34 +43,34 @@ define void @test1_no(i32* %p) nounwind { ; This is unusual, since the function is memcpy, but as above, this ; isn't necessarily invalid. -; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) #4 { -define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind { - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i1 false), !tbaa !1 +; CHECK: define void @test2_yes(ptr nocapture %p, ptr nocapture %q, i64 %n) #4 { +define void @test2_yes(ptr %p, ptr %q, i64 %n) nounwind { + call void @llvm.memcpy.p0.p0.i64(ptr %p, ptr %q, i64 %n, i1 false), !tbaa !1 ret void } -; CHECK: define void @test2_no(i8* nocapture writeonly %p, i8* nocapture readonly %q, i64 %n) #5 { -define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind { - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i1 false), !tbaa !2 +; CHECK: define void @test2_no(ptr nocapture writeonly %p, ptr nocapture readonly %q, i64 %n) #5 { +define void @test2_no(ptr %p, ptr %q, i64 %n) nounwind { + call void @llvm.memcpy.p0.p0.i64(ptr %p, ptr %q, i64 %n, i1 false), !tbaa !2 ret void } ; Similar to the others, va_arg only accesses memory through its operand. -; CHECK: define i32 @test3_yes(i8* nocapture %p) #0 { -define i32 @test3_yes(i8* %p) nounwind { - %t = va_arg i8* %p, i32, !tbaa !1 +; CHECK: define i32 @test3_yes(ptr nocapture %p) #0 { +define i32 @test3_yes(ptr %p) nounwind { + %t = va_arg ptr %p, i32, !tbaa !1 ret i32 %t } -; CHECK: define i32 @test3_no(i8* nocapture %p) #6 { -define i32 @test3_no(i8* %p) nounwind { - %t = va_arg i8* %p, i32, !tbaa !2 +; CHECK: define i32 @test3_no(ptr nocapture %p) #6 { +define i32 @test3_no(ptr %p) nounwind { + %t = va_arg ptr %p, i32, !tbaa !2 ret i32 %t } -declare void @callee(i32* %p) nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1) nounwind +declare void @callee(ptr %p) nounwind +declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1) nounwind ; CHECK: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } ; CHECK: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll index 8eb1026..d93d521 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll @@ -7,18 +7,18 @@ target datalayout = "e-p:64:64:64" ; CHECK: @yes ; CHECK: if.then: -; CHECK-NEXT: store i32 0, i32* %q +; CHECK-NEXT: store i32 0, ptr %q ; CHECK-NEXT: ret void -define void @yes(i1 %c, i32* %p, i32* %p1, i32* %q) nounwind { +define void @yes(i1 %c, ptr %p, ptr %p1, ptr %q) nounwind { entry: - store i32 0, i32* %p, !tbaa !1 - store i32 1, i32* %p1, !tbaa !2 + store i32 0, ptr %p, !tbaa !1 + store i32 1, ptr %p1, !tbaa !2 br i1 %c, label %if.else, label %if.then if.then: - %t = load i32, i32* %p, !tbaa !1 - store i32 %t, i32* %q + %t = load i32, ptr %p, !tbaa !1 + store i32 %t, ptr %q ret void if.else: @@ -32,27 +32,27 @@ if.else: ; CHECK: @watch_out_for_type_change ; CHECK: if.then: -; CHECK: %t = load i32, i32* %p -; CHECK: store i32 %t, i32* %q +; CHECK: %t = load i32, ptr %p +; CHECK: store i32 %t, ptr %q ; CHECK: ret void ; CHECK: if.else: -; CHECK: %u = load i32, i32* %p -; CHECK: store i32 %u, i32* %q +; CHECK: %u = load i32, ptr %p +; CHECK: store i32 %u, ptr %q -define void @watch_out_for_type_change(i1 %c, i32* %p, i32* %p1, i32* %q) nounwind { +define void @watch_out_for_type_change(i1 %c, ptr %p, ptr %p1, ptr %q) nounwind { entry: - store i32 0, i32* %p, !tbaa !1 - store i32 1, i32* %p1, !tbaa !2 + store i32 0, ptr %p, !tbaa !1 + store i32 1, ptr %p1, !tbaa !2 br i1 %c, label %if.else, label %if.then if.then: - %t = load i32, i32* %p, !tbaa !3 - store i32 %t, i32* %q + %t = load i32, ptr %p, !tbaa !3 + store i32 %t, ptr %q ret void if.else: - %u = load i32, i32* %p, !tbaa !4 - store i32 %u, i32* %q + %u = load i32, ptr %p, !tbaa !4 + store i32 %u, ptr %q ret void } @@ -61,26 +61,26 @@ if.else: ; CHECK: @watch_out_for_another_type_change ; CHECK: if.then: -; CHECK: store i32 0, i32* %q +; CHECK: store i32 0, ptr %q ; CHECK: ret void ; CHECK: if.else: -; CHECK: %u = load i32, i32* %p -; CHECK: store i32 %u, i32* %q +; CHECK: %u = load i32, ptr %p +; CHECK: store i32 %u, ptr %q -define void @watch_out_for_another_type_change(i1 %c, i32* %p, i32* %p1, i32* %q) nounwind { +define void @watch_out_for_another_type_change(i1 %c, ptr %p, ptr %p1, ptr %q) nounwind { entry: - store i32 0, i32* %p, !tbaa !1 - store i32 1, i32* %p1, !tbaa !2 + store i32 0, ptr %p, !tbaa !1 + store i32 1, ptr %p1, !tbaa !2 br i1 %c, label %if.else, label %if.then if.then: - %t = load i32, i32* %p, !tbaa !4 - store i32 %t, i32* %q + %t = load i32, ptr %p, !tbaa !4 + store i32 %t, ptr %q ret void if.else: - %u = load i32, i32* %p, !tbaa !3 - store i32 %u, i32* %q + %u = load i32, ptr %p, !tbaa !3 + store i32 %u, ptr %q ret void } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll index f3b4b1a..7ec674a 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll @@ -5,22 +5,22 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32- ; TBAA should prove that these calls don't interfere, since they are ; IntrArgReadMem and have TBAA metadata. -; CHECK: define <8 x i16> @test0(<8 x i16>* %p, <8 x i16>* %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { +; CHECK: define <8 x i16> @test0(ptr %p, ptr %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { ; CHECK-NEXT: entry: -; CHECK-NEXT: %a = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %p, i32 16, <8 x i1> %m, <8 x i16> %pt) [[NUW:#[0-9]+]] -; CHECK-NEXT: call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %y, <8 x i16>* %q, i32 16, <8 x i1> %m) +; CHECK-NEXT: %a = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) [[NUW:#[0-9]+]] +; CHECK-NEXT: call void @llvm.masked.store.v8i16.p0(<8 x i16> %y, ptr %q, i32 16, <8 x i1> %m) ; CHECK-NEXT: %c = add <8 x i16> %a, %a -define <8 x i16> @test0(<8 x i16>* %p, <8 x i16>* %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { +define <8 x i16> @test0(ptr %p, ptr %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { entry: - %a = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind, !tbaa !2 - call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %y, <8 x i16>* %q, i32 16, <8 x i1> %m), !tbaa !1 - %b = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind, !tbaa !2 + %a = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind, !tbaa !2 + call void @llvm.masked.store.v8i16.p0(<8 x i16> %y, ptr %q, i32 16, <8 x i1> %m), !tbaa !1 + %b = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind, !tbaa !2 %c = add <8 x i16> %a, %b ret <8 x i16> %c } -declare <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>*, i32, <8 x i1>, <8 x i16>) nounwind readonly -declare void @llvm.masked.store.v8i16.p0v8i16(<8 x i16>, <8 x i16>*, i32, <8 x i1>) nounwind +declare <8 x i16> @llvm.masked.load.v8i16.p0(ptr, i32, <8 x i1>, <8 x i16>) nounwind readonly +declare void @llvm.masked.store.v8i16.p0(<8 x i16>, ptr, i32, <8 x i1>) nounwind ; CHECK: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } ; CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/licm.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/licm.ll index 1d9f13e..b9f18a6 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/licm.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/licm.ll @@ -5,10 +5,10 @@ ; CHECK: @foo ; CHECK: entry: -; CHECK-NEXT: %tmp3 = load double*, double** @P +; CHECK-NEXT: %tmp3 = load ptr, ptr @P ; CHECK-NEXT: br label %for.body -@P = common global double* null +@P = common global ptr null define void @foo(i64 %n) nounwind { entry: @@ -16,11 +16,11 @@ entry: for.body: ; preds = %entry, %for.body %i.07 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %tmp3 = load double*, double** @P, !tbaa !1 - %scevgep = getelementptr double, double* %tmp3, i64 %i.07 - %tmp4 = load double, double* %scevgep, !tbaa !2 + %tmp3 = load ptr, ptr @P, !tbaa !1 + %scevgep = getelementptr double, ptr %tmp3, i64 %i.07 + %tmp4 = load double, ptr %scevgep, !tbaa !2 %mul = fmul double %tmp4, 2.300000e+00 - store double %mul, double* %scevgep, !tbaa !2 + store double %mul, ptr %scevgep, !tbaa !2 %inc = add i64 %i.07, 1 %exitcond = icmp eq i64 %inc, %n br i1 %exitcond, label %for.end, label %for.body @@ -43,16 +43,15 @@ for.end: ; preds = %for.body, %entry ; CHECK: store ; CHECK: br label %loop -define void @bar(i8** %p) nounwind { +define void @bar(ptr %p) nounwind { entry: - %q = bitcast i8** %p to i8* br label %loop loop: - %tmp51 = load i8*, i8** %p, !tbaa !4 - store i8* %tmp51, i8** %p - %tmp40 = load i8, i8* %q, !tbaa !5 - store i8 %tmp40, i8* %q + %tmp51 = load ptr, ptr %p, !tbaa !4 + store ptr %tmp51, ptr %p + %tmp40 = load i8, ptr %p, !tbaa !5 + store i8 %tmp40, ptr %p br label %loop } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll index 4341853..47dd886 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll @@ -6,18 +6,18 @@ target datalayout = "e-p:64:64:64" ; The second memcpy is redundant and can be deleted. There's an intervening store, but ; it has a TBAA tag which declares that it is unrelated. -define void @foo(i8* nocapture %p, i8* nocapture %q, i8* nocapture %s) nounwind { +define void @foo(ptr nocapture %p, ptr nocapture %q, ptr nocapture %s) nounwind { ; CHECK: @foo -; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(16) %p, i8* noundef nonnull align 1 dereferenceable(16) %q, i64 16, i1 false), !tbaa !0 -; CHECK-NEXT: store i8 2, i8* %s, align 1, !tbaa [[TAGA:!.*]] +; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %p, ptr noundef nonnull align 1 dereferenceable(16) %q, i64 16, i1 false), !tbaa !0 +; CHECK-NEXT: store i8 2, ptr %s, align 1, !tbaa [[TAGA:!.*]] ; CHECK-NEXT: ret void - tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 16, i1 false), !tbaa !2 - store i8 2, i8* %s, align 1, !tbaa !1 - tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %q, i8* %p, i64 16, i1 false), !tbaa !2 + tail call void @llvm.memcpy.p0.p0.i64(ptr %p, ptr %q, i64 16, i1 false), !tbaa !2 + store i8 2, ptr %s, align 1, !tbaa !1 + tail call void @llvm.memcpy.p0.p0.i64(ptr %q, ptr %p, i64 16, i1 false), !tbaa !2 ret void } -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind +declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind ; CHECK: [[TAGA]] = !{[[TYPEA:!.*]], [[TYPEA]], i64 0} ; CHECK: [[TYPEA]] = !{!"A", !{{.*}}} diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll index 70e9e4a..e9ce95b 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll @@ -17,83 +17,74 @@ ; } ; Basic AA says MayAlias, TBAA says NoAlias -; CHECK: MayAlias: i64* %i5, i8** %p -; CHECK: NoAlias: store i64 %conv, i64* %i5, align 8, !tbaa !6 <-> store i8* null, i8** %p, align 8, !tbaa !9 +; CHECK: MayAlias: ptr* %5, i64* %9 +; CHECK: NoAlias: store i64 %conv, ptr %9, align 8, !tbaa !6 <-> store ptr null, ptr %5, align 8, !tbaa !9 %struct.Foo = type { i64 } -%struct.Bar = type { i8* } +%struct.Bar = type { ptr } define i64 @_Z3fooi(i32 %n) #0 { entry: %n.addr = alloca i32, align 4 - %f = alloca %struct.Foo*, align 8 + %f = alloca ptr, align 8 %i1 = alloca i32, align 4 - %b = alloca %struct.Bar*, align 8 - store i32 %n, i32* %n.addr, align 4, !tbaa !0 - %call = call noalias i8* @_Znwm(i64 8) - %0 = bitcast i8* %call to %struct.Foo* - store %struct.Foo* %0, %struct.Foo** %f, align 8, !tbaa !4 - %1 = load %struct.Foo*, %struct.Foo** %f, align 8, !tbaa !4 - %i = getelementptr inbounds %struct.Foo, %struct.Foo* %1, i32 0, i32 0 - store i64 1, i64* %i, align 8, !tbaa !6 - store i32 0, i32* %i1, align 4, !tbaa !0 + %b = alloca ptr, align 8 + store i32 %n, ptr %n.addr, align 4, !tbaa !0 + %call = call noalias ptr @_Znwm(i64 8) + store ptr %call, ptr %f, align 8, !tbaa !4 + %0 = load ptr, ptr %f, align 8, !tbaa !4 + store i64 1, ptr %0, align 8, !tbaa !6 + store i32 0, ptr %i1, align 4, !tbaa !0 br label %for.cond for.cond: - %2 = load i32, i32* %i1, align 4, !tbaa !0 - %3 = load i32, i32* %n.addr, align 4, !tbaa !0 - %cmp = icmp slt i32 %2, %3 + %1 = load i32, ptr %i1, align 4, !tbaa !0 + %2 = load i32, ptr %n.addr, align 4, !tbaa !0 + %cmp = icmp slt i32 %1, %2 br i1 %cmp, label %for.body, label %for.end for.body: - %4 = load %struct.Foo*, %struct.Foo** %f, align 8, !tbaa !4 - %5 = bitcast %struct.Foo* %4 to i8* - %new.isnull = icmp eq i8* %5, null + %3 = load ptr, ptr %f, align 8, !tbaa !4 + %new.isnull = icmp eq ptr %3, null br i1 %new.isnull, label %new.cont, label %new.notnull new.notnull: - %6 = bitcast i8* %5 to %struct.Bar* br label %new.cont new.cont: - %7 = phi %struct.Bar* [ %6, %new.notnull ], [ null, %for.body ] - store %struct.Bar* %7, %struct.Bar** %b, align 8, !tbaa !4 - %8 = load %struct.Bar*, %struct.Bar** %b, align 8, !tbaa !4 - %p = getelementptr inbounds %struct.Bar, %struct.Bar* %8, i32 0, i32 0 - store i8* null, i8** %p, align 8, !tbaa !9 - %9 = load %struct.Foo*, %struct.Foo** %f, align 8, !tbaa !4 - %10 = bitcast %struct.Foo* %9 to i8* - %new.isnull2 = icmp eq i8* %10, null + %4 = phi ptr [ %3, %new.notnull ], [ null, %for.body ] + store ptr %4, ptr %b, align 8, !tbaa !4 + %5 = load ptr, ptr %b, align 8, !tbaa !4 + store ptr null, ptr %5, align 8, !tbaa !9 + %6 = load ptr, ptr %f, align 8, !tbaa !4 + %new.isnull2 = icmp eq ptr %6, null br i1 %new.isnull2, label %new.cont4, label %new.notnull3 new.notnull3: - %11 = bitcast i8* %10 to %struct.Foo* br label %new.cont4 new.cont4: - %12 = phi %struct.Foo* [ %11, %new.notnull3 ], [ null, %new.cont ] - store %struct.Foo* %12, %struct.Foo** %f, align 8, !tbaa !4 - %13 = load i32, i32* %i1, align 4, !tbaa !0 - %conv = sext i32 %13 to i64 - %14 = load %struct.Foo*, %struct.Foo** %f, align 8, !tbaa !4 - %i5 = getelementptr inbounds %struct.Foo, %struct.Foo* %14, i32 0, i32 0 - store i64 %conv, i64* %i5, align 8, !tbaa !6 + %7 = phi ptr [ %6, %new.notnull3 ], [ null, %new.cont ] + store ptr %7, ptr %f, align 8, !tbaa !4 + %8 = load i32, ptr %i1, align 4, !tbaa !0 + %conv = sext i32 %8 to i64 + %9 = load ptr, ptr %f, align 8, !tbaa !4 + store i64 %conv, ptr %9, align 8, !tbaa !6 br label %for.inc for.inc: - %15 = load i32, i32* %i1, align 4, !tbaa !0 - %inc = add nsw i32 %15, 1 - store i32 %inc, i32* %i1, align 4, !tbaa !0 + %10 = load i32, ptr %i1, align 4, !tbaa !0 + %inc = add nsw i32 %10, 1 + store i32 %inc, ptr %i1, align 4, !tbaa !0 br label %for.cond for.end: - %16 = load %struct.Foo*, %struct.Foo** %f, align 8, !tbaa !4 - %i6 = getelementptr inbounds %struct.Foo, %struct.Foo* %16, i32 0, i32 0 - %17 = load i64, i64* %i6, align 8, !tbaa !6 - ret i64 %17 + %11 = load ptr, ptr %f, align 8, !tbaa !4 + %12 = load i64, ptr %11, align 8, !tbaa !6 + ret i64 %12 } -declare noalias i8* @_Znwm(i64) +declare noalias ptr @_Znwm(i64) attributes #0 = { nounwind } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/precedence.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/precedence.ll index e95186f..175bef6 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/precedence.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/precedence.ll @@ -13,12 +13,11 @@ target datalayout = "e-p:64:64:64" ; TBAA: ret i32 0 ; BASICAA: @trouble ; BASICAA: ret i32 1075000115 -define i32 @trouble(i32* %x) nounwind { +define i32 @trouble(ptr %x) nounwind { entry: - store i32 0, i32* %x, !tbaa !0 - %0 = bitcast i32* %x to float* - store float 0x4002666660000000, float* %0, !tbaa !3 - %tmp3 = load i32, i32* %x, !tbaa !0 + store i32 0, ptr %x, !tbaa !0 + store float 0x4002666660000000, ptr %x, !tbaa !3 + %tmp3 = load i32, ptr %x, !tbaa !0 ret i32 %tmp3 } @@ -29,13 +28,12 @@ entry: ; TBAA: ret i64 0 ; BASICAA: @offset ; BASICAA: ret i64 %tmp3 -define i64 @offset(i64* %x) nounwind { +define i64 @offset(ptr %x) nounwind { entry: - store i64 0, i64* %x, !tbaa !4 - %0 = bitcast i64* %x to i8* - %1 = getelementptr i8, i8* %0, i64 1 - store i8 1, i8* %1, !tbaa !5 - %tmp3 = load i64, i64* %x, !tbaa !4 + store i64 0, ptr %x, !tbaa !4 + %0 = getelementptr i8, ptr %x, i64 1 + store i8 1, ptr %0, !tbaa !5 + %tmp3 = load i64, ptr %x, !tbaa !4 ret i64 %tmp3 } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/sink.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/sink.ll index 2132d86..84b1213 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/sink.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/sink.ll @@ -1,15 +1,15 @@ ; RUN: opt -aa-pipeline=tbaa -passes=sink -S < %s | FileCheck %s ; CHECK: a: -; CHECK: %f = load float, float* %p, align 4, !tbaa [[TAGA:!.*]] -; CHECK: store float %f, float* %q +; CHECK: %f = load float, ptr %p, align 4, !tbaa [[TAGA:!.*]] +; CHECK: store float %f, ptr %q -define void @foo(float* %p, i1 %c, float* %q, float* %r) { - %f = load float, float* %p, !tbaa !0 - store float 0.0, float* %r, !tbaa !1 +define void @foo(ptr %p, i1 %c, ptr %q, ptr %r) { + %f = load float, ptr %p, !tbaa !0 + store float 0.0, ptr %r, !tbaa !1 br i1 %c, label %a, label %b a: - store float %f, float* %q + store float %f, ptr %q br label %b b: ret void diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path-new.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path-new.ll index d652b93..f245170 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path-new.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path-new.ll @@ -15,7 +15,7 @@ ; return *s; ; } ; -define i32 @_Z1gPjP7StructAy(i32* nocapture %s, %struct.StructA* nocapture %A, i64 %count) { +define i32 @_Z1gPjP7StructAy(ptr nocapture %s, ptr nocapture %A, i64 %count) { entry: ; CHECK-LABEL: Z1gPjP7StructAy ; CHECK: MayAlias: store i32 4, {{.*}} <-> store i32 1, @@ -24,10 +24,10 @@ entry: ; OPT: store i32 4, ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - store i32 1, i32* %s, align 4, !tbaa !2 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 4, i32* %f32, align 4, !tbaa !6 - %0 = load i32, i32* %s, align 4, !tbaa !2 + store i32 1, ptr %s, align 4, !tbaa !2 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 4, ptr %f32, align 4, !tbaa !6 + %0 = load i32, ptr %s, align 4, !tbaa !2 ret i32 %0 } @@ -37,7 +37,7 @@ entry: ; return *s; ; } ; -define i32 @_Z2g2PjP7StructAy(i32* nocapture %s, %struct.StructA* nocapture %A, i64 %count) { +define i32 @_Z2g2PjP7StructAy(ptr nocapture %s, ptr nocapture %A, i64 %count) { entry: ; CHECK-LABEL: _Z2g2PjP7StructAy ; CHECK: NoAlias: store i16 4, {{.*}} <-> store i32 1, @@ -46,9 +46,8 @@ entry: ; OPT: store i16 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - store i32 1, i32* %s, align 4, !tbaa !2 - %f16 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 0 - store i16 4, i16* %f16, align 4, !tbaa !9 + store i32 1, ptr %s, align 4, !tbaa !2 + store i16 4, ptr %A, align 4, !tbaa !9 ret i32 1 } @@ -58,7 +57,7 @@ entry: ; return A->f32; ; } ; -define i32 @_Z2g3P7StructAP7StructBy(%struct.StructA* nocapture %A, %struct.StructB* nocapture %B, i64 %count) { +define i32 @_Z2g3P7StructAP7StructBy(ptr nocapture %A, ptr nocapture %B, i64 %count) { entry: ; CHECK-LABEL: _Z2g3P7StructAP7StructBy ; CHECK: MayAlias: store i32 4, {{.*}} <-> store i32 1, @@ -67,11 +66,11 @@ entry: ; OPT: store i32 4 ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !6 - %f321 = getelementptr inbounds %struct.StructB, %struct.StructB* %B, i64 0, i32 1, i32 1 - store i32 4, i32* %f321, align 4, !tbaa !10 - %0 = load i32, i32* %f32, align 4, !tbaa !6 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !6 + %f321 = getelementptr inbounds %struct.StructB, ptr %B, i64 0, i32 1, i32 1 + store i32 4, ptr %f321, align 4, !tbaa !10 + %0 = load i32, ptr %f32, align 4, !tbaa !6 ret i32 %0 } @@ -81,7 +80,7 @@ entry: ; return A->f32; ; } ; -define i32 @_Z2g4P7StructAP7StructBy(%struct.StructA* nocapture %A, %struct.StructB* nocapture %B, i64 %count) { +define i32 @_Z2g4P7StructAP7StructBy(ptr nocapture %A, ptr nocapture %B, i64 %count) { entry: ; CHECK-LABEL: _Z2g4P7StructAP7StructBy ; CHECK: NoAlias: store i16 4, {{.*}} <-> store i32 1, @@ -90,10 +89,10 @@ entry: ; OPT: store i16 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !6 - %f16 = getelementptr inbounds %struct.StructB, %struct.StructB* %B, i64 0, i32 1, i32 0 - store i16 4, i16* %f16, align 4, !tbaa !12 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !6 + %f16 = getelementptr inbounds %struct.StructB, ptr %B, i64 0, i32 1, i32 0 + store i16 4, ptr %f16, align 4, !tbaa !12 ret i32 1 } @@ -103,7 +102,7 @@ entry: ; return A->f32; ; } ; -define i32 @_Z2g5P7StructAP7StructBy(%struct.StructA* nocapture %A, %struct.StructB* nocapture %B, i64 %count) { +define i32 @_Z2g5P7StructAP7StructBy(ptr nocapture %A, ptr nocapture %B, i64 %count) { entry: ; CHECK-LABEL: _Z2g5P7StructAP7StructBy ; CHECK: NoAlias: store i32 4, {{.*}} <-> store i32 1, @@ -112,10 +111,10 @@ entry: ; OPT: store i32 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !6 - %f321 = getelementptr inbounds %struct.StructB, %struct.StructB* %B, i64 0, i32 2 - store i32 4, i32* %f321, align 4, !tbaa !13 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !6 + %f321 = getelementptr inbounds %struct.StructB, ptr %B, i64 0, i32 2 + store i32 4, ptr %f321, align 4, !tbaa !13 ret i32 1 } @@ -125,7 +124,7 @@ entry: ; return A->f32; ; } ; -define i32 @_Z2g6P7StructAP7StructBy(%struct.StructA* nocapture %A, %struct.StructB* nocapture %B, i64 %count) { +define i32 @_Z2g6P7StructAP7StructBy(ptr nocapture %A, ptr nocapture %B, i64 %count) { entry: ; CHECK-LABEL: _Z2g6P7StructAP7StructBy ; CHECK: NoAlias: store i32 4, {{.*}} <-> store i32 1, @@ -134,10 +133,10 @@ entry: ; OPT: store i32 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !6 - %f32_2 = getelementptr inbounds %struct.StructB, %struct.StructB* %B, i64 0, i32 1, i32 3 - store i32 4, i32* %f32_2, align 4, !tbaa !14 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !6 + %f32_2 = getelementptr inbounds %struct.StructB, ptr %B, i64 0, i32 1, i32 3 + store i32 4, ptr %f32_2, align 4, !tbaa !14 ret i32 1 } @@ -147,7 +146,7 @@ entry: ; return A->f32; ; } ; -define i32 @_Z2g7P7StructAP7StructSy(%struct.StructA* nocapture %A, %struct.StructS* nocapture %S, i64 %count) { +define i32 @_Z2g7P7StructAP7StructSy(ptr nocapture %A, ptr nocapture %S, i64 %count) { entry: ; CHECK-LABEL: _Z2g7P7StructAP7StructSy ; CHECK: NoAlias: store i32 4, {{.*}} <-> store i32 1, @@ -156,10 +155,10 @@ entry: ; OPT: store i32 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !6 - %f321 = getelementptr inbounds %struct.StructS, %struct.StructS* %S, i64 0, i32 1 - store i32 4, i32* %f321, align 4, !tbaa !15 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !6 + %f321 = getelementptr inbounds %struct.StructS, ptr %S, i64 0, i32 1 + store i32 4, ptr %f321, align 4, !tbaa !15 ret i32 1 } @@ -169,7 +168,7 @@ entry: ; return A->f32; ; } ; -define i32 @_Z2g8P7StructAP7StructSy(%struct.StructA* nocapture %A, %struct.StructS* nocapture %S, i64 %count) { +define i32 @_Z2g8P7StructAP7StructSy(ptr nocapture %A, ptr nocapture %S, i64 %count) { entry: ; CHECK-LABEL: _Z2g8P7StructAP7StructSy ; CHECK: NoAlias: store i16 4, {{.*}} <-> store i32 1, @@ -178,10 +177,9 @@ entry: ; OPT: store i16 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %A, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !6 - %f16 = getelementptr inbounds %struct.StructS, %struct.StructS* %S, i64 0, i32 0 - store i16 4, i16* %f16, align 4, !tbaa !17 + %f32 = getelementptr inbounds %struct.StructA, ptr %A, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !6 + store i16 4, ptr %S, align 4, !tbaa !17 ret i32 1 } @@ -191,7 +189,7 @@ entry: ; return S->f32; ; } ; -define i32 @_Z2g9P7StructSP8StructS2y(%struct.StructS* nocapture %S, %struct.StructS2* nocapture %S2, i64 %count) { +define i32 @_Z2g9P7StructSP8StructS2y(ptr nocapture %S, ptr nocapture %S2, i64 %count) { entry: ; CHECK-LABEL: _Z2g9P7StructSP8StructS2y ; CHECK: NoAlias: store i32 4, {{.*}} <-> store i32 1, @@ -200,10 +198,10 @@ entry: ; OPT: store i32 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructS, %struct.StructS* %S, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !15 - %f321 = getelementptr inbounds %struct.StructS2, %struct.StructS2* %S2, i64 0, i32 1 - store i32 4, i32* %f321, align 4, !tbaa !18 + %f32 = getelementptr inbounds %struct.StructS, ptr %S, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !15 + %f321 = getelementptr inbounds %struct.StructS2, ptr %S2, i64 0, i32 1 + store i32 4, ptr %f321, align 4, !tbaa !18 ret i32 1 } @@ -213,7 +211,7 @@ entry: ; return S->f32; ; } ; -define i32 @_Z3g10P7StructSP8StructS2y(%struct.StructS* nocapture %S, %struct.StructS2* nocapture %S2, i64 %count) { +define i32 @_Z3g10P7StructSP8StructS2y(ptr nocapture %S, ptr nocapture %S2, i64 %count) { entry: ; CHECK-LABEL: _Z3g10P7StructSP8StructS2y ; CHECK: NoAlias: store i16 4, {{.*}} <-> store i32 1, @@ -222,10 +220,9 @@ entry: ; OPT: store i16 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructS, %struct.StructS* %S, i64 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !15 - %f16 = getelementptr inbounds %struct.StructS2, %struct.StructS2* %S2, i64 0, i32 0 - store i16 4, i16* %f16, align 4, !tbaa !20 + %f32 = getelementptr inbounds %struct.StructS, ptr %S, i64 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !15 + store i16 4, ptr %S2, align 4, !tbaa !20 ret i32 1 } @@ -235,7 +232,7 @@ entry: ; return C->b.a.f32; ; } ; -define i32 @_Z3g11P7StructCP7StructDy(%struct.StructC* nocapture %C, %struct.StructD* nocapture %D, i64 %count) { +define i32 @_Z3g11P7StructCP7StructDy(ptr nocapture %C, ptr nocapture %D, i64 %count) { entry: ; CHECK-LABEL: _Z3g11P7StructCP7StructDy ; CHECK: NoAlias: store i32 4, {{.*}} <-> store i32 1, @@ -244,10 +241,10 @@ entry: ; OPT: store i32 4, ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %f32 = getelementptr inbounds %struct.StructC, %struct.StructC* %C, i64 0, i32 1, i32 1, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !21 - %f323 = getelementptr inbounds %struct.StructD, %struct.StructD* %D, i64 0, i32 1, i32 1, i32 1 - store i32 4, i32* %f323, align 4, !tbaa !23 + %f32 = getelementptr inbounds %struct.StructC, ptr %C, i64 0, i32 1, i32 1, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !21 + %f323 = getelementptr inbounds %struct.StructD, ptr %D, i64 0, i32 1, i32 1, i32 1 + store i32 4, ptr %f323, align 4, !tbaa !23 ret i32 1 } @@ -260,7 +257,7 @@ entry: ; return b1->a.f32; ; } ; -define i32 @_Z3g12P7StructCP7StructDy(%struct.StructC* nocapture %C, %struct.StructD* nocapture %D, i64 %count) { +define i32 @_Z3g12P7StructCP7StructDy(ptr nocapture %C, ptr nocapture %D, i64 %count) { entry: ; CHECK-LABEL: _Z3g12P7StructCP7StructDy ; CHECK: MayAlias: store i32 4, {{.*}} <-> store i32 1, @@ -269,11 +266,11 @@ entry: ; OPT: store i32 4, ; OPT: %[[RET:.*]] = load i32, ; OPT: ret i32 %[[RET]] - %f32 = getelementptr inbounds %struct.StructC, %struct.StructC* %C, i64 0, i32 1, i32 1, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !10 - %f325 = getelementptr inbounds %struct.StructD, %struct.StructD* %D, i64 0, i32 1, i32 1, i32 1 - store i32 4, i32* %f325, align 4, !tbaa !10 - %0 = load i32, i32* %f32, align 4, !tbaa !10 + %f32 = getelementptr inbounds %struct.StructC, ptr %C, i64 0, i32 1, i32 1, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !10 + %f325 = getelementptr inbounds %struct.StructD, ptr %D, i64 0, i32 1, i32 1, i32 1 + store i32 4, ptr %f325, align 4, !tbaa !10 + %0 = load i32, ptr %f32, align 4, !tbaa !10 ret i32 %0 } diff --git a/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll b/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll index 6134403..942fdf5 100644 --- a/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll +++ b/llvm/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll @@ -9,355 +9,351 @@ %struct.StructC = type { i16, %struct.StructB, i32 } %struct.StructD = type { i16, %struct.StructB, i32, i8 } -define i32 @_Z1gPjP7StructAy(i32* %s, %struct.StructA* %A, i64 %count) #0 { +define i32 @_Z1gPjP7StructAy(ptr %s, ptr %A, i64 %count) #0 { entry: -; Access to i32* and &(A->f32). +; Access to ptr and &(A->f32). ; CHECK: Function -; CHECK: MayAlias: store i32 4, i32* %f32, align 4, !tbaa !8 <-> store i32 1, i32* %0, align 4, !tbaa !6 +; CHECK: MayAlias: store i32 4, ptr %f32, align 4, !tbaa !8 <-> store i32 1, ptr %0, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 -; OPT: %[[RET:.*]] = load i32, i32* +; OPT: %[[RET:.*]] = load i32, ptr ; OPT: ret i32 %[[RET]] - %s.addr = alloca i32*, align 8 - %A.addr = alloca %struct.StructA*, align 8 + %s.addr = alloca ptr, align 8 + %A.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store i32* %s, i32** %s.addr, align 8, !tbaa !0 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load i32*, i32** %s.addr, align 8, !tbaa !0 - store i32 1, i32* %0, align 4, !tbaa !6 - %1 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %1, i32 0, i32 1 - store i32 4, i32* %f32, align 4, !tbaa !8 - %2 = load i32*, i32** %s.addr, align 8, !tbaa !0 - %3 = load i32, i32* %2, align 4, !tbaa !6 + store ptr %s, ptr %s.addr, align 8, !tbaa !0 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %s.addr, align 8, !tbaa !0 + store i32 1, ptr %0, align 4, !tbaa !6 + %1 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %1, i32 0, i32 1 + store i32 4, ptr %f32, align 4, !tbaa !8 + %2 = load ptr, ptr %s.addr, align 8, !tbaa !0 + %3 = load i32, ptr %2, align 4, !tbaa !6 ret i32 %3 } -define i32 @_Z2g2PjP7StructAy(i32* %s, %struct.StructA* %A, i64 %count) #0 { +define i32 @_Z2g2PjP7StructAy(ptr %s, ptr %A, i64 %count) #0 { entry: -; Access to i32* and &(A->f16). +; Access to ptr and &(A->f16). ; CHECK: Function -; CHECK: NoAlias: store i16 4, i16* %f16, align 2, !tbaa !8 <-> store i32 1, i32* %0, align 4, !tbaa !6 +; CHECK: NoAlias: store i16 4, ptr %1, align 2, !tbaa !8 <-> store i32 1, ptr %0, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i16 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %s.addr = alloca i32*, align 8 - %A.addr = alloca %struct.StructA*, align 8 + %s.addr = alloca ptr, align 8 + %A.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store i32* %s, i32** %s.addr, align 8, !tbaa !0 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load i32*, i32** %s.addr, align 8, !tbaa !0 - store i32 1, i32* %0, align 4, !tbaa !6 - %1 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f16 = getelementptr inbounds %struct.StructA, %struct.StructA* %1, i32 0, i32 0 - store i16 4, i16* %f16, align 2, !tbaa !11 - %2 = load i32*, i32** %s.addr, align 8, !tbaa !0 - %3 = load i32, i32* %2, align 4, !tbaa !6 + store ptr %s, ptr %s.addr, align 8, !tbaa !0 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %s.addr, align 8, !tbaa !0 + store i32 1, ptr %0, align 4, !tbaa !6 + %1 = load ptr, ptr %A.addr, align 8, !tbaa !0 + store i16 4, ptr %1, align 2, !tbaa !11 + %2 = load ptr, ptr %s.addr, align 8, !tbaa !0 + %3 = load i32, ptr %2, align 4, !tbaa !6 ret i32 %3 } -define i32 @_Z2g3P7StructAP7StructBy(%struct.StructA* %A, %struct.StructB* %B, i64 %count) #0 { +define i32 @_Z2g3P7StructAP7StructBy(ptr %A, ptr %B, i64 %count) #0 { entry: ; Access to &(A->f32) and &(B->a.f32). ; CHECK: Function -; CHECK: MayAlias: store i32 4, i32* %f321, align 4, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: MayAlias: store i32 4, ptr %f321, align 4, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 -; OPT: %[[RET:.*]] = load i32, i32* +; OPT: %[[RET:.*]] = load i32, ptr ; OPT: ret i32 %[[RET]] - %A.addr = alloca %struct.StructA*, align 8 - %B.addr = alloca %struct.StructB*, align 8 + %A.addr = alloca ptr, align 8 + %B.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store %struct.StructB* %B, %struct.StructB** %B.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !8 - %1 = load %struct.StructB*, %struct.StructB** %B.addr, align 8, !tbaa !0 - %a = getelementptr inbounds %struct.StructB, %struct.StructB* %1, i32 0, i32 1 - %f321 = getelementptr inbounds %struct.StructA, %struct.StructA* %a, i32 0, i32 1 - store i32 4, i32* %f321, align 4, !tbaa !12 - %2 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f322 = getelementptr inbounds %struct.StructA, %struct.StructA* %2, i32 0, i32 1 - %3 = load i32, i32* %f322, align 4, !tbaa !8 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store ptr %B, ptr %B.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !8 + %1 = load ptr, ptr %B.addr, align 8, !tbaa !0 + %a = getelementptr inbounds %struct.StructB, ptr %1, i32 0, i32 1 + %f321 = getelementptr inbounds %struct.StructA, ptr %a, i32 0, i32 1 + store i32 4, ptr %f321, align 4, !tbaa !12 + %2 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f322 = getelementptr inbounds %struct.StructA, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f322, align 4, !tbaa !8 ret i32 %3 } -define i32 @_Z2g4P7StructAP7StructBy(%struct.StructA* %A, %struct.StructB* %B, i64 %count) #0 { +define i32 @_Z2g4P7StructAP7StructBy(ptr %A, ptr %B, i64 %count) #0 { entry: ; Access to &(A->f32) and &(B->a.f16). ; CHECK: Function -; CHECK: NoAlias: store i16 4, i16* %f16, align 2, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i16 4, ptr %a, align 2, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i16 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %A.addr = alloca %struct.StructA*, align 8 - %B.addr = alloca %struct.StructB*, align 8 + %A.addr = alloca ptr, align 8 + %B.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store %struct.StructB* %B, %struct.StructB** %B.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !8 - %1 = load %struct.StructB*, %struct.StructB** %B.addr, align 8, !tbaa !0 - %a = getelementptr inbounds %struct.StructB, %struct.StructB* %1, i32 0, i32 1 - %f16 = getelementptr inbounds %struct.StructA, %struct.StructA* %a, i32 0, i32 0 - store i16 4, i16* %f16, align 2, !tbaa !14 - %2 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructA, %struct.StructA* %2, i32 0, i32 1 - %3 = load i32, i32* %f321, align 4, !tbaa !8 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store ptr %B, ptr %B.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !8 + %1 = load ptr, ptr %B.addr, align 8, !tbaa !0 + %a = getelementptr inbounds %struct.StructB, ptr %1, i32 0, i32 1 + store i16 4, ptr %a, align 2, !tbaa !14 + %2 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructA, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f321, align 4, !tbaa !8 ret i32 %3 } -define i32 @_Z2g5P7StructAP7StructBy(%struct.StructA* %A, %struct.StructB* %B, i64 %count) #0 { +define i32 @_Z2g5P7StructAP7StructBy(ptr %A, ptr %B, i64 %count) #0 { entry: ; Access to &(A->f32) and &(B->f32). ; CHECK: Function -; CHECK: NoAlias: store i32 4, i32* %f321, align 4, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i32 4, ptr %f321, align 4, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %A.addr = alloca %struct.StructA*, align 8 - %B.addr = alloca %struct.StructB*, align 8 + %A.addr = alloca ptr, align 8 + %B.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store %struct.StructB* %B, %struct.StructB** %B.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !8 - %1 = load %struct.StructB*, %struct.StructB** %B.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructB, %struct.StructB* %1, i32 0, i32 2 - store i32 4, i32* %f321, align 4, !tbaa !15 - %2 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f322 = getelementptr inbounds %struct.StructA, %struct.StructA* %2, i32 0, i32 1 - %3 = load i32, i32* %f322, align 4, !tbaa !8 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store ptr %B, ptr %B.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !8 + %1 = load ptr, ptr %B.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructB, ptr %1, i32 0, i32 2 + store i32 4, ptr %f321, align 4, !tbaa !15 + %2 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f322 = getelementptr inbounds %struct.StructA, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f322, align 4, !tbaa !8 ret i32 %3 } -define i32 @_Z2g6P7StructAP7StructBy(%struct.StructA* %A, %struct.StructB* %B, i64 %count) #0 { +define i32 @_Z2g6P7StructAP7StructBy(ptr %A, ptr %B, i64 %count) #0 { entry: ; Access to &(A->f32) and &(B->a.f32_2). ; CHECK: Function -; CHECK: NoAlias: store i32 4, i32* %f32_2, align 4, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i32 4, ptr %f32_2, align 4, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %A.addr = alloca %struct.StructA*, align 8 - %B.addr = alloca %struct.StructB*, align 8 + %A.addr = alloca ptr, align 8 + %B.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store %struct.StructB* %B, %struct.StructB** %B.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !8 - %1 = load %struct.StructB*, %struct.StructB** %B.addr, align 8, !tbaa !0 - %a = getelementptr inbounds %struct.StructB, %struct.StructB* %1, i32 0, i32 1 - %f32_2 = getelementptr inbounds %struct.StructA, %struct.StructA* %a, i32 0, i32 3 - store i32 4, i32* %f32_2, align 4, !tbaa !16 - %2 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructA, %struct.StructA* %2, i32 0, i32 1 - %3 = load i32, i32* %f321, align 4, !tbaa !8 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store ptr %B, ptr %B.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !8 + %1 = load ptr, ptr %B.addr, align 8, !tbaa !0 + %a = getelementptr inbounds %struct.StructB, ptr %1, i32 0, i32 1 + %f32_2 = getelementptr inbounds %struct.StructA, ptr %a, i32 0, i32 3 + store i32 4, ptr %f32_2, align 4, !tbaa !16 + %2 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructA, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f321, align 4, !tbaa !8 ret i32 %3 } -define i32 @_Z2g7P7StructAP7StructSy(%struct.StructA* %A, %struct.StructS* %S, i64 %count) #0 { +define i32 @_Z2g7P7StructAP7StructSy(ptr %A, ptr %S, i64 %count) #0 { entry: ; Access to &(A->f32) and &(S->f32). ; CHECK: Function -; CHECK: NoAlias: store i32 4, i32* %f321, align 4, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i32 4, ptr %f321, align 4, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %A.addr = alloca %struct.StructA*, align 8 - %S.addr = alloca %struct.StructS*, align 8 + %A.addr = alloca ptr, align 8 + %S.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store %struct.StructS* %S, %struct.StructS** %S.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !8 - %1 = load %struct.StructS*, %struct.StructS** %S.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructS, %struct.StructS* %1, i32 0, i32 1 - store i32 4, i32* %f321, align 4, !tbaa !17 - %2 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f322 = getelementptr inbounds %struct.StructA, %struct.StructA* %2, i32 0, i32 1 - %3 = load i32, i32* %f322, align 4, !tbaa !8 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store ptr %S, ptr %S.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !8 + %1 = load ptr, ptr %S.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructS, ptr %1, i32 0, i32 1 + store i32 4, ptr %f321, align 4, !tbaa !17 + %2 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f322 = getelementptr inbounds %struct.StructA, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f322, align 4, !tbaa !8 ret i32 %3 } -define i32 @_Z2g8P7StructAP7StructSy(%struct.StructA* %A, %struct.StructS* %S, i64 %count) #0 { +define i32 @_Z2g8P7StructAP7StructSy(ptr %A, ptr %S, i64 %count) #0 { entry: ; Access to &(A->f32) and &(S->f16). ; CHECK: Function -; CHECK: NoAlias: store i16 4, i16* %f16, align 2, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i16 4, ptr %1, align 2, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i16 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %A.addr = alloca %struct.StructA*, align 8 - %S.addr = alloca %struct.StructS*, align 8 + %A.addr = alloca ptr, align 8 + %S.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructA* %A, %struct.StructA** %A.addr, align 8, !tbaa !0 - store %struct.StructS* %S, %struct.StructS** %S.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !8 - %1 = load %struct.StructS*, %struct.StructS** %S.addr, align 8, !tbaa !0 - %f16 = getelementptr inbounds %struct.StructS, %struct.StructS* %1, i32 0, i32 0 - store i16 4, i16* %f16, align 2, !tbaa !19 - %2 = load %struct.StructA*, %struct.StructA** %A.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructA, %struct.StructA* %2, i32 0, i32 1 - %3 = load i32, i32* %f321, align 4, !tbaa !8 + store ptr %A, ptr %A.addr, align 8, !tbaa !0 + store ptr %S, ptr %S.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructA, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !8 + %1 = load ptr, ptr %S.addr, align 8, !tbaa !0 + store i16 4, ptr %1, align 2, !tbaa !19 + %2 = load ptr, ptr %A.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructA, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f321, align 4, !tbaa !8 ret i32 %3 } -define i32 @_Z2g9P7StructSP8StructS2y(%struct.StructS* %S, %struct.StructS2* %S2, i64 %count) #0 { +define i32 @_Z2g9P7StructSP8StructS2y(ptr %S, ptr %S2, i64 %count) #0 { entry: ; Access to &(S->f32) and &(S2->f32). ; CHECK: Function -; CHECK: NoAlias: store i32 4, i32* %f321, align 4, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i32 4, ptr %f321, align 4, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %S.addr = alloca %struct.StructS*, align 8 - %S2.addr = alloca %struct.StructS2*, align 8 + %S.addr = alloca ptr, align 8 + %S2.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructS* %S, %struct.StructS** %S.addr, align 8, !tbaa !0 - store %struct.StructS2* %S2, %struct.StructS2** %S2.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructS*, %struct.StructS** %S.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructS, %struct.StructS* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !17 - %1 = load %struct.StructS2*, %struct.StructS2** %S2.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructS2, %struct.StructS2* %1, i32 0, i32 1 - store i32 4, i32* %f321, align 4, !tbaa !20 - %2 = load %struct.StructS*, %struct.StructS** %S.addr, align 8, !tbaa !0 - %f322 = getelementptr inbounds %struct.StructS, %struct.StructS* %2, i32 0, i32 1 - %3 = load i32, i32* %f322, align 4, !tbaa !17 + store ptr %S, ptr %S.addr, align 8, !tbaa !0 + store ptr %S2, ptr %S2.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %S.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructS, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !17 + %1 = load ptr, ptr %S2.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructS2, ptr %1, i32 0, i32 1 + store i32 4, ptr %f321, align 4, !tbaa !20 + %2 = load ptr, ptr %S.addr, align 8, !tbaa !0 + %f322 = getelementptr inbounds %struct.StructS, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f322, align 4, !tbaa !17 ret i32 %3 } -define i32 @_Z3g10P7StructSP8StructS2y(%struct.StructS* %S, %struct.StructS2* %S2, i64 %count) #0 { +define i32 @_Z3g10P7StructSP8StructS2y(ptr %S, ptr %S2, i64 %count) #0 { entry: ; Access to &(S->f32) and &(S2->f16). ; CHECK: Function -; CHECK: NoAlias: store i16 4, i16* %f16, align 2, !tbaa !10 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i16 4, ptr %1, align 2, !tbaa !10 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i16 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %S.addr = alloca %struct.StructS*, align 8 - %S2.addr = alloca %struct.StructS2*, align 8 + %S.addr = alloca ptr, align 8 + %S2.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructS* %S, %struct.StructS** %S.addr, align 8, !tbaa !0 - store %struct.StructS2* %S2, %struct.StructS2** %S2.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructS*, %struct.StructS** %S.addr, align 8, !tbaa !0 - %f32 = getelementptr inbounds %struct.StructS, %struct.StructS* %0, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !17 - %1 = load %struct.StructS2*, %struct.StructS2** %S2.addr, align 8, !tbaa !0 - %f16 = getelementptr inbounds %struct.StructS2, %struct.StructS2* %1, i32 0, i32 0 - store i16 4, i16* %f16, align 2, !tbaa !22 - %2 = load %struct.StructS*, %struct.StructS** %S.addr, align 8, !tbaa !0 - %f321 = getelementptr inbounds %struct.StructS, %struct.StructS* %2, i32 0, i32 1 - %3 = load i32, i32* %f321, align 4, !tbaa !17 + store ptr %S, ptr %S.addr, align 8, !tbaa !0 + store ptr %S2, ptr %S2.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %S.addr, align 8, !tbaa !0 + %f32 = getelementptr inbounds %struct.StructS, ptr %0, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !17 + %1 = load ptr, ptr %S2.addr, align 8, !tbaa !0 + store i16 4, ptr %1, align 2, !tbaa !22 + %2 = load ptr, ptr %S.addr, align 8, !tbaa !0 + %f321 = getelementptr inbounds %struct.StructS, ptr %2, i32 0, i32 1 + %3 = load i32, ptr %f321, align 4, !tbaa !17 ret i32 %3 } -define i32 @_Z3g11P7StructCP7StructDy(%struct.StructC* %C, %struct.StructD* %D, i64 %count) #0 { +define i32 @_Z3g11P7StructCP7StructDy(ptr %C, ptr %D, i64 %count) #0 { entry: ; Access to &(C->b.a.f32) and &(D->b.a.f32). ; CHECK: Function -; CHECK: NoAlias: store i32 4, i32* %f323, align 4, !tbaa !12 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: NoAlias: store i32 4, ptr %f323, align 4, !tbaa !12 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 ; Remove a load and propagate the value from store. ; OPT: ret i32 1 - %C.addr = alloca %struct.StructC*, align 8 - %D.addr = alloca %struct.StructD*, align 8 + %C.addr = alloca ptr, align 8 + %D.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - store %struct.StructC* %C, %struct.StructC** %C.addr, align 8, !tbaa !0 - store %struct.StructD* %D, %struct.StructD** %D.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructC*, %struct.StructC** %C.addr, align 8, !tbaa !0 - %b = getelementptr inbounds %struct.StructC, %struct.StructC* %0, i32 0, i32 1 - %a = getelementptr inbounds %struct.StructB, %struct.StructB* %b, i32 0, i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %a, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !23 - %1 = load %struct.StructD*, %struct.StructD** %D.addr, align 8, !tbaa !0 - %b1 = getelementptr inbounds %struct.StructD, %struct.StructD* %1, i32 0, i32 1 - %a2 = getelementptr inbounds %struct.StructB, %struct.StructB* %b1, i32 0, i32 1 - %f323 = getelementptr inbounds %struct.StructA, %struct.StructA* %a2, i32 0, i32 1 - store i32 4, i32* %f323, align 4, !tbaa !25 - %2 = load %struct.StructC*, %struct.StructC** %C.addr, align 8, !tbaa !0 - %b4 = getelementptr inbounds %struct.StructC, %struct.StructC* %2, i32 0, i32 1 - %a5 = getelementptr inbounds %struct.StructB, %struct.StructB* %b4, i32 0, i32 1 - %f326 = getelementptr inbounds %struct.StructA, %struct.StructA* %a5, i32 0, i32 1 - %3 = load i32, i32* %f326, align 4, !tbaa !23 + store ptr %C, ptr %C.addr, align 8, !tbaa !0 + store ptr %D, ptr %D.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %C.addr, align 8, !tbaa !0 + %b = getelementptr inbounds %struct.StructC, ptr %0, i32 0, i32 1 + %a = getelementptr inbounds %struct.StructB, ptr %b, i32 0, i32 1 + %f32 = getelementptr inbounds %struct.StructA, ptr %a, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !23 + %1 = load ptr, ptr %D.addr, align 8, !tbaa !0 + %b1 = getelementptr inbounds %struct.StructD, ptr %1, i32 0, i32 1 + %a2 = getelementptr inbounds %struct.StructB, ptr %b1, i32 0, i32 1 + %f323 = getelementptr inbounds %struct.StructA, ptr %a2, i32 0, i32 1 + store i32 4, ptr %f323, align 4, !tbaa !25 + %2 = load ptr, ptr %C.addr, align 8, !tbaa !0 + %b4 = getelementptr inbounds %struct.StructC, ptr %2, i32 0, i32 1 + %a5 = getelementptr inbounds %struct.StructB, ptr %b4, i32 0, i32 1 + %f326 = getelementptr inbounds %struct.StructA, ptr %a5, i32 0, i32 1 + %3 = load i32, ptr %f326, align 4, !tbaa !23 ret i32 %3 } -define i32 @_Z3g12P7StructCP7StructDy(%struct.StructC* %C, %struct.StructD* %D, i64 %count) #0 { +define i32 @_Z3g12P7StructCP7StructDy(ptr %C, ptr %D, i64 %count) #0 { entry: ; Access to &(b1->a.f32) and &(b2->a.f32). ; CHECK: Function -; CHECK: MayAlias: store i32 4, i32* %f325, align 4, !tbaa !6 <-> store i32 1, i32* %f32, align 4, !tbaa !6 +; CHECK: MayAlias: store i32 4, ptr %f325, align 4, !tbaa !6 <-> store i32 1, ptr %f32, align 4, !tbaa !6 ; OPT: define ; OPT: store i32 1 ; OPT: store i32 4 -; OPT: %[[RET:.*]] = load i32, i32* +; OPT: %[[RET:.*]] = load i32, ptr ; OPT: ret i32 %[[RET]] - %C.addr = alloca %struct.StructC*, align 8 - %D.addr = alloca %struct.StructD*, align 8 + %C.addr = alloca ptr, align 8 + %D.addr = alloca ptr, align 8 %count.addr = alloca i64, align 8 - %b1 = alloca %struct.StructB*, align 8 - %b2 = alloca %struct.StructB*, align 8 - store %struct.StructC* %C, %struct.StructC** %C.addr, align 8, !tbaa !0 - store %struct.StructD* %D, %struct.StructD** %D.addr, align 8, !tbaa !0 - store i64 %count, i64* %count.addr, align 8, !tbaa !4 - %0 = load %struct.StructC*, %struct.StructC** %C.addr, align 8, !tbaa !0 - %b = getelementptr inbounds %struct.StructC, %struct.StructC* %0, i32 0, i32 1 - store %struct.StructB* %b, %struct.StructB** %b1, align 8, !tbaa !0 - %1 = load %struct.StructD*, %struct.StructD** %D.addr, align 8, !tbaa !0 - %b3 = getelementptr inbounds %struct.StructD, %struct.StructD* %1, i32 0, i32 1 - store %struct.StructB* %b3, %struct.StructB** %b2, align 8, !tbaa !0 - %2 = load %struct.StructB*, %struct.StructB** %b1, align 8, !tbaa !0 - %a = getelementptr inbounds %struct.StructB, %struct.StructB* %2, i32 0, i32 1 - %f32 = getelementptr inbounds %struct.StructA, %struct.StructA* %a, i32 0, i32 1 - store i32 1, i32* %f32, align 4, !tbaa !12 - %3 = load %struct.StructB*, %struct.StructB** %b2, align 8, !tbaa !0 - %a4 = getelementptr inbounds %struct.StructB, %struct.StructB* %3, i32 0, i32 1 - %f325 = getelementptr inbounds %struct.StructA, %struct.StructA* %a4, i32 0, i32 1 - store i32 4, i32* %f325, align 4, !tbaa !12 - %4 = load %struct.StructB*, %struct.StructB** %b1, align 8, !tbaa !0 - %a6 = getelementptr inbounds %struct.StructB, %struct.StructB* %4, i32 0, i32 1 - %f327 = getelementptr inbounds %struct.StructA, %struct.StructA* %a6, i32 0, i32 1 - %5 = load i32, i32* %f327, align 4, !tbaa !12 + %b1 = alloca ptr, align 8 + %b2 = alloca ptr, align 8 + store ptr %C, ptr %C.addr, align 8, !tbaa !0 + store ptr %D, ptr %D.addr, align 8, !tbaa !0 + store i64 %count, ptr %count.addr, align 8, !tbaa !4 + %0 = load ptr, ptr %C.addr, align 8, !tbaa !0 + %b = getelementptr inbounds %struct.StructC, ptr %0, i32 0, i32 1 + store ptr %b, ptr %b1, align 8, !tbaa !0 + %1 = load ptr, ptr %D.addr, align 8, !tbaa !0 + %b3 = getelementptr inbounds %struct.StructD, ptr %1, i32 0, i32 1 + store ptr %b3, ptr %b2, align 8, !tbaa !0 + %2 = load ptr, ptr %b1, align 8, !tbaa !0 + %a = getelementptr inbounds %struct.StructB, ptr %2, i32 0, i32 1 + %f32 = getelementptr inbounds %struct.StructA, ptr %a, i32 0, i32 1 + store i32 1, ptr %f32, align 4, !tbaa !12 + %3 = load ptr, ptr %b2, align 8, !tbaa !0 + %a4 = getelementptr inbounds %struct.StructB, ptr %3, i32 0, i32 1 + %f325 = getelementptr inbounds %struct.StructA, ptr %a4, i32 0, i32 1 + store i32 4, ptr %f325, align 4, !tbaa !12 + %4 = load ptr, ptr %b1, align 8, !tbaa !0 + %a6 = getelementptr inbounds %struct.StructB, ptr %4, i32 0, i32 1 + %f327 = getelementptr inbounds %struct.StructA, ptr %a6, i32 0, i32 1 + %5 = load i32, ptr %f327, align 4, !tbaa !12 ret i32 %5 } -- 2.7.4