; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -disable-output 2>/dev/null
; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
-define void @test({[2 x i32],[2 x i32]}* %A, i64 %X, i64 %Y) {
- %P1 = getelementptr {[2 x i32],[2 x i32]}, {[2 x i32],[2 x i32]}* %A, i64 0, i32 0, i64 %X
- %P2 = getelementptr {[2 x i32],[2 x i32]}, {[2 x i32],[2 x i32]}* %A, i64 0, i32 1, i64 %Y
+define void @test(ptr %A, i64 %X, i64 %Y) {
+ %P1 = getelementptr {[2 x i32],[2 x i32]}, ptr %A, i64 0, i32 0, i64 %X
+ %P2 = getelementptr {[2 x i32],[2 x i32]}, ptr %A, i64 0, i32 1, i64 %Y
ret void
}
; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
-define i32 @test(i32 *%Ptr, i64 %V) {
+define i32 @test(ptr %Ptr, i64 %V) {
; CHECK: sub i32 %X, %Y
- %P2 = getelementptr i32, i32* %Ptr, i64 1
- %P1 = getelementptr i32, i32* %Ptr, i64 %V
- %X = load i32, i32* %P1
- store i32 5, i32* %P2
- %Y = load i32, i32* %P1
+ %P2 = getelementptr i32, ptr %Ptr, i64 1
+ %P1 = getelementptr i32, ptr %Ptr, i64 %V
+ %X = load i32, ptr %P1
+ store i32 5, ptr %P2
+ %Y = load i32, ptr %P1
%Z = sub i32 %X, %Y
ret i32 %Z
}
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -disable-output 2>/dev/null
; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
-define void @test([17 x i16]* %mask_bits) {
- %P1 = getelementptr [17 x i16], [17 x i16]* %mask_bits, i64 0, i64 0
- %P2 = getelementptr [17 x i16], [17 x i16]* %mask_bits, i64 252645134, i64 0
+define void @test(ptr %mask_bits) {
+ %P2 = getelementptr [17 x i16], ptr %mask_bits, i64 252645134, i64 0
ret void
}
; RUN: opt < %s -aa-pipeline=basic-aa -passes=licm -disable-output
- %struct..apr_array_header_t = type { i32*, i32, i32, i32, i8* }
+ %struct..apr_array_header_t = type { ptr, i32, i32, i32, ptr }
%struct..apr_table_t = type { %struct..apr_array_header_t, i32, [32 x i32], [32 x i32] }
-define void @table_reindex(%struct..apr_table_t* %t.1) { ; No predecessors!
+define void @table_reindex(ptr %t.1) { ; No predecessors!
br label %loopentry
loopentry: ; preds = %0, %no_exit
- %tmp.101 = getelementptr %struct..apr_table_t, %struct..apr_table_t* %t.1, i64 0, i32 0, i32 2
- %tmp.11 = load i32, i32* %tmp.101 ; <i32> [#uses=0]
+ %tmp.101 = getelementptr %struct..apr_table_t, ptr %t.1, i64 0, i32 0, i32 2
+ %tmp.11 = load i32, ptr %tmp.101 ; <i32> [#uses=0]
br i1 false, label %no_exit, label %UnifiedExitNode
no_exit: ; preds = %loopentry
%tmp.25 = sext i32 0 to i64 ; <i64> [#uses=1]
- %tmp.261 = getelementptr %struct..apr_table_t, %struct..apr_table_t* %t.1, i64 0, i32 3, i64 %tmp.25 ; <i32*> [#uses=1]
- store i32 0, i32* %tmp.261
+ %tmp.261 = getelementptr %struct..apr_table_t, ptr %t.1, i64 0, i32 3, i64 %tmp.25 ; <ptr> [#uses=1]
+ store i32 0, ptr %tmp.261
br label %loopentry
UnifiedExitNode: ; preds = %loopentry
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -disable-output 2>/dev/null
-define i32 @MTConcat([3 x i32]* %a.1) {
- %tmp.961 = getelementptr [3 x i32], [3 x i32]* %a.1, i64 0, i64 4
- %tmp.97 = load i32, i32* %tmp.961
- %tmp.119 = getelementptr [3 x i32], [3 x i32]* %a.1, i64 1, i64 0
- %tmp.120 = load i32, i32* %tmp.119
- %tmp.1541 = getelementptr [3 x i32], [3 x i32]* %a.1, i64 0, i64 4
- %tmp.155 = load i32, i32* %tmp.1541
+define i32 @MTConcat(ptr %a.1) {
+ %tmp.961 = getelementptr [3 x i32], ptr %a.1, i64 0, i64 4
+ %tmp.97 = load i32, ptr %tmp.961
+ %tmp.119 = getelementptr [3 x i32], ptr %a.1, i64 1, i64 0
+ %tmp.120 = load i32, ptr %tmp.119
+ %tmp.1541 = getelementptr [3 x i32], ptr %a.1, i64 0, i64 4
+ %tmp.155 = load i32, ptr %tmp.1541
ret i32 0
}
%struct..RefRect = type { %struct..RefPoint, %struct..RefPoint }
define i32 @BMT_CommitPartDrawObj() {
- %tmp.19111 = getelementptr %struct..RefRect, %struct..RefRect* null, i64 0, i32 0, i32 1, i32 2
- %tmp.20311 = getelementptr %struct..RefRect, %struct..RefRect* null, i64 0, i32 1, i32 1, i32 2
+ %tmp.19111 = getelementptr %struct..RefRect, ptr null, i64 0, i32 0, i32 1, i32 2
+ %tmp.20311 = getelementptr %struct..RefRect, ptr null, i64 0, i32 1, i32 1, i32 2
ret i32 0
}
; CHECK: define i32 @test
; CHECK-NEXT: ret i32 0
-define i32 @test(i32* %P) {
+define i32 @test(ptr %P) {
%X = alloca i32
- %V1 = load i32, i32* %P
- store i32 0, i32* %X
- %V2 = load i32, i32* %P
+ %V1 = load i32, ptr %P
+ store i32 0, ptr %X
+ %V2 = load i32, ptr %P
%Diff = sub i32 %V1, %V2
ret i32 %Diff
}
; CHECK: Function: test
; CHECK-NOT: MayAlias:
-define void @test(%T* %P) {
- %A = getelementptr %T, %T* %P, i64 0
- %B = getelementptr %T, %T* %P, i64 0, i32 0
- %C = getelementptr %T, %T* %P, i64 0, i32 1
- %D = getelementptr %T, %T* %P, i64 0, i32 1, i64 0
- %E = getelementptr %T, %T* %P, i64 0, i32 1, i64 5
+define void @test(ptr %P) {
+ %C = getelementptr %T, ptr %P, i64 0, i32 1
+ %D = getelementptr %T, ptr %P, i64 0, i32 1, i64 0
+ %E = getelementptr %T, ptr %P, i64 0, i32 1, i64 5
ret void
}
; CHECK-NOT: MayAlias:
define void @test() {
- %D = getelementptr %T, %T* @G, i64 0, i32 0
- %E = getelementptr %T, %T* @G, i64 0, i32 1, i64 5
- %F = getelementptr i32, i32* getelementptr (%T, %T* @G, i64 0, i32 0), i64 0
- %X = getelementptr [10 x i8], [10 x i8]* getelementptr (%T, %T* @G, i64 0, i32 1), i64 0, i64 5
+ %E = getelementptr %T, ptr @G, i64 0, i32 1, i64 5
+ %X = getelementptr [10 x i8], ptr getelementptr (%T, ptr @G, i64 0, i32 1), i64 0, i64 5
ret void
}
define void @test(i32 %N) {
entry:
- %X = alloca [3 x [3 x i32]] ; <[3 x [3 x i32]]*> [#uses=4]
+ %X = alloca [3 x [3 x i32]] ; <ptr> [#uses=4]
%tmp.24 = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
br i1 %tmp.24, label %no_exit, label %loopexit
no_exit: ; preds = %no_exit, %entry
%i.0.0 = phi i32 [ 0, %entry ], [ %inc, %no_exit ] ; <i32> [#uses=2]
- %tmp.6 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
- store i32 1, i32* %tmp.6
- %tmp.8 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
- %tmp.9 = load i32, i32* %tmp.8 ; <i32> [#uses=1]
- %tmp.11 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
- %tmp.12 = load i32, i32* %tmp.11 ; <i32> [#uses=1]
+ %tmp.6 = getelementptr [3 x [3 x i32]], ptr %X, i32 0, i32 0, i32 %i.0.0 ; <ptr> [#uses=1]
+ store i32 1, ptr %tmp.6
+ %tmp.8 = getelementptr [3 x [3 x i32]], ptr %X, i32 0, i32 0, i32 0 ; <ptr> [#uses=1]
+ %tmp.9 = load i32, ptr %tmp.8 ; <i32> [#uses=1]
+ %tmp.11 = getelementptr [3 x [3 x i32]], ptr %X, i32 0, i32 1, i32 0 ; <ptr> [#uses=1]
+ %tmp.12 = load i32, ptr %tmp.11 ; <i32> [#uses=1]
%tmp.13 = add i32 %tmp.12, %tmp.9 ; <i32> [#uses=1]
%inc = add i32 %i.0.0, 1 ; <i32> [#uses=2]
%tmp.2 = icmp slt i32 %inc, %N ; <i1> [#uses=1]
loopexit: ; preds = %no_exit, %entry
%Y.0.1 = phi i32 [ 0, %entry ], [ %tmp.13, %no_exit ] ; <i32> [#uses=1]
- %tmp.4 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0 ; <[3 x i32]*> [#uses=1]
- load [3 x i32], [3 x i32]* %tmp.4
- %tmp.15 = call i32 (...) @foo( [3 x i32]* %tmp.4, i32 %Y.0.1 ) ; <i32> [#uses=0]
+ %tmp.4 = getelementptr [3 x [3 x i32]], ptr %X, i32 0, i32 0 ; <ptr> [#uses=1]
+ load [3 x i32], ptr %tmp.4
+ %tmp.15 = call i32 (...) @foo( ptr %tmp.4, i32 %Y.0.1 ) ; <i32> [#uses=0]
ret void
}
ret void
cond_false277.i: ; preds = %bb239.i
- %tmp1062.i = getelementptr [2 x <4 x i32>], [2 x <4 x i32>]* null, i32 0, i32 1 ; <<4 x i32>*> [#uses=1]
- store <4 x i32> zeroinitializer, <4 x i32>* %tmp1062.i
+ %tmp1062.i = getelementptr [2 x <4 x i32>], ptr null, i32 0, i32 1 ; <ptr> [#uses=1]
+ store <4 x i32> zeroinitializer, ptr %tmp1062.i
br i1 false, label %cond_true1032.i, label %cond_false1063.i85
bb917.i: ; preds = %bb205.i
ret void
cond_true1032.i: ; preds = %cond_false277.i
- %tmp1187.i = getelementptr [2 x <4 x i32>], [2 x <4 x i32>]* null, i32 0, i32 0, i32 7 ; <i32*> [#uses=1]
- store i32 0, i32* %tmp1187.i
+ %tmp1187.i = getelementptr [2 x <4 x i32>], ptr null, i32 0, i32 0, i32 7 ; <ptr> [#uses=1]
+ store i32 0, ptr %tmp1187.i
br label %bb2037.i
cond_false1063.i85: ; preds = %cond_false277.i
%struct.FIRST_UNION = type { %struct.FILE_POS }
%struct.FOURTH_UNION = type { %struct.CONSTRAINT }
%struct.GAP = type { i8, i8, i16 }
- %struct.LIST = type { %struct.rec*, %struct.rec* }
+ %struct.LIST = type { ptr, ptr }
%struct.SECOND_UNION = type { { i16, i8, i8 } }
%struct.STYLE = type { { %struct.GAP }, { %struct.GAP }, i16, i16, i16, i8, i8 }
%struct.THIRD_UNION = type { { [2 x i32], [2 x i32] } }
- %struct.closure_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* } }
- %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* }, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, i32 }
+ %struct.closure_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, ptr, { ptr } }
+ %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, ptr, { ptr }, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.rec = type { %struct.head_type }
; CHECK: define i32 @test
; CHECK: %Z = sub i32 %A, %Q
; CHECK: ret i32 %Z
-define i32 @test(%struct.closure_type* %tmp18169) {
- %tmp18174 = getelementptr %struct.closure_type, %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <i32*> [#uses=2]
- %tmp18269 = bitcast i32* %tmp18174 to %struct.STYLE* ; <%struct.STYLE*> [#uses=1]
- %A = load i32, i32* %tmp18174 ; <i32> [#uses=1]
+define i32 @test(ptr %tmp18169) {
+ %tmp18174 = getelementptr %struct.closure_type, ptr %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <ptr> [#uses=2]
+ %A = load i32, ptr %tmp18174 ; <i32> [#uses=1]
- %tmp18272 = getelementptr %struct.STYLE, %struct.STYLE* %tmp18269, i32 0, i32 0, i32 0, i32 2 ; <i16*> [#uses=1]
- store i16 123, i16* %tmp18272
+ %tmp18272 = getelementptr %struct.STYLE, ptr %tmp18174, i32 0, i32 0, i32 0, i32 2 ; <ptr> [#uses=1]
+ store i16 123, ptr %tmp18272
- %Q = load i32, i32* %tmp18174 ; <i32> [#uses=1]
+ %Q = load i32, ptr %tmp18174 ; <i32> [#uses=1]
%Z = sub i32 %A, %Q ; <i32> [#uses=1]
ret i32 %Z
}
; CHECK: Function: foo
; CHECK: MayAlias: i32* %x, i32* %y
-define void @foo(i32* noalias %x) {
- %y = call i32* @unclear(i32* %x)
- store i32 0, i32* %x
- store i32 0, i32* %y
+define void @foo(ptr noalias %x) {
+ %y = call ptr @unclear(ptr %x)
+ store i32 0, ptr %x
+ store i32 0, ptr %y
ret void
}
-declare i32* @unclear(i32* %a)
+declare ptr @unclear(ptr %a)
; CHECK: 9 no alias responses
; CHECK: 6 may alias responses
-define void @foo(i32* noalias %p, i32* noalias %q, i32 %i, i32 %j) {
- %Ipointer = getelementptr i32, i32* %p, i32 %i
- %qi = getelementptr i32, i32* %q, i32 %i
- %Jpointer = getelementptr i32, i32* %p, i32 %j
- %qj = getelementptr i32, i32* %q, i32 %j
- store i32 0, i32* %p
- store i32 0, i32* %Ipointer
- store i32 0, i32* %Jpointer
- store i32 0, i32* %q
- store i32 0, i32* %qi
- store i32 0, i32* %qj
+define void @foo(ptr noalias %p, ptr noalias %q, i32 %i, i32 %j) {
+ %Ipointer = getelementptr i32, ptr %p, i32 %i
+ %qi = getelementptr i32, ptr %q, i32 %i
+ %Jpointer = getelementptr i32, ptr %p, i32 %j
+ %qj = getelementptr i32, ptr %q, i32 %j
+ store i32 0, ptr %p
+ store i32 0, ptr %Ipointer
+ store i32 0, ptr %Jpointer
+ store i32 0, ptr %q
+ store i32 0, ptr %qi
+ store i32 0, ptr %qj
ret void
}
declare i16 @llvm.cttz.i16(i16, i1)
-define i32 @test(i32* %P, i16* %Q) {
+define i32 @test(ptr %P, ptr %Q) {
; CHECK: ret i32 0
- %A = load i16, i16* %Q ; <i16> [#uses=1]
- %x = load i32, i32* %P ; <i32> [#uses=1]
+ %A = load i16, ptr %Q ; <i16> [#uses=1]
+ %x = load i32, ptr %P ; <i32> [#uses=1]
%B = call i16 @llvm.cttz.i16( i16 %A, i1 true ) ; <i16> [#uses=1]
- %y = load i32, i32* %P ; <i32> [#uses=1]
- store i16 %B, i16* %Q
+ %y = load i32, ptr %P ; <i32> [#uses=1]
+ store i16 %B, ptr %Q
%z = sub i32 %x, %y ; <i32> [#uses=1]
ret i32 %z
}
%struct.A = type { i32 }
%struct.B = type { %struct.A }
-@a = global %struct.B zeroinitializer ; <%struct.B*> [#uses=2]
+@a = global %struct.B zeroinitializer ; <ptr> [#uses=2]
-define i32 @_Z3fooP1A(%struct.A* %b) {
+define i32 @_Z3fooP1A(ptr %b) {
; CHECK: %tmp7 = load
; CHECK: ret i32 %tmp7
entry:
- store i32 1, i32* getelementptr (%struct.B, %struct.B* @a, i32 0, i32 0, i32 0), align 8
- %tmp4 = getelementptr %struct.A, %struct.A* %b, i32 0, i32 0 ;<i32*> [#uses=1]
- store i32 0, i32* %tmp4, align 4
- %tmp7 = load i32, i32* getelementptr (%struct.B, %struct.B* @a, i32 0, i32 0, i32 0), align 8 ; <i32> [#uses=1]
+ store i32 1, ptr @a, align 8
+ %tmp4 = getelementptr %struct.A, ptr %b, i32 0, i32 0 ;<ptr> [#uses=1]
+ store i32 0, ptr %tmp4, align 4
+ %tmp7 = load i32, ptr @a, align 8 ; <i32> [#uses=1]
ret i32 %tmp7
}
target triple = "x86_64-unknown-linux-gnu"
%struct.device = type { [20 x i8] }
%struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 }
- %struct.usb_bus = type { %struct.device* }
+ %struct.usb_bus = type { ptr }
%struct.usb_hcd = type { %struct.usb_bus, i64, [0 x i64] }
@uhci_pci_ids = constant [1 x %struct.pci_device_id] zeroinitializer
-@__mod_pci_device_table = alias [1 x %struct.pci_device_id], [1 x %struct.pci_device_id]* @uhci_pci_ids
- ; <[1 x %struct.pci_device_id]*> [#uses=0]
+@__mod_pci_device_table = alias [1 x %struct.pci_device_id], ptr @uhci_pci_ids
+ ; <ptr> [#uses=0]
-define i32 @uhci_suspend(%struct.usb_hcd* %hcd) {
+define i32 @uhci_suspend(ptr %hcd) {
entry:
- %tmp17 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 2, i64 1
- ; <i64*> [#uses=1]
- %tmp1718 = bitcast i64* %tmp17 to i32* ; <i32*> [#uses=1]
- %tmp19 = load i32, i32* %tmp1718, align 4 ; <i32> [#uses=0]
+ %tmp17 = getelementptr %struct.usb_hcd, ptr %hcd, i32 0, i32 2, i64 1
+ ; <ptr> [#uses=1]
+ %tmp19 = load i32, ptr %tmp17, align 4 ; <i32> [#uses=0]
br i1 false, label %cond_true34, label %done_okay
cond_true34: ; preds = %entry
- %tmp631 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 2, i64
-2305843009213693950 ; <i64*> [#uses=1]
- %tmp70 = bitcast i64* %tmp631 to %struct.device**
+ %tmp631 = getelementptr %struct.usb_hcd, ptr %hcd, i32 0, i32 2, i64
+2305843009213693950 ; <ptr> [#uses=1]
- %tmp71 = load %struct.device*, %struct.device** %tmp70, align 8
+ %tmp71 = load ptr, ptr %tmp631, align 8
ret i32 undef
target triple = "x86_64-unknown-linux-gnu"
%struct.device = type { [20 x i8] }
%struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 }
- %struct.usb_bus = type { %struct.device* }
+ %struct.usb_bus = type { ptr }
%struct.usb_hcd = type { %struct.usb_bus, [0 x i64] }
@pci_ids = constant [1 x %struct.pci_device_id] zeroinitializer
-@__mod_pci_device_table = alias [1 x %struct.pci_device_id], [1 x %struct.pci_device_id]* @pci_ids ; <[1 x %struct.pci_device_id]*> [#uses=0]
+@__mod_pci_device_table = alias [1 x %struct.pci_device_id], ptr @pci_ids ; <ptr> [#uses=0]
-define i32 @ehci_pci_setup(%struct.usb_hcd* %hcd) {
+define i32 @ehci_pci_setup(ptr %hcd) {
entry:
- %tmp14 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 0, i32 0 ; <%struct.device**> [#uses=1]
- %tmp15 = load %struct.device*, %struct.device** %tmp14, align 8 ; <%struct.device*> [#uses=0]
+ %tmp14 = getelementptr %struct.usb_hcd, ptr %hcd, i32 0, i32 0, i32 0 ; <ptr> [#uses=1]
+ %tmp15 = load ptr, ptr %tmp14, align 8 ; <ptr> [#uses=0]
br i1 false, label %bb25, label %return
bb25: ; preds = %entry
br i1 false, label %cond_true, label %return
cond_true: ; preds = %bb25
- %tmp601 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 1, i64 2305843009213693951 ; <i64*> [#uses=1]
- %tmp67 = bitcast i64* %tmp601 to %struct.device** ; <%struct.device**> [#uses=1]
- %tmp68 = load %struct.device*, %struct.device** %tmp67, align 8 ; <%struct.device*> [#uses=0]
+ %tmp601 = getelementptr %struct.usb_hcd, ptr %hcd, i32 0, i32 1, i64 2305843009213693951 ; <ptr> [#uses=1]
+ %tmp68 = load ptr, ptr %tmp601, align 8 ; <ptr> [#uses=0]
ret i32 undef
return: ; preds = %bb25, %entry
target triple = "i686-pc-linux-gnu"
%struct.S291 = type <{ %union.anon, i32 }>
%union.anon = type { }
-@a291 = external global [5 x %struct.S291] ; <[5 x %struct.S291]*> [#uses=2]
+@a291 = external global [5 x %struct.S291] ; <ptr> [#uses=2]
define void @test291() nounwind {
entry:
- store i32 1138410269, i32* getelementptr ([5 x %struct.S291], [5 x %struct.S291]* @a291, i32 0, i32 2, i32 1)
- %tmp54 = load i32, i32* bitcast (%struct.S291* getelementptr ([5 x %struct.S291], [5 x %struct.S291]* @a291, i32 0, i32 2) to i32*), align 4 ; <i32> [#uses=0]
+ store i32 1138410269, ptr getelementptr ([5 x %struct.S291], ptr @a291, i32 0, i32 2, i32 1)
+ %tmp54 = load i32, ptr getelementptr ([5 x %struct.S291], ptr @a291, i32 0, i32 2), align 4 ; <i32> [#uses=0]
unreachable
}
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -disable-output 2>&1 | FileCheck %s
-declare noalias i32* @_Znwj(i32 %x) nounwind
+declare noalias ptr @_Znwj(i32 %x) nounwind
; CHECK: 1 no alias response
define i32 @foo() {
- %A = call i32* @_Znwj(i32 4)
- %B = call i32* @_Znwj(i32 4)
- store i32 1, i32* %A
- store i32 2, i32* %B
- %C = load i32, i32* %A
+ %A = call ptr @_Znwj(i32 4)
+ %B = call ptr @_Znwj(i32 4)
+ store i32 1, ptr %A
+ store i32 2, ptr %B
+ %C = load i32, ptr %A
ret i32 %C
}
; RUN: opt -aa-pipeline=basic-aa -passes=gvn,instcombine -S < %s | FileCheck %s
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
-define i8 @foo(i8* %ptr) {
- %P = getelementptr i8, i8* %ptr, i32 0
- %Q = getelementptr i8, i8* %ptr, i32 1
+define i8 @foo(ptr %ptr) {
+ %Q = getelementptr i8, ptr %ptr, i32 1
; CHECK: getelementptr
- %X = load i8, i8* %P
- %Y = atomicrmw add i8* %Q, i8 1 monotonic
- %Z = load i8, i8* %P
+ %X = load i8, ptr %ptr
+ %Y = atomicrmw add ptr %Q, i8 1 monotonic
+ %Z = load i8, ptr %ptr
; CHECK-NOT: = load
%A = sub i8 %X, %Z
ret i8 %A
br i1 %tmp, label %bb, label %bb1
bb:
- %b = getelementptr i32, i32* %a, i32 0
br label %bb2
bb1:
br label %bb2
bb2:
- %P = phi i32* [ %b, %bb ], [ @Y, %bb1 ]
- %tmp1 = load i32, i32* @Z, align 4
- store i32 123, i32* %P, align 4
- %tmp2 = load i32, i32* @Z, align 4
+ %P = phi ptr [ %a, %bb ], [ @Y, %bb1 ]
+ %tmp1 = load i32, ptr @Z, align 4
+ store i32 123, ptr %P, align 4
+ %tmp2 = load i32, ptr @Z, align 4
br label %return
return:
; CHECK: 1 may alias responses
-define i32 @test(i32* %tab, i32 %indvar) nounwind {
+define i32 @test(ptr %tab, i32 %indvar) nounwind {
%tmp31 = mul i32 %indvar, -2
%tmp32 = add i32 %tmp31, 30
- %t.5 = getelementptr i32, i32* %tab, i32 %tmp32
- %loada = load i32, i32* %tab
- store i32 0, i32* %t.5
- %loadb = load i32, i32* %tab
+ %t.5 = getelementptr i32, ptr %tab, i32 %tmp32
+ %loada = load i32, ptr %tab
+ store i32 0, ptr %t.5
+ %loadb = load i32, ptr %tab
%rval = add i32 %loada, %loadb
ret i32 %rval
}
define i32 @main() {
%t = alloca %struct.foo, align 4
- %1 = getelementptr inbounds %struct.foo, %struct.foo* %t, i32 0, i32 0
- store i32 1, i32* %1, align 4
- %2 = getelementptr inbounds %struct.foo, %struct.foo* %t, i64 1
- %3 = bitcast %struct.foo* %2 to i8*
- %4 = getelementptr inbounds i8, i8* %3, i32 -1
- store i8 0, i8* %4
- %5 = getelementptr inbounds i8, i8* %4, i32 -1
- store i8 0, i8* %5
- %6 = getelementptr inbounds i8, i8* %5, i32 -1
- store i8 0, i8* %6
- %7 = getelementptr inbounds i8, i8* %6, i32 -1
- store i8 0, i8* %7
- %8 = getelementptr inbounds i8, i8* %7, i32 -1
- store i8 0, i8* %8
- %9 = getelementptr inbounds i8, i8* %8, i32 -1
- store i8 0, i8* %9
- %10 = getelementptr inbounds i8, i8* %9, i32 -1
- store i8 0, i8* %10
- %11 = getelementptr inbounds i8, i8* %10, i32 -1
- store i8 0, i8* %11
- %12 = load i32, i32* %1, align 4
- ret i32 %12
-; CHECK: ret i32 %12
+ store i32 1, ptr %t, align 4
+ %1 = getelementptr inbounds %struct.foo, ptr %t, i64 1
+ %2 = getelementptr inbounds i8, ptr %1, i32 -1
+ store i8 0, ptr %2
+ %3 = getelementptr inbounds i8, ptr %2, i32 -1
+ store i8 0, ptr %3
+ %4 = getelementptr inbounds i8, ptr %3, i32 -1
+ store i8 0, ptr %4
+ %5 = getelementptr inbounds i8, ptr %4, i32 -1
+ store i8 0, ptr %5
+ %6 = getelementptr inbounds i8, ptr %5, i32 -1
+ store i8 0, ptr %6
+ %7 = getelementptr inbounds i8, ptr %6, i32 -1
+ store i8 0, ptr %7
+ %8 = getelementptr inbounds i8, ptr %7, i32 -1
+ store i8 0, ptr %8
+ %9 = getelementptr inbounds i8, ptr %8, i32 -1
+ store i8 0, ptr %9
+ %10 = load i32, ptr %t, align 4
+ ret i32 %10
+; CHECK: ret i32 %10
}
define i32 @main() nounwind uwtable ssp {
entry:
- %tmp = load i8, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }, { i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
+ %tmp = load i8, ptr getelementptr inbounds ({ i8, i8, i8, i8, i8 }, ptr @a, i64 0, i32 4), align 4
%tmp1 = or i8 %tmp, -128
- store i8 %tmp1, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }, { i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
- %tmp2 = load i64, i64* bitcast ({ i8, i8, i8, i8, i8 }* @a to i64*), align 8
- store i8 11, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }, { i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
+ store i8 %tmp1, ptr getelementptr inbounds ({ i8, i8, i8, i8, i8 }, ptr @a, i64 0, i32 4), align 4
+ %tmp2 = load i64, ptr @a, align 8
+ store i8 11, ptr getelementptr inbounds ({ i8, i8, i8, i8, i8 }, ptr @a, i64 0, i32 4), align 4
%tmp3 = trunc i64 %tmp2 to i32
ret i32 %tmp3
%idxprom = zext i32 undef to i64
%add4 = add i32 0, 1
%idxprom5 = zext i32 %add4 to i64
- %arrayidx6 = getelementptr inbounds i32, i32* @c, i64 %idxprom5
- %arrayidx = getelementptr inbounds i32, i32* @c, i64 %idxprom
- load i32, i32* %arrayidx
- load i32, i32* %arrayidx6
+ %arrayidx6 = getelementptr inbounds i32, ptr @c, i64 %idxprom5
+ %arrayidx = getelementptr inbounds i32, ptr @c, i64 %idxprom
+ load i32, ptr %arrayidx
+ load i32, ptr %arrayidx6
ret void
}
; CHECK: NoAlias: i32* %arrayidx14, i32* %out
; CHECK: MayAlias: i32* %arrayidx14, i32* %arrayidx8
; CHECK: MayAlias: i32* %arrayidx11, i32* %arrayidx14
-define void @compute1(i32 %num.0.lcssa, i32* %out) {
+define void @compute1(i32 %num.0.lcssa, ptr %out) {
%idxprom = zext i32 %num.0.lcssa to i64
- %arrayidx8 = getelementptr inbounds i32, i32* %out, i64 %idxprom
+ %arrayidx8 = getelementptr inbounds i32, ptr %out, i64 %idxprom
%add9 = or i32 %num.0.lcssa, 1
%idxprom10 = zext i32 %add9 to i64
- %arrayidx11 = getelementptr inbounds i32, i32* %out, i64 %idxprom10
+ %arrayidx11 = getelementptr inbounds i32, ptr %out, i64 %idxprom10
%add12 = or i32 %num.0.lcssa, 2
%idxprom13 = zext i32 %add12 to i64
- %arrayidx14 = getelementptr inbounds i32, i32* %out, i64 %idxprom13
- load i32, i32* %out
- load i32, i32* %arrayidx8
- load i32, i32* %arrayidx11
- load i32, i32* %arrayidx14
+ %arrayidx14 = getelementptr inbounds i32, ptr %out, i64 %idxprom13
+ load i32, ptr %out
+ load i32, ptr %arrayidx8
+ load i32, ptr %arrayidx11
+ load i32, ptr %arrayidx14
ret void
}
; CHECK-LABEL: compute2
; CHECK: MayAlias: i32* %arrayidx11, i32* %out.addr
-define void @compute2(i32 %num, i32* %out.addr) {
+define void @compute2(i32 %num, ptr %out.addr) {
%add9 = add i32 %num, 1
%idxprom10 = zext i32 %add9 to i64
- %arrayidx11 = getelementptr inbounds i32, i32* %out.addr, i64 %idxprom10
- load i32, i32* %out.addr
- load i32, i32* %arrayidx11
+ %arrayidx11 = getelementptr inbounds i32, ptr %out.addr, i64 %idxprom10
+ load i32, ptr %out.addr
+ load i32, ptr %arrayidx11
ret void
}
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-apple-darwin8"
%struct.x = type { i32, i32, i32, i32 }
-@g = weak global i32 0 ; <i32*> [#uses=1]
+@g = weak global i32 0 ; <ptr> [#uses=1]
-define i32 @foo(%struct.x* byval(%struct.x) %a) nounwind {
+define i32 @foo(ptr byval(%struct.x) %a) nounwind {
; CHECK: ret i32 1
- %tmp1 = tail call i32 (...) @bar( %struct.x* %a ) nounwind ; <i32> [#uses=0]
- %tmp2 = getelementptr %struct.x, %struct.x* %a, i32 0, i32 0 ; <i32*> [#uses=2]
- store i32 1, i32* %tmp2, align 4
- store i32 2, i32* @g, align 4
- %tmp4 = load i32, i32* %tmp2, align 4 ; <i32> [#uses=1]
+ %tmp1 = tail call i32 (...) @bar( ptr %a ) nounwind ; <i32> [#uses=0]
+ %tmp2 = getelementptr %struct.x, ptr %a, i32 0, i32 0 ; <ptr> [#uses=2]
+ store i32 1, ptr %tmp2, align 4
+ store i32 2, ptr @g, align 4
+ %tmp4 = load i32, ptr %tmp2, align 4 ; <i32> [#uses=1]
ret i32 %tmp4
}
; CHECK: ret i32 0
define i32 @main() {
- %a = load i32, i32* @flag0
- %b = atomicrmw xchg i32* @turn, i32 1 monotonic
- %c = load i32, i32* @flag0
+ %a = load i32, ptr @flag0
+ %b = atomicrmw xchg ptr @turn, i32 1 monotonic
+ %c = load i32, ptr @flag0
%d = sub i32 %a, %c
ret i32 %d
}
; so MayAlias is needed. In practice, basicaa returns PartialAlias
; for GEPs to ignore TBAA.
-define void @foo([3 x [3 x double]]* noalias %p) {
+define void @foo(ptr noalias %p) {
entry:
- %p3 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
+ %p3 = getelementptr [3 x [3 x double]], ptr %p, i64 0, i64 0, i64 3
br label %loop
loop:
%i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
- %p.0.i.0 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0
+ %p.0.i.0 = getelementptr [3 x [3 x double]], ptr %p, i64 0, i64 %i, i64 0
- store volatile double 0.0, double* %p3
- store volatile double 0.1, double* %p.0.i.0
+ store volatile double 0.0, ptr %p3
+ store volatile double 0.1, ptr %p.0.i.0
%i.next = add i64 %i, 1
%cmp = icmp slt i64 %i.next, 3
@G = global i32 0, align 4
-define i64 @global_and_deref_arg_1(i64* dereferenceable(8) %arg) nofree nosync {
+define i64 @global_and_deref_arg_1(ptr dereferenceable(8) %arg) nofree nosync {
; CHECK: Function: global_and_deref_arg_1: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i64* %arg, i32* @G
bb:
- store i64 1, i64* %arg, align 8
- store i32 0, i32* @G, align 4
- %tmp = load i64, i64* %arg, align 8
+ store i64 1, ptr %arg, align 8
+ store i32 0, ptr @G, align 4
+ %tmp = load i64, ptr %arg, align 8
ret i64 %tmp
}
-define i32 @global_and_deref_arg_2(i32* dereferenceable(8) %arg) nofree nosync {
+define i32 @global_and_deref_arg_2(ptr dereferenceable(8) %arg) nofree nosync {
; CHECK: Function: global_and_deref_arg_2: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i32* %arg, i32* @G
bb:
- store i32 1, i32* %arg, align 8
- store i32 0, i32* @G, align 4
- %tmp = load i32, i32* %arg, align 8
+ store i32 1, ptr %arg, align 8
+ store i32 0, ptr @G, align 4
+ %tmp = load i32, ptr %arg, align 8
ret i32 %tmp
}
-define i32 @byval_and_deref_arg_1(i32* byval(i32) %obj, i64* dereferenceable(8) %arg) nofree nosync {
+define i32 @byval_and_deref_arg_1(ptr byval(i32) %obj, ptr dereferenceable(8) %arg) nofree nosync {
; CHECK: Function: byval_and_deref_arg_1: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i64* %arg, i32* %obj
bb:
- store i32 1, i32* %obj, align 4
- store i64 0, i64* %arg, align 8
- %tmp = load i32, i32* %obj, align 4
+ store i32 1, ptr %obj, align 4
+ store i64 0, ptr %arg, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
-define i32 @byval_and_deref_arg_2(i32* byval(i32) %obj, i32* dereferenceable(8) %arg) nofree nosync {
+define i32 @byval_and_deref_arg_2(ptr byval(i32) %obj, ptr dereferenceable(8) %arg) nofree nosync {
; CHECK: Function: byval_and_deref_arg_2: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i32* %arg, i32* %obj
bb:
- store i32 1, i32* %obj, align 4
- store i32 0, i32* %arg, align 8
- %tmp = load i32, i32* %obj, align 4
+ store i32 1, ptr %obj, align 4
+ store i32 0, ptr %arg, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
-declare dereferenceable(8) i32* @get_i32_deref8()
-declare dereferenceable(8) i64* @get_i64_deref8()
-declare void @unknown(i32*)
+declare dereferenceable(8) ptr @get_i32_deref8()
+declare dereferenceable(8) ptr @get_i64_deref8()
+declare void @unknown(ptr)
define i32 @local_and_deref_ret_1() {
; CHECK: Function: local_and_deref_ret_1: 2 pointers, 2 call sites
; CHECK-NEXT: NoAlias: i32* %obj, i64* %ret
bb:
%obj = alloca i32
- call void @unknown(i32* %obj)
- %ret = call dereferenceable(8) i64* @get_i64_deref8()
- store i32 1, i32* %obj, align 4
- store i64 0, i64* %ret, align 8
- %tmp = load i32, i32* %obj, align 4
+ call void @unknown(ptr %obj)
+ %ret = call dereferenceable(8) ptr @get_i64_deref8()
+ store i32 1, ptr %obj, align 4
+ store i64 0, ptr %ret, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
; CHECK-NEXT: NoAlias: i32* %obj, i32* %ret
bb:
%obj = alloca i32
- call void @unknown(i32* %obj)
- %ret = call dereferenceable(8) i32* @get_i32_deref8()
- store i32 1, i32* %obj, align 4
- store i32 0, i32* %ret, align 8
- %tmp = load i32, i32* %obj, align 4
+ call void @unknown(ptr %obj)
+ %ret = call dereferenceable(8) ptr @get_i32_deref8()
+ store i32 1, ptr %obj, align 4
+ store i32 0, ptr %ret, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
; Baseline tests, same as above but with 2 instead of 8 dereferenceable bytes.
-define i64 @global_and_deref_arg_non_deref_1(i64* dereferenceable(2) %arg) nofree nosync {
+define i64 @global_and_deref_arg_non_deref_1(ptr dereferenceable(2) %arg) nofree nosync {
; CHECK: Function: global_and_deref_arg_non_deref_1: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i64* %arg, i32* @G
bb:
- store i64 1, i64* %arg, align 8
- store i32 0, i32* @G, align 4
- %tmp = load i64, i64* %arg, align 8
+ store i64 1, ptr %arg, align 8
+ store i32 0, ptr @G, align 4
+ %tmp = load i64, ptr %arg, align 8
ret i64 %tmp
}
-define i32 @global_and_deref_arg_non_deref_2(i32* dereferenceable(2) %arg) nofree nosync {
+define i32 @global_and_deref_arg_non_deref_2(ptr dereferenceable(2) %arg) nofree nosync {
; CHECK: Function: global_and_deref_arg_non_deref_2: 2 pointers, 0 call sites
; Different result than above (see @global_and_deref_arg_2).
; CHECK-NEXT: MayAlias: i32* %arg, i32* @G
bb:
- store i32 1, i32* %arg, align 8
- store i32 0, i32* @G, align 4
- %tmp = load i32, i32* %arg, align 8
+ store i32 1, ptr %arg, align 8
+ store i32 0, ptr @G, align 4
+ %tmp = load i32, ptr %arg, align 8
ret i32 %tmp
}
-define i32 @byval_and_deref_arg_non_deref_1(i32* byval(i32) %obj, i64* dereferenceable(2) %arg) nofree nosync {
+define i32 @byval_and_deref_arg_non_deref_1(ptr byval(i32) %obj, ptr dereferenceable(2) %arg) nofree nosync {
; CHECK: Function: byval_and_deref_arg_non_deref_1: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i64* %arg, i32* %obj
bb:
- store i32 1, i32* %obj, align 4
- store i64 0, i64* %arg, align 8
- %tmp = load i32, i32* %obj, align 4
+ store i32 1, ptr %obj, align 4
+ store i64 0, ptr %arg, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
-define i32 @byval_and_deref_arg_non_deref_2(i32* byval(i32) %obj, i32* dereferenceable(2) %arg) nofree nosync {
+define i32 @byval_and_deref_arg_non_deref_2(ptr byval(i32) %obj, ptr dereferenceable(2) %arg) nofree nosync {
; CHECK: Function: byval_and_deref_arg_non_deref_2: 2 pointers, 0 call sites
; CHECK-NEXT: NoAlias: i32* %arg, i32* %obj
bb:
- store i32 1, i32* %obj, align 4
- store i32 0, i32* %arg, align 8
- %tmp = load i32, i32* %obj, align 4
+ store i32 1, ptr %obj, align 4
+ store i32 0, ptr %arg, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
-declare dereferenceable(2) i32* @get_i32_deref2()
-declare dereferenceable(2) i64* @get_i64_deref2()
+declare dereferenceable(2) ptr @get_i32_deref2()
+declare dereferenceable(2) ptr @get_i64_deref2()
define i32 @local_and_deref_ret_non_deref_1() {
; CHECK: Function: local_and_deref_ret_non_deref_1: 2 pointers, 2 call sites
; CHECK-NEXT: NoAlias: i32* %obj, i64* %ret
bb:
%obj = alloca i32
- call void @unknown(i32* %obj)
- %ret = call dereferenceable(2) i64* @get_i64_deref2()
- store i32 1, i32* %obj, align 4
- store i64 0, i64* %ret, align 8
- %tmp = load i32, i32* %obj, align 4
+ call void @unknown(ptr %obj)
+ %ret = call dereferenceable(2) ptr @get_i64_deref2()
+ store i32 1, ptr %obj, align 4
+ store i64 0, ptr %ret, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
; CHECK-NEXT: MayAlias: i32* %obj, i32* %ret
bb:
%obj = alloca i32
- call void @unknown(i32* %obj)
- %ret = call dereferenceable(2) i32* @get_i32_deref2()
- store i32 1, i32* %obj, align 4
- store i32 0, i32* %ret, align 8
- %tmp = load i32, i32* %obj, align 4
+ call void @unknown(ptr %obj)
+ %ret = call dereferenceable(2) ptr @get_i32_deref2()
+ store i32 1, ptr %obj, align 4
+ store i32 0, ptr %ret, align 8
+ %tmp = load i32, ptr %obj, align 4
ret i32 %tmp
}
; CHECK: Function: foo:
; CHECK-NEXT: NoAlias: {}* %p, {}* %q
-define void @foo({}* %p, {}* %q) {
- store {} {}, {}* %p
- store {} {}, {}* %q
+define void @foo(ptr %p, ptr %q) {
+ store {} {}, ptr %p
+ store {} {}, ptr %q
ret void
}
; CHECK: MayAlias: float* %arrayidxA, float* %arrayidxB
-define void @fallback_mayalias(float* noalias nocapture %C, i64 %i, i64 %j) local_unnamed_addr {
+define void @fallback_mayalias(ptr noalias nocapture %C, i64 %i, i64 %j) local_unnamed_addr {
entry:
%cmp = icmp ne i64 %i, %j
call void @llvm.assume(i1 %cmp)
- %arrayidxA = getelementptr inbounds float, float* %C, i64 %i
- store float undef, float* %arrayidxA, align 4
+ %arrayidxA = getelementptr inbounds float, ptr %C, i64 %i
+ store float undef, ptr %arrayidxA, align 4
- %arrayidxB = getelementptr inbounds float, float* %C, i64 %j
- store float undef, float* %arrayidxB, align 4
+ %arrayidxB = getelementptr inbounds float, ptr %C, i64 %j
+ store float undef, ptr %arrayidxB, align 4
ret void
}
; CHECK: ret i32 0
entry:
%u = alloca %union.anon, align 8
- %tmp9 = getelementptr inbounds %union.anon, %union.anon* %u, i64 0, i32 0
- store double %x, double* %tmp9, align 8, !tbaa !0
- %tmp2 = load i32, i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3
+ store double %x, ptr %u, align 8, !tbaa !0
+ %tmp2 = load i32, ptr @endianness_test, align 8, !tbaa !3
%idxprom = sext i32 %tmp2 to i64
- %tmp4 = bitcast %union.anon* %u to [2 x i32]*
- %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %tmp4, i64 0, i64 %idxprom
- %tmp5 = load i32, i32* %arrayidx, align 4, !tbaa !3
+ %arrayidx = getelementptr inbounds [2 x i32], ptr %u, i64 0, i64 %idxprom
+ %tmp5 = load i32, ptr %arrayidx, align 4, !tbaa !3
%tmp5.lobit = lshr i32 %tmp5, 31
ret i32 %tmp5.lobit
}
; The load and store address in the loop body could alias so the load
; can't be hoisted above the store and out of the loop.
-declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i32, i1)
+declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i32, i1)
define i64 @foo(i64 %x, i64 %z, i64 %n) {
entry:
%pool = alloca [59 x i64], align 4
- %tmp = bitcast [59 x i64]* %pool to i8*
- call void @llvm.memset.p0i8.i64(i8* nonnull %tmp, i8 0, i64 236, i32 4, i1 false)
+ call void @llvm.memset.p0.i64(ptr nonnull %pool, i8 0, i64 236, i32 4, i1 false)
%cmp3 = icmp eq i64 %n, 0
br i1 %cmp3, label %for.end, label %for.body.lr.ph
%add = add i64 %z, %x
%and = and i64 %add, 9223372036854775807
%sub = add nsw i64 %and, -9223372036844814062
- %arrayidx = getelementptr inbounds [59 x i64], [59 x i64]* %pool, i64 0, i64 %sub
- %arrayidx1 = getelementptr inbounds [59 x i64], [59 x i64]* %pool, i64 0, i64 42
+ %arrayidx = getelementptr inbounds [59 x i64], ptr %pool, i64 0, i64 %sub
+ %arrayidx1 = getelementptr inbounds [59 x i64], ptr %pool, i64 0, i64 42
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.04 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- store i64 %i.04, i64* %arrayidx, align 4
- %tmp1 = load i64, i64* %arrayidx1, align 4
+ store i64 %i.04, ptr %arrayidx, align 4
+ %tmp1 = load i64, ptr %arrayidx1, align 4
%inc = add nuw i64 %i.04, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
; The load and store address in the loop body could alias so the load
; can't be hoisted above the store and out of the loop.
-declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1)
+declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)
define i32 @foo(i32 %x, i32 %z, i32 %n) {
entry:
%pool = alloca [59 x i32], align 4
- %tmp = bitcast [59 x i32]* %pool to i8*
- call void @llvm.memset.p0i8.i32(i8* align 4 nonnull %tmp, i8 0, i32 236, i1 false)
+ call void @llvm.memset.p0.i32(ptr align 4 nonnull %pool, i8 0, i32 236, i1 false)
%cmp3 = icmp eq i32 %n, 0
br i1 %cmp3, label %for.end, label %for.body.lr.ph
%add = add i32 %z, %x
%and = and i32 %add, 2147483647
%sub = add nsw i32 %and, -2137521902
- %arrayidx = getelementptr inbounds [59 x i32], [59 x i32]* %pool, i32 0, i32 %sub
- %arrayidx1 = getelementptr inbounds [59 x i32], [59 x i32]* %pool, i32 0, i32 42
+ %arrayidx = getelementptr inbounds [59 x i32], ptr %pool, i32 0, i32 %sub
+ %arrayidx1 = getelementptr inbounds [59 x i32], ptr %pool, i32 0, i32 42
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.04 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- store i32 %i.04, i32* %arrayidx, align 4
- %tmp1 = load i32, i32* %arrayidx1, align 4
+ store i32 %i.04, ptr %arrayidx, align 4
+ %tmp1 = load i32, ptr %arrayidx1, align 4
%inc = add nuw i32 %i.04, 1
%exitcond = icmp ne i32 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
; CHECK-DAG: MayAlias: i8* %gep.inc5, i8* %gep.inc7
; CHECK-DAG: NoAlias: i8* %gep.inc6, i8* %gep.inc7
-define void @test(i8* %base) {
- %gep.add5 = getelementptr i8, i8* %base, i64 5
- %gep.add6 = getelementptr i8, i8* %base, i64 6
- %gep.add7 = getelementptr i8, i8* %base, i64 7
+define void @test(ptr %base) {
+ %gep.add5 = getelementptr i8, ptr %base, i64 5
+ %gep.add6 = getelementptr i8, ptr %base, i64 6
+ %gep.add7 = getelementptr i8, ptr %base, i64 7
- %gep.inc1 = getelementptr i8, i8* %base, i64 1
- %gep.inc2 = getelementptr i8, i8* %gep.inc1, i64 1
- %gep.inc3 = getelementptr i8, i8* %gep.inc2, i64 1
- %gep.inc4 = getelementptr i8, i8* %gep.inc3, i64 1
- %gep.inc5 = getelementptr i8, i8* %gep.inc4, i64 1
- %gep.inc6 = getelementptr i8, i8* %gep.inc5, i64 1
- %gep.inc7 = getelementptr i8, i8* %gep.inc6, i64 1
+ %gep.inc1 = getelementptr i8, ptr %base, i64 1
+ %gep.inc2 = getelementptr i8, ptr %gep.inc1, i64 1
+ %gep.inc3 = getelementptr i8, ptr %gep.inc2, i64 1
+ %gep.inc4 = getelementptr i8, ptr %gep.inc3, i64 1
+ %gep.inc5 = getelementptr i8, ptr %gep.inc4, i64 1
+ %gep.inc6 = getelementptr i8, ptr %gep.inc5, i64 1
+ %gep.inc7 = getelementptr i8, ptr %gep.inc6, i64 1
- load i8, i8* %gep.add5
- load i8, i8* %gep.add6
- load i8, i8* %gep.add7
- load i8, i8* %gep.inc3
- load i8, i8* %gep.inc4
- load i8, i8* %gep.inc5
- load i8, i8* %gep.inc6
- load i8, i8* %gep.inc7
+ load i8, ptr %gep.add5
+ load i8, ptr %gep.add6
+ load i8, ptr %gep.add7
+ load i8, ptr %gep.inc3
+ load i8, ptr %gep.inc4
+ load i8, ptr %gep.inc5
+ load i8, ptr %gep.inc6
+ load i8, ptr %gep.inc7
ret void
}
@B = global i16 8
; CHECK-LABEL: @test1(
-define i16 @test1(i32* %P) {
- %X = load i16, i16* @B
- store i32 7, i32* %P
- %Y = load i16, i16* @B
+define i16 @test1(ptr %P) {
+ %X = load i16, ptr @B
+ store i32 7, ptr %P
+ %Y = load i16, ptr @B
%Z = sub i16 %Y, %X
ret i16 %Z
; CHECK: ret i16 0
@B_as1 = addrspace(1) global i16 8
-define i16 @test1_as1(i32 addrspace(1)* %P) {
+define i16 @test1_as1(ptr addrspace(1) %P) {
; CHECK-LABEL: @test1_as1(
; CHECK: ret i16 0
- %X = load i16, i16 addrspace(1)* @B_as1
- store i32 7, i32 addrspace(1)* %P
- %Y = load i16, i16 addrspace(1)* @B_as1
+ %X = load i16, ptr addrspace(1) @B_as1
+ store i32 7, ptr addrspace(1) %P
+ %Y = load i16, ptr addrspace(1) @B_as1
%Z = sub i16 %Y, %X
ret i16 %Z
}
; CHECK-LABEL: @test2(
define i8 @test2(i32 %tmp79, i32 %w.2, i32 %indvar89) nounwind {
%tmp92 = add i32 %tmp79, %indvar89
- %arrayidx412 = getelementptr [0 x i8], [0 x i8]* @window, i32 0, i32 %tmp92
+ %arrayidx412 = getelementptr [0 x i8], ptr @window, i32 0, i32 %tmp92
%tmp93 = add i32 %w.2, %indvar89
- %arrayidx416 = getelementptr [0 x i8], [0 x i8]* @window, i32 0, i32 %tmp93
+ %arrayidx416 = getelementptr [0 x i8], ptr @window, i32 0, i32 %tmp93
- %A = load i8, i8* %arrayidx412, align 1
- store i8 4, i8* %arrayidx416, align 1
+ %A = load i8, ptr %arrayidx412, align 1
+ store i8 4, ptr %arrayidx416, align 1
- %B = load i8, i8* %arrayidx412, align 1
+ %B = load i8, ptr %arrayidx412, align 1
%C = sub i8 %A, %B
ret i8 %C
; loopinfo that basic-aa cache. But nor does any other test in LLVM. It would
; be good to enhance this to actually use these other analyses to make this
; a more thorough test.
-define void @foo(i1 %x, i8* %p1, i8* %p2) {
+define void @foo(i1 %x, ptr %p1, ptr %p2) {
entry:
%p3 = alloca i8
- store i8 42, i8* %p1
- %gep2 = getelementptr i8, i8* %p2, i32 0
+ store i8 42, ptr %p1
br i1 %x, label %loop, label %exit
loop:
- store i8 13, i8* %p3
- %tmp1 = load i8, i8* %gep2
+ store i8 13, ptr %p3
+ %tmp1 = load i8, ptr %p2
br label %loop
exit:
define i1 @foo(i32 %i) nounwind {
; CHECK: ret i1 true
entry:
- %arr = alloca [10 x i8*] ; <[10 x i8*]*> [#uses=1]
- %tmp2 = call i8* @getPtr( ) nounwind ; <i8*> [#uses=2]
- %tmp4 = getelementptr [10 x i8*], [10 x i8*]* %arr, i32 0, i32 %i ; <i8**> [#uses=2]
- store i8* %tmp2, i8** %tmp4, align 4
- %tmp10 = getelementptr i8, i8* %tmp2, i32 10 ; <i8*> [#uses=1]
- store i8 42, i8* %tmp10, align 1
- %tmp14 = load i8*, i8** %tmp4, align 4 ; <i8*> [#uses=1]
- %tmp16 = getelementptr i8, i8* %tmp14, i32 10 ; <i8*> [#uses=1]
- %tmp17 = load i8, i8* %tmp16, align 1 ; <i8> [#uses=1]
+ %arr = alloca [10 x ptr] ; <ptr> [#uses=1]
+ %tmp2 = call ptr @getPtr( ) nounwind ; <ptr> [#uses=2]
+ %tmp4 = getelementptr [10 x ptr], ptr %arr, i32 0, i32 %i ; <ptr> [#uses=2]
+ store ptr %tmp2, ptr %tmp4, align 4
+ %tmp10 = getelementptr i8, ptr %tmp2, i32 10 ; <ptr> [#uses=1]
+ store i8 42, ptr %tmp10, align 1
+ %tmp14 = load ptr, ptr %tmp4, align 4 ; <ptr> [#uses=1]
+ %tmp16 = getelementptr i8, ptr %tmp14, i32 10 ; <ptr> [#uses=1]
+ %tmp17 = load i8, ptr %tmp16, align 1 ; <i8> [#uses=1]
%tmp19 = icmp eq i8 %tmp17, 42 ; <i1> [#uses=1]
ret i1 %tmp19
}
-declare i8* @getPtr()
+declare ptr @getPtr()
declare void @abort() noreturn nounwind
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
target datalayout = "p:64:64"
-declare void @escape(i8* %ptr)
+declare void @escape(ptr %ptr)
; Verify that unescaped noalias parameter does not alias inttoptr
-define void @test1(i8* noalias %P, i64 %Q_as_int) {
+define void @test1(ptr noalias %P, i64 %Q_as_int) {
; CHECK-LABEL: Function: test1:
; CHECK: NoAlias: i8* %P, i8* %Q
- %Q = inttoptr i64 %Q_as_int to i8*
- store i8 0, i8* %P
- store i8 1, i8* %Q
+ %Q = inttoptr i64 %Q_as_int to ptr
+ store i8 0, ptr %P
+ store i8 1, ptr %Q
ret void
}
; CHECK-LABEL: Function: test2:
; CHECK: NoAlias: i8* %P, i8* %Q
%P = alloca i8
- %Q = inttoptr i64 %Q_as_int to i8*
- store i8 0, i8* %P
- store i8 1, i8* %Q
+ %Q = inttoptr i64 %Q_as_int to ptr
+ store i8 0, ptr %P
+ store i8 1, ptr %Q
ret void
}
; Verify that escaped noalias parameter may alias inttoptr
-define void @test3(i8* noalias %P, i64 %Q_as_int) {
+define void @test3(ptr noalias %P, i64 %Q_as_int) {
; CHECK-LABEL: Function: test3:
; CHECK: MayAlias: i8* %P, i8* %Q
- call void @escape(i8* %P)
- %Q = inttoptr i64 %Q_as_int to i8*
- store i8 0, i8* %P
- store i8 1, i8* %Q
+ call void @escape(ptr %P)
+ %Q = inttoptr i64 %Q_as_int to ptr
+ store i8 0, ptr %P
+ store i8 1, ptr %Q
ret void
}
; CHECK-LABEL: Function: test4:
; CHECK: MayAlias: i8* %P, i8* %Q
%P = alloca i8
- call void @escape(i8* %P)
- %Q = inttoptr i64 %Q_as_int to i8*
- store i8 0, i8* %P
- store i8 1, i8* %Q
+ call void @escape(ptr %P)
+ %Q = inttoptr i64 %Q_as_int to ptr
+ store i8 0, ptr %P
+ store i8 1, ptr %Q
ret void
}
define void @test5(i64 %Q_as_int) {
; CHECK-LABEL: Function: test5:
; CHECK: MayAlias: i8* %Q, i8* @G
- %Q = inttoptr i64 %Q_as_int to i8*
- store i8 0, i8* @G
- store i8 1, i8* %Q
+ %Q = inttoptr i64 %Q_as_int to ptr
+ store i8 0, ptr @G
+ store i8 1, ptr %Q
ret void
}
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
-declare i32* @captures(i32* %cap) nounwind readonly
+declare ptr @captures(ptr %cap) nounwind readonly
; CHECK-LABEL: no
; CHECK: NoAlias: i32* %a, i32* %b
-define void @no(i32* noalias %a, i32* %b) nounwind {
+define void @no(ptr noalias %a, ptr %b) nounwind {
entry:
- store i32 1, i32* %a
- %cap = call i32* @captures(i32* %a) nounwind readonly
- %l = load i32, i32* %b
+ store i32 1, ptr %a
+ %cap = call ptr @captures(ptr %a) nounwind readonly
+ %l = load i32, ptr %b
ret void
}
; CHECK-LABEL: yes
; CHECK: MayAlias: i32* %c, i32* %d
-define void @yes(i32* %c, i32* %d) nounwind {
+define void @yes(ptr %c, ptr %d) nounwind {
entry:
- store i32 1, i32* %c
- %cap = call i32* @captures(i32* %c) nounwind readonly
- %l = load i32, i32* %d
+ store i32 1, ptr %c
+ %cap = call ptr @captures(ptr %c) nounwind readonly
+ %l = load i32, ptr %d
ret void
}
; Result should be the same for byval instead of noalias.
; CHECK-LABEL: byval
; CHECK: NoAlias: i32* %a, i32* %b
-define void @byval(i32* byval(i32) %a, i32* %b) nounwind {
+define void @byval(ptr byval(i32) %a, ptr %b) nounwind {
entry:
- store i32 1, i32* %a
- %cap = call i32* @captures(i32* %a) nounwind readonly
- %l = load i32, i32* %b
+ store i32 1, ptr %a
+ %cap = call ptr @captures(ptr %a) nounwind readonly
+ %l = load i32, ptr %b
ret void
}
; "tmp12" returning i32 32, since basicaa converted the offsets to 64b
; and missed the wrap-around
-define i32 @foo(i8* %buffer) {
+define i32 @foo(ptr %buffer) {
entry:
- %tmp2 = getelementptr i8, i8* %buffer, i32 -2071408432
- %tmp3 = bitcast i8* %tmp2 to i32*
- %tmp4 = getelementptr i8, i8* %buffer, i32 128
- %tmp5 = bitcast i8* %tmp4 to i32*
- store i32 32, i32* %tmp5, align 4
- %tmp12 = getelementptr i32, i32* %tmp3, i32 -1629631508
- store i32 28, i32* %tmp12, align 4
- %tmp13 = getelementptr i8, i8* %buffer, i32 128
- %tmp14 = bitcast i8* %tmp13 to i32*
- %tmp2083 = load i32, i32* %tmp14, align 4
+ %tmp2 = getelementptr i8, ptr %buffer, i32 -2071408432
+ %tmp4 = getelementptr i8, ptr %buffer, i32 128
+ store i32 32, ptr %tmp4, align 4
+ %tmp12 = getelementptr i32, ptr %tmp2, i32 -1629631508
+ store i32 28, ptr %tmp12, align 4
+ %tmp13 = getelementptr i8, ptr %buffer, i32 128
+ %tmp2083 = load i32, ptr %tmp13, align 4
; CHECK: ret i32 28
ret i32 %tmp2083
}
; Two PHIs in the same block.
; CHECK-LABEL: Function: foo
; CHECK: NoAlias: double* %a, double* %b
-define void @foo(i1 %m, double* noalias %x, double* noalias %y) {
+define void @foo(i1 %m, ptr noalias %x, ptr noalias %y) {
entry:
br i1 %m, label %true, label %false
br label %exit
exit:
- %a = phi double* [ %x, %true ], [ %y, %false ]
- %b = phi double* [ %x, %false ], [ %y, %true ]
- store volatile double 0.0, double* %a
- store volatile double 1.0, double* %b
+ %a = phi ptr [ %x, %true ], [ %y, %false ]
+ %b = phi ptr [ %x, %false ], [ %y, %true ]
+ store volatile double 0.0, ptr %a
+ store volatile double 1.0, ptr %b
ret void
}
; Two selects with the same condition.
; CHECK-LABEL: Function: bar
; CHECK: NoAlias: double* %a, double* %b
-define void @bar(i1 %m, double* noalias %x, double* noalias %y) {
+define void @bar(i1 %m, ptr noalias %x, ptr noalias %y) {
entry:
- %a = select i1 %m, double* %x, double* %y
- %b = select i1 %m, double* %y, double* %x
- store volatile double 0.000000e+00, double* %a
- store volatile double 1.000000e+00, double* %b
+ %a = select i1 %m, ptr %x, ptr %y
+ %b = select i1 %m, ptr %y, ptr %x
+ store volatile double 0.000000e+00, ptr %a
+ store volatile double 1.000000e+00, ptr %b
ret void
}
; Two PHIs with disjoint sets of inputs.
; CHECK-LABEL: Function: qux
; CHECK: NoAlias: double* %a, double* %b
-define void @qux(i1 %m, double* noalias %x, double* noalias %y,
- i1 %n, double* noalias %v, double* noalias %w) {
+define void @qux(i1 %m, ptr noalias %x, ptr noalias %y,
+ i1 %n, ptr noalias %v, ptr noalias %w) {
entry:
br i1 %m, label %true, label %false
br label %exit
exit:
- %a = phi double* [ %x, %true ], [ %y, %false ]
+ %a = phi ptr [ %x, %true ], [ %y, %false ]
br i1 %n, label %ntrue, label %nfalse
ntrue:
br label %nexit
nexit:
- %b = phi double* [ %v, %ntrue ], [ %w, %nfalse ]
- store volatile double 0.0, double* %a
- store volatile double 1.0, double* %b
+ %b = phi ptr [ %v, %ntrue ], [ %w, %nfalse ]
+ store volatile double 0.0, ptr %a
+ store volatile double 1.0, ptr %b
ret void
}
; Two selects with disjoint sets of arms.
; CHECK-LABEL: Function: fin
; CHECK: NoAlias: double* %a, double* %b
-define void @fin(i1 %m, double* noalias %x, double* noalias %y,
- i1 %n, double* noalias %v, double* noalias %w) {
+define void @fin(i1 %m, ptr noalias %x, ptr noalias %y,
+ i1 %n, ptr noalias %v, ptr noalias %w) {
entry:
- %a = select i1 %m, double* %x, double* %y
- %b = select i1 %n, double* %v, double* %w
- store volatile double 0.000000e+00, double* %a
- store volatile double 1.000000e+00, double* %b
+ %a = select i1 %m, ptr %x, ptr %y
+ %b = select i1 %n, ptr %v, ptr %w
+ store volatile double 0.000000e+00, ptr %a
+ store volatile double 1.000000e+00, ptr %b
ret void
}
br label %loop
loop:
- %phi = phi i32* [ %a3, %entry ], [ %sel2, %loop ]
+ %phi = phi ptr [ %a3, %entry ], [ %sel2, %loop ]
%c = phi i1 [ true, %entry ], [ false, %loop ]
- %sel1 = select i1 %c, i32* %a1, i32* %a2
- %sel2 = select i1 %c, i32* %a2, i32* %a1
- load i32, i32* %sel1
- load i32, i32* %sel2
- load i32, i32* %phi
+ %sel1 = select i1 %c, ptr %a1, ptr %a2
+ %sel2 = select i1 %c, ptr %a2, ptr %a1
+ load i32, ptr %sel1
+ load i32, ptr %sel2
+ load i32, ptr %phi
br label %loop
}
; CHECK-LABEL: for.body:
; CHECK-NOT: load i32, i32* %word_ofs
-%struct.section_t = type { i32, i32, i32* }
+%struct.section_t = type { i32, i32, ptr }
-define void @test2(%struct.section_t* noalias nocapture readonly %section, i32* noalias nocapture %dst) {
+define void @test2(ptr noalias nocapture readonly %section, ptr noalias nocapture %dst) {
entry:
- %data13 = getelementptr inbounds %struct.section_t, %struct.section_t* %section, i32 0, i32 2
- %0 = load i32*, i32** %data13, align 4
- %cmp14 = icmp eq i32* %0, null
+ %data13 = getelementptr inbounds %struct.section_t, ptr %section, i32 0, i32 2
+ %0 = load ptr, ptr %data13, align 4
+ %cmp14 = icmp eq ptr %0, null
br i1 %cmp14, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
- %1 = phi i32* [ %6, %for.end ], [ %0, %entry ]
- %section.addr.015 = phi %struct.section_t* [ %incdec.ptr, %for.end ], [ %section, %entry ]
- %num_words = getelementptr inbounds %struct.section_t, %struct.section_t* %section.addr.015, i32 0, i32 0
- %2 = load i32, i32* %num_words, align 4
+ %1 = phi ptr [ %6, %for.end ], [ %0, %entry ]
+ %section.addr.015 = phi ptr [ %incdec.ptr, %for.end ], [ %section, %entry ]
+ %2 = load i32, ptr %section.addr.015, align 4
%cmp211 = icmp eq i32 %2, 0
br i1 %cmp211, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %for.cond.preheader
- %word_ofs = getelementptr inbounds %struct.section_t, %struct.section_t* %section.addr.015, i32 0, i32 1
+ %word_ofs = getelementptr inbounds %struct.section_t, ptr %section.addr.015, i32 0, i32 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
- %arrayidx.phi = phi i32* [ %1, %for.body.lr.ph ], [ %arrayidx.inc, %for.body ]
+ %arrayidx.phi = phi ptr [ %1, %for.body.lr.ph ], [ %arrayidx.inc, %for.body ]
%i.012 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- %3 = load i32, i32* %arrayidx.phi, align 4
- %4 = load i32, i32* %word_ofs, align 4
+ %3 = load i32, ptr %arrayidx.phi, align 4
+ %4 = load i32, ptr %word_ofs, align 4
%add = add i32 %4, %i.012
- %arrayidx3 = getelementptr inbounds i32, i32* %dst, i32 %add
- store i32 %3, i32* %arrayidx3, align 4
+ %arrayidx3 = getelementptr inbounds i32, ptr %dst, i32 %add
+ store i32 %3, ptr %arrayidx3, align 4
%inc = add i32 %i.012, 1
- %5 = load i32, i32* %num_words, align 4
+ %5 = load i32, ptr %section.addr.015, align 4
%cmp2 = icmp ult i32 %inc, %5
- %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1
+ %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
br i1 %cmp2, label %for.body, label %for.end
for.end: ; preds = %for.body, %for.cond.preheader
- %incdec.ptr = getelementptr inbounds %struct.section_t, %struct.section_t* %section.addr.015, i32 1
- %data = getelementptr inbounds %struct.section_t, %struct.section_t* %section.addr.015, i32 1, i32 2
- %6 = load i32*, i32** %data, align 4
- %cmp = icmp eq i32* %6, null
+ %incdec.ptr = getelementptr inbounds %struct.section_t, ptr %section.addr.015, i32 1
+ %data = getelementptr inbounds %struct.section_t, ptr %section.addr.015, i32 1, i32 2
+ %6 = load ptr, ptr %data, align 4
+ %cmp = icmp eq ptr %6, null
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
target datalayout = "p:8:8-n8"
-declare void @otherfn([4 x i8]*)
+declare void @otherfn(ptr)
declare i32 @__gxx_personality_v0(...)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
-@c = external global i8*, align 1
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
+@c = external global ptr, align 1
; This function is one where if we didn't free basicaa after memcpyopt then the
; usage of basicaa in instcombine would cause a segfault due to stale phi-values
; results being used.
-define void @fn(i8* %this, i64* %ptr) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define void @fn(ptr %this, ptr %ptr) personality ptr @__gxx_personality_v0 {
entry:
%arr = alloca [4 x i8], align 8
- %gep1 = getelementptr inbounds [4 x i8], [4 x i8]* %arr, i64 0, i32 0
br i1 undef, label %then, label %if
if:
br label %then
then:
- %phi = phi i64* [ %ptr, %if ], [ null, %entry ]
- store i8 1, i8* %gep1, align 8
- %load = load i64, i64* %phi, align 8
- %gep2 = getelementptr inbounds i8, i8* undef, i64 %load
- %gep3 = getelementptr inbounds i8, i8* %gep2, i64 40
- invoke i32 undef(i8* undef)
+ %phi = phi ptr [ %ptr, %if ], [ null, %entry ]
+ store i8 1, ptr %arr, align 8
+ %load = load i64, ptr %phi, align 8
+ %gep2 = getelementptr inbounds i8, ptr undef, i64 %load
+ %gep3 = getelementptr inbounds i8, ptr %gep2, i64 40
+ invoke i32 undef(ptr undef)
to label %invoke unwind label %lpad
invoke:
unreachable
lpad:
- landingpad { i8*, i32 }
- catch i8* null
- call void @otherfn([4 x i8]* nonnull %arr)
+ landingpad { ptr, i32 }
+ catch ptr null
+ call void @otherfn(ptr nonnull %arr)
unreachable
}
define void @fn2() {
entry:
%a = alloca i8, align 1
- %0 = load i8*, i8** @c, align 1
- %1 = bitcast i8* %0 to i8**
+ %0 = load ptr, ptr @c, align 1
br label %for.cond
for.cond: ; preds = %for.body, %entry
- %d.0 = phi i8** [ %1, %entry ], [ null, %for.body ]
+ %d.0 = phi ptr [ %0, %entry ], [ null, %for.body ]
br i1 undef, label %for.body, label %for.cond.cleanup
for.body: ; preds = %for.cond
- store volatile i8 undef, i8* %a, align 1
+ store volatile i8 undef, ptr %a, align 1
br label %for.cond
for.cond.cleanup: ; preds = %for.cond
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %a)
- %2 = load i8*, i8** %d.0, align 1
- store i8* %2, i8** @c, align 1
+ call void @llvm.lifetime.end.p0(i64 1, ptr %a)
+ %1 = load ptr, ptr %d.0, align 1
+ store ptr %1, ptr @c, align 1
ret void
}
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind readonly
-declare <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float>, i8*, <8 x i32>, <8 x float>, i8) #0
+declare <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float>, ptr, <8 x i32>, <8 x float>, i8) #0
; Function Attrs: nounwind
-define <8 x float> @foo1(i8* noalias %arr.ptr, <8 x i32>* noalias readonly %vix.ptr, i8* noalias %t2.ptr) #1 {
+define <8 x float> @foo1(ptr noalias %arr.ptr, ptr noalias readonly %vix.ptr, ptr noalias %t2.ptr) #1 {
allocas:
- %vix = load <8 x i32>, <8 x i32>* %vix.ptr, align 4
- %t1.ptr = getelementptr i8, i8* %arr.ptr, i8 4
+ %vix = load <8 x i32>, ptr %vix.ptr, align 4
+ %t1.ptr = getelementptr i8, ptr %arr.ptr, i8 4
- %v1 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
- store i8 1, i8* %t1.ptr, align 4
+ %v1 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, ptr %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
+ store i8 1, ptr %t1.ptr, align 4
- %v2 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
+ %v2 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, ptr %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
%res = fadd <8 x float> %v1, %v2
ret <8 x float> %res
; Check that second gather is eliminated as gather and store memory accesses are based on different no-aliasing pointers
; Function Attrs: nounwind
-define <8 x float> @foo2(i8* noalias readonly %arr.ptr, <8 x i32>* noalias readonly %vix.ptr, i8* noalias %t2.ptr) #1 {
+define <8 x float> @foo2(ptr noalias readonly %arr.ptr, ptr noalias readonly %vix.ptr, ptr noalias %t2.ptr) #1 {
allocas:
- %vix = load <8 x i32>, <8 x i32>* %vix.ptr, align 4
- %t1.ptr = getelementptr i8, i8* %arr.ptr, i8 4
+ %vix = load <8 x i32>, ptr %vix.ptr, align 4
+ %t1.ptr = getelementptr i8, ptr %arr.ptr, i8 4
- %v1 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
- store i8 1, i8* %t2.ptr, align 4
+ %v1 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, ptr %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
+ store i8 1, ptr %t2.ptr, align 4
- %v2 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
+ %v2 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, ptr %arr.ptr, <8 x i32> %vix, <8 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, i8 1) #2
%res = fadd <8 x float> %v1, %v2
ret <8 x float> %res
; CHECK-NEXT: NoAlias: %struct* %ptr1, i64* %ptr2
; CHECK-NEXT: NoAlias: %struct* %addr.ptr, i64* %ptr2
; CHECK-NEXT: NoAlias: i64* %gep, i64* %ptr2
-define void @test_noalias(%struct* noalias %ptr1, i64* %ptr2, i64 %offset) {
+define void @test_noalias(ptr noalias %ptr1, ptr %ptr2, i64 %offset) {
entry:
- %addr.ptr = call %struct* @llvm.ptrmask.p0s_struct.p0s.struct.i64(%struct* %ptr1, i64 72057594037927928)
- load %struct, %struct* %ptr1
- load %struct, %struct* %addr.ptr
- store i64 10, i64* %ptr2
- %gep = getelementptr inbounds %struct, %struct* %addr.ptr, i64 0, i32 0, i64 %offset
- store i64 1, i64* %gep, align 8
+ %addr.ptr = call ptr @llvm.ptrmask.p0.p0.struct.i64(ptr %ptr1, i64 72057594037927928)
+ load %struct, ptr %ptr1
+ load %struct, ptr %addr.ptr
+ store i64 10, ptr %ptr2
+ %gep = getelementptr inbounds %struct, ptr %addr.ptr, i64 0, i32 0, i64 %offset
+ store i64 1, ptr %gep, align 8
ret void
}
; CHECK-NEXT: Function: test_alias
; CHECK-NOT: NoAlias
-define void @test_alias(%struct* %ptr1, i64* %ptr2, i64 %offset) {
+define void @test_alias(ptr %ptr1, ptr %ptr2, i64 %offset) {
entry:
- %addr.ptr = call %struct* @llvm.ptrmask.p0s_struct.p0s.struct.i64(%struct* %ptr1, i64 72057594037927928)
- load %struct, %struct* %ptr1
- load %struct, %struct* %addr.ptr
- store i64 10, i64* %ptr2
- %gep = getelementptr inbounds %struct, %struct* %addr.ptr, i64 0, i32 0, i64 %offset
- store i64 1, i64* %gep, align 8
+ %addr.ptr = call ptr @llvm.ptrmask.p0.p0.struct.i64(ptr %ptr1, i64 72057594037927928)
+ load %struct, ptr %ptr1
+ load %struct, ptr %addr.ptr
+ store i64 10, ptr %ptr2
+ %gep = getelementptr inbounds %struct, ptr %addr.ptr, i64 0, i32 0, i64 %offset
+ store i64 1, ptr %gep, align 8
ret void
}
-declare %struct* @llvm.ptrmask.p0s_struct.p0s.struct.i64(%struct*, i64)
+declare ptr @llvm.ptrmask.p0.p0.struct.i64(ptr, i64)
define i32 @test() {
; CHECK: ret i32 0
- %A = alloca i32 ; <i32*> [#uses=3]
- call void @foo( i32* %A )
- %X = load i32, i32* %A ; <i32> [#uses=1]
+ %A = alloca i32 ; <ptr> [#uses=3]
+ call void @foo( ptr %A )
+ %X = load i32, ptr %A ; <i32> [#uses=1]
tail call void @bar( )
- %Y = load i32, i32* %A ; <i32> [#uses=1]
+ %Y = load i32, ptr %A ; <i32> [#uses=1]
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Z
}
-declare void @foo(i32*)
+declare void @foo(ptr)
declare void @bar()
br i1 false, label %for.body5, label %for.cond
for.body5: ; preds = %for.cond2
- %arrayidx = getelementptr inbounds [2 x i64], [2 x i64]* undef, i32 0, i64 0
- %tmp7 = load i64, i64* %arrayidx, align 8
- %arrayidx9 = getelementptr inbounds [2 x i64], [2 x i64]* undef, i32 0, i64 undef
- %tmp10 = load i64, i64* %arrayidx9, align 8
+ %tmp7 = load i64, ptr undef, align 8
+ %arrayidx9 = getelementptr inbounds [2 x i64], ptr undef, i32 0, i64 undef
+ %tmp10 = load i64, ptr %arrayidx9, align 8
br label %for.cond2
for.end22: ; preds = %for.cond
unreachable
bb:
- %t = select i1 undef, i32* %t, i32* undef
- %p = select i1 undef, i32* %p, i32* %p
- %q = select i1 undef, i32* undef, i32* %p
- %a = getelementptr i8, i8* %a, i32 0
+ %t = select i1 undef, ptr %t, ptr undef
+ %p = select i1 undef, ptr %p, ptr %p
+ %q = select i1 undef, ptr undef, ptr %p
unreachable
}