aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/SafeStack
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-11-26 16:45:33 -0500
committerMatt Arsenault <Matthew.Arsenault@amd.com>2022-11-27 20:28:55 -0500
commit13fc189fe1909aea3787b2a142603b790458abd6 (patch)
tree31206bb3985d6a579e02218639b6f16ca51750e7 /llvm/test/Transforms/SafeStack
parentbf6f82a9df6a1693a5399039dcadd7fc00dab65e (diff)
downloadllvm-13fc189fe1909aea3787b2a142603b790458abd6.zip
llvm-13fc189fe1909aea3787b2a142603b790458abd6.tar.gz
llvm-13fc189fe1909aea3787b2a142603b790458abd6.tar.bz2
SafeStack: Convert tests to opaque pointers
X86/struct.ll, X86/array.ll and X86/array-aligned required manual updates to reorder instructions.
Diffstat (limited to 'llvm/test/Transforms/SafeStack')
-rw-r--r--llvm/test/Transforms/SafeStack/AArch64/abi.ll17
-rw-r--r--llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll21
-rw-r--r--llvm/test/Transforms/SafeStack/AArch64/unreachable.ll15
-rw-r--r--llvm/test/Transforms/SafeStack/ARM/abi.ll14
-rw-r--r--llvm/test/Transforms/SafeStack/ARM/debug.ll25
-rw-r--r--llvm/test/Transforms/SafeStack/ARM/setjmp.ll23
-rw-r--r--llvm/test/Transforms/SafeStack/X86/abi.ll28
-rw-r--r--llvm/test/Transforms/SafeStack/X86/abi_ssp.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/X86/addr-taken.ll10
-rw-r--r--llvm/test/Transforms/SafeStack/X86/array-aligned.ll34
-rw-r--r--llvm/test/Transforms/SafeStack/X86/array.ll54
-rw-r--r--llvm/test/Transforms/SafeStack/X86/byval.ll39
-rw-r--r--llvm/test/Transforms/SafeStack/X86/call.ll73
-rw-r--r--llvm/test/Transforms/SafeStack/X86/cast.ll14
-rw-r--r--llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll33
-rw-r--r--llvm/test/Transforms/SafeStack/X86/coloring.ll46
-rw-r--r--llvm/test/Transforms/SafeStack/X86/coloring2.ll466
-rw-r--r--llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll9
-rw-r--r--llvm/test/Transforms/SafeStack/X86/constant-gep.ll4
-rw-r--r--llvm/test/Transforms/SafeStack/X86/constant-geps.ll8
-rw-r--r--llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll10
-rw-r--r--llvm/test/Transforms/SafeStack/X86/debug-loc.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/X86/debug-loc2.ll38
-rw-r--r--llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll13
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll15
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll9
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-call.ll4
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll19
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll6
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll16
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll6
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll10
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll12
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll10
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-select-call.ll8
-rw-r--r--llvm/test/Transforms/SafeStack/X86/escape-vector.ll7
-rw-r--r--llvm/test/Transforms/SafeStack/X86/invoke.ll20
-rw-r--r--llvm/test/Transforms/SafeStack/X86/layout-frag.ll38
-rw-r--r--llvm/test/Transforms/SafeStack/X86/layout-region-split.ll98
-rw-r--r--llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll6
-rw-r--r--llvm/test/Transforms/SafeStack/X86/musttail.ll46
-rw-r--r--llvm/test/Transforms/SafeStack/X86/no-attr.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll11
-rw-r--r--llvm/test/Transforms/SafeStack/X86/phi-cycle.ll17
-rw-r--r--llvm/test/Transforms/SafeStack/X86/phi.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/X86/pr54784.ll28
-rw-r--r--llvm/test/Transforms/SafeStack/X86/ret.ll2
-rw-r--r--llvm/test/Transforms/SafeStack/X86/setjmp.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/X86/setjmp2.ll33
-rw-r--r--llvm/test/Transforms/SafeStack/X86/sink-to-use.ll16
-rw-r--r--llvm/test/Transforms/SafeStack/X86/ssp.ll23
-rw-r--r--llvm/test/Transforms/SafeStack/X86/store.ll24
-rw-r--r--llvm/test/Transforms/SafeStack/X86/struct.ll34
54 files changed, 751 insertions, 869 deletions
diff --git a/llvm/test/Transforms/SafeStack/AArch64/abi.ll b/llvm/test/Transforms/SafeStack/AArch64/abi.ll
index bd6710d1..18cf499 100644
--- a/llvm/test/Transforms/SafeStack/AArch64/abi.ll
+++ b/llvm/test/Transforms/SafeStack/AArch64/abi.ll
@@ -3,18 +3,17 @@
define void @foo() nounwind uwtable safestack {
entry:
-; CHECK: %[[TP:.*]] = call i8* @llvm.thread.pointer()
-; CHECK: %[[SPA0:.*]] = getelementptr i8, i8* %[[TP]], i32 72
-; CHECK: %[[SPA:.*]] = bitcast i8* %[[SPA0]] to i8**
-; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
-; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; CHECK: store i8* %[[USST]], i8** %[[SPA]]
+; CHECK: %[[TP:.*]] = call ptr @llvm.thread.pointer()
+; CHECK: %[[SPA0:.*]] = getelementptr i8, ptr %[[TP]], i32 72
+; CHECK: %[[USP:.*]] = load ptr, ptr %[[SPA0]]
+; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; CHECK: store ptr %[[USST]], ptr %[[SPA0]]
%a = alloca i8, align 8
- call void @Capture(i8* %a)
+ call void @Capture(ptr %a)
-; CHECK: store i8* %[[USP]], i8** %[[SPA]]
+; CHECK: store ptr %[[USP]], ptr %[[SPA0]]
ret void
}
-declare void @Capture(i8*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll b/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll
index c78b20a..aab2d5d 100644
--- a/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll
+++ b/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll
@@ -4,20 +4,19 @@
define void @foo() nounwind uwtable safestack sspreq {
entry:
; The first @llvm.thread.pointer is for the unsafe stack pointer, skip it.
-; TLS: call i8* @llvm.thread.pointer()
+; TLS: call ptr @llvm.thread.pointer()
-; TLS: %[[TP2:.*]] = call i8* @llvm.thread.pointer()
-; ANDROID: %[[B:.*]] = getelementptr i8, i8* %[[TP2]], i32 40
-; FUCHSIA: %[[B:.*]] = getelementptr i8, i8* %[[TP2]], i32 -16
-; TLS: %[[C:.*]] = bitcast i8* %[[B]] to i8**
-; TLS: %[[StackGuard:.*]] = load i8*, i8** %[[C]]
-; TLS: store i8* %[[StackGuard]], i8** %[[StackGuardSlot:.*]]
+; TLS: %[[TP2:.*]] = call ptr @llvm.thread.pointer()
+; ANDROID: %[[B:.*]] = getelementptr i8, ptr %[[TP2]], i32 40
+; FUCHSIA: %[[B:.*]] = getelementptr i8, ptr %[[TP2]], i32 -16
+; TLS: %[[StackGuard:.*]] = load ptr, ptr %[[B]]
+; TLS: store ptr %[[StackGuard]], ptr %[[StackGuardSlot:.*]]
%a = alloca i128, align 16
- call void @Capture(i128* %a)
+ call void @Capture(ptr %a)
-; TLS: %[[A:.*]] = load i8*, i8** %[[StackGuardSlot]]
-; TLS: icmp ne i8* %[[StackGuard]], %[[A]]
+; TLS: %[[A:.*]] = load ptr, ptr %[[StackGuardSlot]]
+; TLS: icmp ne ptr %[[StackGuard]], %[[A]]
ret void
}
-declare void @Capture(i128*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll b/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll
index 53ed690..430c4aa 100644
--- a/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll
+++ b/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll
@@ -2,12 +2,11 @@
define void @foo() nounwind uwtable safestack {
entry:
-; CHECK: %[[TP:.*]] = call i8* @llvm.thread.pointer()
-; CHECK: %[[SPA0:.*]] = getelementptr i8, i8* %[[TP]], i32 72
-; CHECK: %[[SPA:.*]] = bitcast i8* %[[SPA0]] to i8**
-; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
-; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; CHECK: store i8* %[[USST]], i8** %[[SPA]]
+; CHECK: %[[TP:.*]] = call ptr @llvm.thread.pointer()
+; CHECK: %[[SPA0:.*]] = getelementptr i8, ptr %[[TP]], i32 72
+; CHECK: %[[USP:.*]] = load ptr, ptr %[[SPA0]]
+; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; CHECK: store ptr %[[USST]], ptr %[[SPA0]]
%a = alloca i8, align 8
br label %ret
@@ -16,8 +15,8 @@ ret:
ret void
dead:
- call void @Capture(i8* %a)
+ call void @Capture(ptr %a)
br label %ret
}
-declare void @Capture(i8*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/ARM/abi.ll b/llvm/test/Transforms/SafeStack/ARM/abi.ll
index e33c913..be4e2e3 100644
--- a/llvm/test/Transforms/SafeStack/ARM/abi.ll
+++ b/llvm/test/Transforms/SafeStack/ARM/abi.ll
@@ -3,16 +3,16 @@
define void @foo() nounwind uwtable safestack {
entry:
-; CHECK: %[[SPA:.*]] = call i8** @__safestack_pointer_address()
-; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
-; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; CHECK: store i8* %[[USST]], i8** %[[SPA]]
+; CHECK: %[[SPA:.*]] = call ptr @__safestack_pointer_address()
+; CHECK: %[[USP:.*]] = load ptr, ptr %[[SPA]]
+; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; CHECK: store ptr %[[USST]], ptr %[[SPA]]
%a = alloca i8, align 8
- call void @Capture(i8* %a)
+ call void @Capture(ptr %a)
-; CHECK: store i8* %[[USP]], i8** %[[SPA]]
+; CHECK: store ptr %[[USP]], ptr %[[SPA]]
ret void
}
-declare void @Capture(i8*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/ARM/debug.ll b/llvm/test/Transforms/SafeStack/ARM/debug.ll
index 2bcfeb8..9a61b78 100644
--- a/llvm/test/Transforms/SafeStack/ARM/debug.ll
+++ b/llvm/test/Transforms/SafeStack/ARM/debug.ll
@@ -13,38 +13,37 @@ target triple = "armv7-pc-linux-android"
; CHECK: !36 = !DILocation(line: 3, column: 11, scope: !17, inlinedAt: !37)
; CHECK: !37 = distinct !DILocation(line: 6, scope: !27)
-@addr = common local_unnamed_addr global i8*** null, align 4, !dbg !0
+@addr = common local_unnamed_addr global ptr null, align 4, !dbg !0
; Function Attrs: norecurse nounwind readonly safestack
-define i8** @__safestack_pointer_address() local_unnamed_addr #0 !dbg !17 {
+define ptr @__safestack_pointer_address() local_unnamed_addr #0 !dbg !17 {
entry:
- %0 = load i8***, i8**** @addr, align 4, !dbg !20, !tbaa !21
- %1 = load i8**, i8*** %0, align 4, !dbg !25, !tbaa !21
- ret i8** %1, !dbg !26
+ %0 = load ptr, ptr @addr, align 4, !dbg !20, !tbaa !21
+ %1 = load ptr, ptr %0, align 4, !dbg !25, !tbaa !21
+ ret ptr %1, !dbg !26
}
; Function Attrs: nounwind safestack
define void @f() local_unnamed_addr #1 !dbg !27 {
entry:
%c = alloca [16 x i8], align 1
- %0 = getelementptr inbounds [16 x i8], [16 x i8]* %c, i32 0, i32 0, !dbg !35
- call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %0) #5, !dbg !35
- call void @llvm.dbg.declare(metadata [16 x i8]* %c, metadata !31, metadata !DIExpression()), !dbg !36
- call void @Capture(i8* nonnull %0) #5, !dbg !37
- call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %0) #5, !dbg !38
+ call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %c) #5, !dbg !35
+ call void @llvm.dbg.declare(metadata ptr %c, metadata !31, metadata !DIExpression()), !dbg !36
+ call void @Capture(ptr nonnull %c) #5, !dbg !37
+ call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %c) #5, !dbg !38
ret void, !dbg !38
}
; Function Attrs: argmemonly nounwind
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #2
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #3
-declare void @Capture(i8*) local_unnamed_addr #4
+declare void @Capture(ptr) local_unnamed_addr #4
; Function Attrs: argmemonly nounwind
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #2
attributes #0 = { norecurse nounwind readonly safestack "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+armv7-a,+dsp,+neon,+vfp3,-thumb-mode" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind safestack "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+armv7-a,+dsp,+neon,+vfp3,-thumb-mode" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/llvm/test/Transforms/SafeStack/ARM/setjmp.ll b/llvm/test/Transforms/SafeStack/ARM/setjmp.ll
index 20e46f8..b86e778 100644
--- a/llvm/test/Transforms/SafeStack/ARM/setjmp.ll
+++ b/llvm/test/Transforms/SafeStack/ARM/setjmp.ll
@@ -5,32 +5,31 @@
define void @f(i32 %b) safestack {
entry:
-; CHECK: %[[SPA:.*]] = call i8** @__safestack_pointer_address()
-; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
-; CHECK: %[[USDP:.*]] = alloca i8*
-; CHECK: store i8* %[[USP]], i8** %[[USDP]]
+; CHECK: %[[SPA:.*]] = call ptr @__safestack_pointer_address()
+; CHECK: %[[USP:.*]] = load ptr, ptr %[[SPA]]
+; CHECK: %[[USDP:.*]] = alloca ptr
+; CHECK: store ptr %[[USP]], ptr %[[USDP]]
; CHECK: call i32 @setjmp
- %call = call i32 @setjmp(i32* getelementptr inbounds ([64 x i32], [64 x i32]* @env, i32 0, i32 0)) returns_twice
+ %call = call i32 @setjmp(ptr @env) returns_twice
-; CHECK: %[[USP2:.*]] = load i8*, i8** %[[USDP]]
-; CHECK: store i8* %[[USP2]], i8** %[[SPA]]
+; CHECK: %[[USP2:.*]] = load ptr, ptr %[[USDP]]
+; CHECK: store ptr %[[USP2]], ptr %[[SPA]]
%tobool = icmp eq i32 %b, 0
br i1 %tobool, label %if.end, label %if.then
if.then:
%0 = alloca [42 x i8], align 1
- %.sub = getelementptr inbounds [42 x i8], [42 x i8]* %0, i32 0, i32 0
- call void @_Z7CapturePv(i8* %.sub)
+ call void @_Z7CapturePv(ptr %0)
br label %if.end
if.end:
-; CHECK: store i8* %[[USP:.*]], i8** %[[SPA:.*]]
+; CHECK: store ptr %[[USP:.*]], ptr %[[SPA:.*]]
ret void
}
-declare i32 @setjmp(i32*) returns_twice
+declare i32 @setjmp(ptr) returns_twice
-declare void @_Z7CapturePv(i8*)
+declare void @_Z7CapturePv(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/abi.ll b/llvm/test/Transforms/SafeStack/X86/abi.ll
index f437c4f..37d8ea6 100644
--- a/llvm/test/Transforms/SafeStack/X86/abi.ll
+++ b/llvm/test/Transforms/SafeStack/X86/abi.ll
@@ -6,25 +6,25 @@
define void @foo() nounwind uwtable safestack {
entry:
-; TLS: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; TLS: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; TLS: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr
+; TLS: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; TLS: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; TLS: store ptr %[[USST]], ptr @__safestack_unsafe_stack_ptr
-; DIRECT-TLS32: %[[USP:.*]] = load i8*, i8* addrspace(256)* inttoptr (i32 36 to i8* addrspace(256)*)
-; DIRECT-TLS32: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; DIRECT-TLS32: store i8* %[[USST]], i8* addrspace(256)* inttoptr (i32 36 to i8* addrspace(256)*)
+; DIRECT-TLS32: %[[USP:.*]] = load ptr, ptr addrspace(256) inttoptr (i32 36 to ptr addrspace(256))
+; DIRECT-TLS32: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; DIRECT-TLS32: store ptr %[[USST]], ptr addrspace(256) inttoptr (i32 36 to ptr addrspace(256))
-; DIRECT-TLS64: %[[USP:.*]] = load i8*, i8* addrspace(257)* inttoptr (i32 72 to i8* addrspace(257)*)
-; DIRECT-TLS64: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; DIRECT-TLS64: store i8* %[[USST]], i8* addrspace(257)* inttoptr (i32 72 to i8* addrspace(257)*)
+; DIRECT-TLS64: %[[USP:.*]] = load ptr, ptr addrspace(257) inttoptr (i32 72 to ptr addrspace(257))
+; DIRECT-TLS64: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; DIRECT-TLS64: store ptr %[[USST]], ptr addrspace(257) inttoptr (i32 72 to ptr addrspace(257))
%a = alloca i8, align 8
- call void @Capture(i8* %a)
+ call void @Capture(ptr %a)
-; TLS: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr
-; DIRECT-TLS32: store i8* %[[USP]], i8* addrspace(256)* inttoptr (i32 36 to i8* addrspace(256)*)
-; DIRECT-TLS64: store i8* %[[USP]], i8* addrspace(257)* inttoptr (i32 72 to i8* addrspace(257)*)
+; TLS: store ptr %[[USP]], ptr @__safestack_unsafe_stack_ptr
+; DIRECT-TLS32: store ptr %[[USP]], ptr addrspace(256) inttoptr (i32 36 to ptr addrspace(256))
+; DIRECT-TLS64: store ptr %[[USP]], ptr addrspace(257) inttoptr (i32 72 to ptr addrspace(257))
ret void
}
-declare void @Capture(i8*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll b/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll
index a4b193e..7cb7549 100644
--- a/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll
@@ -10,17 +10,17 @@
define void @foo() safestack sspreq {
entry:
-; TLS32: %[[StackGuard:.*]] = load i8*, i8* addrspace(256)* inttoptr (i32 20 to i8* addrspace(256)*)
-; TLS64: %[[StackGuard:.*]] = load i8*, i8* addrspace(257)* inttoptr (i32 40 to i8* addrspace(257)*)
-; FUCHSIA64: %[[StackGuard:.*]] = load i8*, i8* addrspace(257)* inttoptr (i32 16 to i8* addrspace(257)*)
-; GLOBAL32: %[[StackGuard:.*]] = call i8* @llvm.stackguard()
-; COMMON: store i8* %[[StackGuard]], i8** %[[StackGuardSlot:.*]]
+; TLS32: %[[StackGuard:.*]] = load ptr, ptr addrspace(256) inttoptr (i32 20 to ptr addrspace(256))
+; TLS64: %[[StackGuard:.*]] = load ptr, ptr addrspace(257) inttoptr (i32 40 to ptr addrspace(257))
+; FUCHSIA64: %[[StackGuard:.*]] = load ptr, ptr addrspace(257) inttoptr (i32 16 to ptr addrspace(257))
+; GLOBAL32: %[[StackGuard:.*]] = call ptr @llvm.stackguard()
+; COMMON: store ptr %[[StackGuard]], ptr %[[StackGuardSlot:.*]]
%a = alloca i8, align 1
- call void @Capture(i8* %a)
+ call void @Capture(ptr %a)
-; COMMON: %[[A:.*]] = load i8*, i8** %[[StackGuardSlot]]
-; COMMON: icmp ne i8* %[[StackGuard]], %[[A]]
+; COMMON: %[[A:.*]] = load ptr, ptr %[[StackGuardSlot]]
+; COMMON: icmp ne ptr %[[StackGuard]], %[[A]]
ret void
}
-declare void @Capture(i8*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/addr-taken.ll b/llvm/test/Transforms/SafeStack/X86/addr-taken.ll
index 0780a01..cd9f762 100644
--- a/llvm/test/Transforms/SafeStack/X86/addr-taken.ll
+++ b/llvm/test/Transforms/SafeStack/X86/addr-taken.ll
@@ -11,12 +11,12 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
%retval = alloca i32, align 4
%a = alloca i32, align 4
- %j = alloca i32*, align 8
- store i32 0, i32* %retval
- %0 = load i32, i32* %a, align 4
+ %j = alloca ptr, align 8
+ store i32 0, ptr %retval
+ %0 = load i32, ptr %a, align 4
%add = add nsw i32 %0, 1
- store i32 %add, i32* %a, align 4
- store i32* %a, i32** %j, align 8
+ store i32 %add, ptr %a, align 4
+ store ptr %a, ptr %j, align 8
ret void
}
diff --git a/llvm/test/Transforms/SafeStack/X86/array-aligned.ll b/llvm/test/Transforms/SafeStack/X86/array-aligned.ll
index 26558e4f..ed05d38 100644
--- a/llvm/test/Transforms/SafeStack/X86/array-aligned.ll
+++ b/llvm/test/Transforms/SafeStack/X86/array-aligned.ll
@@ -5,34 +5,30 @@
; array of [16 x i8]
-define void @foo(i8* %a) nounwind uwtable safestack {
+define void @foo(ptr %a) nounwind uwtable safestack {
entry:
- ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
- ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
+ ; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
- ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: store ptr %[[USST]], ptr @__safestack_unsafe_stack_ptr
- %a.addr = alloca i8*, align 8
+ %a.addr = alloca ptr, align 8
%buf = alloca [16 x i8], align 16
- ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8
- ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8
- store i8* %a, i8** %a.addr, align 8
+ ; CHECK: %[[AADDR:.*]] = alloca ptr, align 8
+ ; CHECK: store ptr {{.*}}, ptr %[[AADDR]], align 8
+ store ptr %a, ptr %a.addr, align 8
- ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
- ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to [16 x i8]*
- ; CHECK: %[[GEP:.*]] = getelementptr inbounds [16 x i8], [16 x i8]* %[[BUFPTR2]], i32 0, i32 0
- %gep = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0
+ ; CHECK: %[[A2:.*]] = load ptr, ptr %[[AADDR]], align 8
+ ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+ %a2 = load ptr, ptr %a.addr, align 8
- ; CHECK: %[[A2:.*]] = load i8*, i8** %[[AADDR]], align 8
- %a2 = load i8*, i8** %a.addr, align 8
+ ; CHECK: call ptr @strcpy(ptr %[[BUFPTR]], ptr %[[A2]])
+ %call = call ptr @strcpy(ptr %buf, ptr %a2)
- ; CHECK: call i8* @strcpy(i8* %[[GEP]], i8* %[[A2]])
- %call = call i8* @strcpy(i8* %gep, i8* %a2)
-
- ; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: store ptr %[[USP]], ptr @__safestack_unsafe_stack_ptr
ret void
}
-declare i8* @strcpy(i8*, i8*)
+declare ptr @strcpy(ptr, ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/array.ll b/llvm/test/Transforms/SafeStack/X86/array.ll
index b699352..45b43f6 100644
--- a/llvm/test/Transforms/SafeStack/X86/array.ll
+++ b/llvm/test/Transforms/SafeStack/X86/array.ll
@@ -5,36 +5,32 @@
; array [4 x i8]
; Requires protector.
-; CHECK: @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
-; SINGLE-THREAD: @__safestack_unsafe_stack_ptr = external global i8*
+; CHECK: @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global ptr
+; SINGLE-THREAD: @__safestack_unsafe_stack_ptr = external global ptr
-define void @foo(i8* %a) nounwind uwtable safestack {
+define void @foo(ptr %a) nounwind uwtable safestack {
entry:
- ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
- ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
+ ; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
- ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: store ptr %[[USST]], ptr @__safestack_unsafe_stack_ptr
- %a.addr = alloca i8*, align 8
+ %a.addr = alloca ptr, align 8
%buf = alloca [4 x i8], align 1
- ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8
- ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8
- store i8* %a, i8** %a.addr, align 8
+ ; CHECK: %[[AADDR:.*]] = alloca ptr, align 8
+ ; CHECK: store ptr {{.*}}, ptr %[[AADDR]], align 8
+ store ptr %a, ptr %a.addr, align 8
- ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -4
- ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to [4 x i8]*
- ; CHECK: %[[GEP:.*]] = getelementptr inbounds [4 x i8], [4 x i8]* %[[BUFPTR2]], i32 0, i32 0
- %gep = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0
+ ; CHECK: %[[A2:.*]] = load ptr, ptr %[[AADDR]], align 8
+ ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
+ %a2 = load ptr, ptr %a.addr, align 8
- ; CHECK: %[[A2:.*]] = load i8*, i8** %[[AADDR]], align 8
- %a2 = load i8*, i8** %a.addr, align 8
+ ; CHECK: call ptr @strcpy(ptr %[[BUFPTR]], ptr %[[A2]])
+ %call = call ptr @strcpy(ptr %buf, ptr %a2)
- ; CHECK: call i8* @strcpy(i8* %[[GEP]], i8* %[[A2]])
- %call = call i8* @strcpy(i8* %gep, i8* %a2)
-
- ; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: store ptr %[[USP]], ptr @__safestack_unsafe_stack_ptr
ret void
}
@@ -45,8 +41,8 @@ entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret i8
%buf = alloca i8, i32 4, align 1
- %gep = getelementptr inbounds i8, i8* %buf, i32 2
- %x = load i8, i8* %gep, align 1
+ %gep = getelementptr inbounds i8, ptr %buf, i32 2
+ %x = load i8, ptr %gep, align 1
ret i8 %x
}
@@ -57,8 +53,8 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret i8
%buf = alloca i8, i32 4, align 1
- %gep = getelementptr inbounds i8, i8* %buf, i32 5
- %x = load i8, i8* %gep, align 1
+ %gep = getelementptr inbounds i8, ptr %buf, i32 5
+ %x = load i8, ptr %gep, align 1
ret i8 %x
}
@@ -69,8 +65,8 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret i8
%buf = alloca i8, i32 4, align 1
- %gep = getelementptr inbounds i8, i8* %buf, i32 %ofs
- %x = load i8, i8* %gep, align 1
+ %gep = getelementptr inbounds i8, ptr %buf, i32 %ofs
+ %x = load i8, ptr %gep, align 1
ret i8 %x
}
@@ -81,9 +77,9 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret i8
%buf = alloca i8, i32 %sz, align 1
- %gep = getelementptr inbounds i8, i8* %buf, i32 2
- %x = load i8, i8* %gep, align 1
+ %gep = getelementptr inbounds i8, ptr %buf, i32 2
+ %x = load i8, ptr %gep, align 1
ret i8 %x
}
-declare i8* @strcpy(i8*, i8*)
+declare ptr @strcpy(ptr, ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/byval.ll b/llvm/test/Transforms/SafeStack/X86/byval.ll
index e417213..761265e 100644
--- a/llvm/test/Transforms/SafeStack/X86/byval.ll
+++ b/llvm/test/Transforms/SafeStack/X86/byval.ll
@@ -7,61 +7,58 @@ target triple = "x86_64-unknown-linux-gnu"
%struct.S = type { [100 x i32] }
; Safe access to a byval argument.
-define i32 @ByValSafe(%struct.S* byval(%struct.S) nocapture readonly align 8 %zzz) norecurse nounwind readonly safestack uwtable {
+define i32 @ByValSafe(ptr byval(%struct.S) nocapture readonly align 8 %zzz) norecurse nounwind readonly safestack uwtable {
entry:
; CHECK-LABEL: @ByValSafe
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret i32
- %arrayidx = getelementptr inbounds %struct.S, %struct.S* %zzz, i64 0, i32 0, i64 3
- %0 = load i32, i32* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds %struct.S, ptr %zzz, i64 0, i32 0, i64 3
+ %0 = load i32, ptr %arrayidx, align 4
ret i32 %0
}
; Unsafe access to a byval argument.
; Argument is copied to the unsafe stack.
-define i32 @ByValUnsafe(%struct.S* byval(%struct.S) nocapture readonly align 8 %zzz, i64 %idx) norecurse nounwind readonly safestack uwtable {
+define i32 @ByValUnsafe(ptr byval(%struct.S) nocapture readonly align 8 %zzz, i64 %idx) norecurse nounwind readonly safestack uwtable {
entry:
; CHECK-LABEL: @ByValUnsafe
; CHECK: %[[A:.*]] = load {{.*}} @__safestack_unsafe_stack_ptr
; CHECK: store {{.*}} @__safestack_unsafe_stack_ptr
- ; CHECK: %[[B:.*]] = getelementptr i8, i8* %[[A]], i32 -400
- ; CHECK: %[[C:.*]] = bitcast %struct.S* %zzz to i8*
- ; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %[[B]], i8* align 8 %[[C]], i64 400, i1 false)
+ ; CHECK: %[[B:.*]] = getelementptr i8, ptr %[[A]], i32 -400
+ ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[B]], ptr align 8 %zzz, i64 400, i1 false)
; CHECK: ret i32
- %arrayidx = getelementptr inbounds %struct.S, %struct.S* %zzz, i64 0, i32 0, i64 %idx
- %0 = load i32, i32* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds %struct.S, ptr %zzz, i64 0, i32 0, i64 %idx
+ %0 = load i32, ptr %arrayidx, align 4
ret i32 %0
}
; Unsafe access to a byval argument.
; Argument is copied to the unsafe stack.
; Check that dest align of memcpy is set according to datalayout prefered alignment
-define i32 @ByValUnsafe2(%struct.S* byval(%struct.S) nocapture readonly %zzz, i64 %idx) norecurse nounwind readonly safestack uwtable {
+define i32 @ByValUnsafe2(ptr byval(%struct.S) nocapture readonly %zzz, i64 %idx) norecurse nounwind readonly safestack uwtable {
entry:
; CHECK-LABEL: @ByValUnsafe
; CHECK: %[[A:.*]] = load {{.*}} @__safestack_unsafe_stack_ptr
; CHECK: store {{.*}} @__safestack_unsafe_stack_ptr
- ; CHECK: %[[B:.*]] = getelementptr i8, i8* %[[A]], i32 -400
- ; CHECK: %[[C:.*]] = bitcast %struct.S* %zzz to i8*
- ; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %[[B]], i8* %[[C]], i64 400, i1 false)
+ ; CHECK: %[[B:.*]] = getelementptr i8, ptr %[[A]], i32 -400
+ ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[B]], ptr %zzz, i64 400, i1 false)
; CHECK: ret i32
- %arrayidx = getelementptr inbounds %struct.S, %struct.S* %zzz, i64 0, i32 0, i64 %idx
- %0 = load i32, i32* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds %struct.S, ptr %zzz, i64 0, i32 0, i64 %idx
+ %0 = load i32, ptr %arrayidx, align 4
ret i32 %0
}
; Highly aligned byval argument.
-define i32 @ByValUnsafeAligned(%struct.S* byval(%struct.S) nocapture readonly align 64 %zzz, i64 %idx) norecurse nounwind readonly safestack uwtable {
+define i32 @ByValUnsafeAligned(ptr byval(%struct.S) nocapture readonly align 64 %zzz, i64 %idx) norecurse nounwind readonly safestack uwtable {
entry:
; CHECK-LABEL: @ByValUnsafeAligned
; CHECK: %[[A:.*]] = load {{.*}} @__safestack_unsafe_stack_ptr
- ; CHECK: %[[B:.*]] = ptrtoint i8* %[[A]] to i64
+ ; CHECK: %[[B:.*]] = ptrtoint ptr %[[A]] to i64
; CHECK: and i64 %[[B]], -64
; CHECK: ret i32
- %arrayidx = getelementptr inbounds %struct.S, %struct.S* %zzz, i64 0, i32 0, i64 0
- %0 = load i32, i32* %arrayidx, align 64
- %arrayidx2 = getelementptr inbounds %struct.S, %struct.S* %zzz, i64 0, i32 0, i64 %idx
- %1 = load i32, i32* %arrayidx2, align 4
+ %0 = load i32, ptr %zzz, align 64
+ %arrayidx2 = getelementptr inbounds %struct.S, ptr %zzz, i64 0, i32 0, i64 %idx
+ %1 = load i32, ptr %arrayidx2, align 4
%add = add nsw i32 %1, %0
ret i32 %add
}
diff --git a/llvm/test/Transforms/SafeStack/X86/call.ll b/llvm/test/Transforms/SafeStack/X86/call.ll
index a1ce30a..bb1b462 100644
--- a/llvm/test/Transforms/SafeStack/X86/call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/call.ll
@@ -9,19 +9,19 @@ target triple = "x86_64-unknown-linux-gnu"
; no arrays / no nested arrays
; Requires no protector.
-define void @foo(i8* %a) nounwind uwtable safestack {
+define void @foo(ptr %a) nounwind uwtable safestack {
entry:
; CHECK-LABEL: define void @foo(
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret void
- %a.addr = alloca i8*, align 8
- store i8* %a, i8** %a.addr, align 8
- %0 = load i8*, i8** %a.addr, align 8
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %0)
+ %a.addr = alloca ptr, align 8
+ store ptr %a, ptr %a.addr, align 8
+ %0 = load ptr, ptr %a.addr, align 8
+ %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0)
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
define void @call_memset(i64 %len) safestack {
entry:
@@ -29,8 +29,7 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @llvm.memset.p0i8.i64(i8* %arraydecay, i8 1, i64 %len, i1 false)
+ call void @llvm.memset.p0.i64(ptr %q, i8 1, i64 %len, i1 false)
ret void
}
@@ -40,8 +39,8 @@ entry:
; CHECK-NOT: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 2
- call void @llvm.memset.p0i8.i64(i8* %arraydecay, i8 1, i64 7, i1 false)
+ %arraydecay = getelementptr inbounds [10 x i8], ptr %q, i32 0, i32 2
+ call void @llvm.memset.p0.i64(ptr %arraydecay, i8 1, i64 7, i1 false)
ret void
}
@@ -51,8 +50,8 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 7
- call void @llvm.memset.p0i8.i64(i8* %arraydecay, i8 1, i64 5, i1 false)
+ %arraydecay = getelementptr inbounds [10 x i8], ptr %q, i32 0, i32 7
+ call void @llvm.memset.p0.i64(ptr %arraydecay, i8 1, i64 5, i1 false)
ret void
}
@@ -62,8 +61,8 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr [10 x i8], [10 x i8]* %q, i32 0, i32 -1
- call void @llvm.memset.p0i8.i64(i8* %arraydecay, i8 1, i64 3, i1 false)
+ %arraydecay = getelementptr [10 x i8], ptr %q, i32 0, i32 -1
+ call void @llvm.memset.p0.i64(ptr %arraydecay, i8 1, i64 3, i1 false)
ret void
}
@@ -74,8 +73,7 @@ entry:
; CHECK-NOT: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @readnone(i8* %arraydecay)
+ call void @readnone(ptr %q)
ret void
}
@@ -86,8 +84,7 @@ entry:
; CHECK-NOT: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @readnone0(i8* %arraydecay, i8* zeroinitializer)
+ call void @readnone0(ptr %q, ptr zeroinitializer)
ret void
}
@@ -98,8 +95,7 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @readnone0(i8 *zeroinitializer, i8* %arraydecay)
+ call void @readnone0(ptr zeroinitializer, ptr %q)
ret void
}
@@ -110,8 +106,7 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @readonly(i8* %arraydecay)
+ call void @readonly(ptr %q)
ret void
}
@@ -122,8 +117,7 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @arg_readonly(i8* %arraydecay)
+ call void @arg_readonly(ptr %q)
ret void
}
@@ -134,8 +128,7 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @readwrite(i8* %arraydecay)
+ call void @readwrite(ptr %q)
ret void
}
@@ -146,33 +139,31 @@ entry:
; CHECK: @__safestack_unsafe_stack_ptr
; CHECK: ret void
%q = alloca [10 x i8], align 1
- %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %q, i32 0, i32 0
- call void @capture(i8* %arraydecay)
+ call void @capture(ptr %q)
ret void
}
; Lifetime intrinsics are always safe.
-define void @call_lifetime(i32* %p) {
+define void @call_lifetime(ptr %p) {
; CHECK-LABEL: define void @call_lifetime
; CHECK-NOT: @__safestack_unsafe_stack_ptr
; CHECK: ret void
entry:
%q = alloca [100 x i8], align 16
- %0 = bitcast [100 x i8]* %q to i8*
- call void @llvm.lifetime.start.p0i8(i64 100, i8* %0)
- call void @llvm.lifetime.end.p0i8(i64 100, i8* %0)
+ call void @llvm.lifetime.start.p0(i64 100, ptr %q)
+ call void @llvm.lifetime.end.p0(i64 100, ptr %q)
ret void
}
-declare void @readonly(i8* nocapture) readonly
-declare void @arg_readonly(i8* readonly nocapture)
-declare void @readwrite(i8* nocapture)
-declare void @capture(i8* readnone) readnone
+declare void @readonly(ptr nocapture) readonly
+declare void @arg_readonly(ptr readonly nocapture)
+declare void @readwrite(ptr nocapture)
+declare void @capture(ptr readnone) readnone
-declare void @readnone(i8* nocapture) readnone
-declare void @readnone0(i8* nocapture readnone, i8* nocapture)
+declare void @readnone(ptr nocapture) readnone
+declare void @readnone0(ptr nocapture readnone, ptr nocapture)
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind argmemonly
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind argmemonly
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind argmemonly
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) nounwind argmemonly
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind argmemonly
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) nounwind argmemonly
diff --git a/llvm/test/Transforms/SafeStack/X86/cast.ll b/llvm/test/Transforms/SafeStack/X86/cast.ll
index 23f525d..41f01c3 100644
--- a/llvm/test/Transforms/SafeStack/X86/cast.ll
+++ b/llvm/test/Transforms/SafeStack/X86/cast.ll
@@ -11,8 +11,8 @@ entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret void
%a = alloca i32, align 4
- %0 = ptrtoint i32* %a to i64
- %1 = inttoptr i64 %0 to i32*
+ %0 = ptrtoint ptr %a to i64
+ %1 = inttoptr i64 %0 to ptr
ret void
}
@@ -22,9 +22,8 @@ entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret i8
%a = alloca i32, align 4
- %0 = bitcast i32* %a to i8*
- %1 = load i8, i8* %0, align 1
- ret i8 %1
+ %0 = load i8, ptr %a, align 1
+ ret i8 %0
}
define i64 @BitCastWide() nounwind uwtable safestack {
@@ -33,7 +32,6 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret i64
%a = alloca i32, align 4
- %0 = bitcast i32* %a to i64*
- %1 = load i64, i64* %0, align 1
- ret i64 %1
+ %0 = load i64, ptr %a, align 1
+ ret i64 %0
}
diff --git a/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll b/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll
index 040632e..032ffd1 100644
--- a/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll
@@ -4,31 +4,28 @@
define void @f() safestack sspreq {
; CHECK-LABEL: define void @f
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
-; CHECK: %[[A:.*]] = getelementptr i8, i8* %[[USP]], i32 -8
-; CHECK: %[[StackGuardSlot:.*]] = bitcast i8* %[[A]] to i8**
-; CHECK: store i8* %{{.*}}, i8** %[[StackGuardSlot]]
+; CHECK: %[[A:.*]] = getelementptr i8, ptr %[[USP]], i32 -8
+; CHECK: store ptr %{{.*}}, ptr %[[A]]
%x = alloca i64, align 8
%y = alloca i64, align 8
- %x0 = bitcast i64* %x to i8*
- %y0 = bitcast i64* %y to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
- call void @capture64(i64* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
+ call void @capture64(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
- call void @capture64(i64* %y)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
+ call void @capture64(ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
ret void
}
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
-declare void @capture64(i64*)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
+declare void @capture64(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/coloring.ll b/llvm/test/Transforms/SafeStack/X86/coloring.ll
index 60e960e..37bdccf 100644
--- a/llvm/test/Transforms/SafeStack/X86/coloring.ll
+++ b/llvm/test/Transforms/SafeStack/X86/coloring.ll
@@ -3,42 +3,36 @@
define void @f() safestack {
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%x1 = alloca i32, align 4
%x2 = alloca i32, align 4
- %0 = bitcast i32* %x to i8*
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %0)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %x)
-; CHECK: %[[A1:.*]] = getelementptr i8, i8* %[[USP]], i32 -4
-; CHECK: %[[A2:.*]] = bitcast i8* %[[A1]] to i32*
-; CHECK: call void @capture(i32* nonnull %[[A2]])
+; CHECK: %[[A1:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
+; CHECK: call void @capture(ptr nonnull %[[A1]])
- call void @capture(i32* nonnull %x)
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %0)
- %1 = bitcast i32* %x1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %1)
+ call void @capture(ptr nonnull %x)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %x)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %x1)
-; CHECK: %[[B1:.*]] = getelementptr i8, i8* %[[USP]], i32 -4
-; CHECK: %[[B2:.*]] = bitcast i8* %[[B1]] to i32*
-; CHECK: call void @capture(i32* nonnull %[[B2]])
+; CHECK: %[[B1:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
+; CHECK: call void @capture(ptr nonnull %[[B1]])
- call void @capture(i32* nonnull %x1)
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %1)
- %2 = bitcast i32* %x2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %2)
+ call void @capture(ptr nonnull %x1)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %x1)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %x2)
-; CHECK: %[[C1:.*]] = getelementptr i8, i8* %[[USP]], i32 -4
-; CHECK: %[[C2:.*]] = bitcast i8* %[[C1]] to i32*
-; CHECK: call void @capture(i32* nonnull %[[C2]])
+; CHECK: %[[C1:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
+; CHECK: call void @capture(ptr nonnull %[[C1]])
- call void @capture(i32* nonnull %x2)
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %2)
+ call void @capture(ptr nonnull %x2)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %x2)
ret void
}
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
-declare void @capture(i32*)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
+declare void @capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/coloring2.ll b/llvm/test/Transforms/SafeStack/X86/coloring2.ll
index dae9feb..b2f5990 100644
--- a/llvm/test/Transforms/SafeStack/X86/coloring2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/coloring2.ll
@@ -5,31 +5,28 @@
define void @f() safestack {
; CHECK-LABEL: define void @f
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- %z0 = bitcast i32* %z to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %z0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %z)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
- call void @capture32(i32* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
+ call void @capture32(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
- call void @capture32(i32* %y)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
+ call void @capture32(ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @capture32(i32* %z)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %z0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @capture32(ptr %z)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %z)
ret void
}
@@ -37,21 +34,20 @@ entry:
define void @no_markers() safestack {
; CHECK-LABEL: define void @no_markers(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
- call void @capture32(i32* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
+ call void @capture32(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @capture32(i32* %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @capture32(ptr %y)
ret void
}
@@ -60,31 +56,28 @@ entry:
define void @g() safestack {
; CHECK-LABEL: define void @g
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i64, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- %z0 = bitcast i64* %z to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
- call void @capture32(i32* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
+ call void @capture32(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @capture32(i32* %y)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %z0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @capture32(ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %z)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @capture64(i64* %z)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %z0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @capture64(ptr %z)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %z)
ret void
}
@@ -93,32 +86,29 @@ entry:
define void @h() safestack {
; CHECK-LABEL: define void @h
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 16
%z = alloca i64, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- %z0 = bitcast i64* %z to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %z0)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %z)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
- call void @capture32(i32* %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
+ call void @capture32(ptr %x)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -12
- call void @capture32(i32* %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -12
+ call void @capture32(ptr %y)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @capture64(i64* %z)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @capture64(ptr %z)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %z0)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %z)
ret void
}
@@ -145,8 +135,8 @@ entry:
define void @i(i1 zeroext %a, i1 zeroext %b) safestack {
; CHECK-LABEL: define void @i
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -32
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -32
%x1 = alloca i64, align 8
%x2 = alloca i64, align 8
%y = alloca i64, align 8
@@ -155,81 +145,73 @@ entry:
%z = alloca i64, align 8
%z1 = alloca i64, align 8
%z2 = alloca i64, align 8
- %0 = bitcast i64* %x1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %0)
- %1 = bitcast i64* %x2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %1)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x1)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x2)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %x1)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+ call void @capture64(ptr nonnull %x1)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %x2)
+ call void @capture64(ptr nonnull %x2)
br i1 %a, label %if.then, label %if.else4
if.then: ; preds = %entry
- %2 = bitcast i64* %y to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %2)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -24
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -24
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %y)
+ call void @capture64(ptr nonnull %y)
br i1 %b, label %if.then3, label %if.else
if.then3: ; preds = %if.then
- %3 = bitcast i64* %y1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %3)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y1)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -32
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %y1)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %3)
+ call void @capture64(ptr nonnull %y1)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y1)
br label %if.end
if.else: ; preds = %if.then
- %4 = bitcast i64* %y2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %4)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y2)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -32
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %y2)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %4)
+ call void @capture64(ptr nonnull %y2)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y2)
br label %if.end
if.end: ; preds = %if.else, %if.then3
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %2)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
br label %if.end9
if.else4: ; preds = %entry
- %5 = bitcast i64* %z to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %5)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -24
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %z)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -24
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %z)
+ call void @capture64(ptr nonnull %z)
br i1 %b, label %if.then6, label %if.else7
if.then6: ; preds = %if.else4
- %6 = bitcast i64* %z1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %6)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %z1)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -32
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %z1)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %6)
+ call void @capture64(ptr nonnull %z1)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %z1)
br label %if.end8
if.else7: ; preds = %if.else4
- %7 = bitcast i64* %z2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %7)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %z2)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -32
; CHECK: call void @capture64(
- call void @capture64(i64* nonnull %z2)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %7)
+ call void @capture64(ptr nonnull %z2)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %z2)
br label %if.end8
if.end8: ; preds = %if.else7, %if.then6
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %5)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %z)
br label %if.end9
if.end9: ; preds = %if.end8, %if.end
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %1)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %0)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x2)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x1)
ret void
}
@@ -237,51 +219,47 @@ if.end9: ; preds = %if.end8, %if.end
define void @no_merge1(i1 %d) safestack {
; CHECK-LABEL: define void @no_merge1(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %x)
+ call void @capture32(ptr %x)
br i1 %d, label %bb2, label %bb3
bb2:
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
; CHECK: call void @capture32(
- call void @capture32(i32* %y)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+ call void @capture32(ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
ret void
bb3:
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
ret void
}
define void @merge1(i1 %d) safestack {
; CHECK-LABEL: define void @merge1(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+ call void @capture32(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
br i1 %d, label %bb2, label %bb3
bb2:
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %y)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
+ call void @capture32(ptr %y)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %y)
ret void
bb3:
ret void
@@ -291,23 +269,21 @@ bb3:
define void @merge2_noend(i1 %d) safestack {
; CHECK-LABEL: define void @merge2_noend(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+ call void @capture32(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
br i1 %d, label %bb2, label %bb3
bb2:
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %y)
+ call void @capture32(ptr %y)
ret void
bb3:
ret void
@@ -317,23 +293,21 @@ bb3:
define void @merge3_noend(i1 %d) safestack {
; CHECK-LABEL: define void @merge3_noend(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %x)
+ call void @capture32(ptr %x)
br i1 %d, label %bb2, label %bb3
bb2:
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %y)
+ call void @capture32(ptr %y)
ret void
bb3:
ret void
@@ -343,22 +317,20 @@ bb3:
define void @nomerge4_nostart(i1 %d) safestack {
; CHECK-LABEL: define void @nomerge4_nostart(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i32, align 4
%y = alloca i32, align 4
- %x0 = bitcast i32* %x to i8*
- %y0 = bitcast i32* %y to i8*
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
; CHECK: call void @capture32(
- call void @capture32(i32* %x)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
+ call void @capture32(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %x)
br i1 %d, label %bb2, label %bb3
bb2:
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %y)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
; CHECK: call void @capture32(
- call void @capture32(i32* %y)
+ call void @capture32(ptr %y)
ret void
bb3:
ret void
@@ -367,54 +339,50 @@ bb3:
define void @array_merge() safestack {
; CHECK-LABEL: define void @array_merge(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -800
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -800
%A.i1 = alloca [100 x i32], align 4
%B.i2 = alloca [100 x i32], align 4
%A.i = alloca [100 x i32], align 4
%B.i = alloca [100 x i32], align 4
- %0 = bitcast [100 x i32]* %A.i to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %0)
- %1 = bitcast [100 x i32]* %B.i to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %1)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -400
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %A.i)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %B.i)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -400
; CHECK: call void @capture100x32(
- call void @capture100x32([100 x i32]* %A.i)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -800
+ call void @capture100x32(ptr %A.i)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -800
; CHECK: call void @capture100x32(
- call void @capture100x32([100 x i32]* %B.i)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %0)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %1)
- %2 = bitcast [100 x i32]* %A.i1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %2)
- %3 = bitcast [100 x i32]* %B.i2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %3)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -400
+ call void @capture100x32(ptr %B.i)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %A.i)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %B.i)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %A.i1)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %B.i2)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -400
; CHECK: call void @capture100x32(
- call void @capture100x32([100 x i32]* %A.i1)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -800
+ call void @capture100x32(ptr %A.i1)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -800
; CHECK: call void @capture100x32(
- call void @capture100x32([100 x i32]* %B.i2)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %2)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %3)
+ call void @capture100x32(ptr %B.i2)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %A.i1)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %B.i2)
ret void
}
define void @myCall_pr15707() safestack {
; CHECK-LABEL: define void @myCall_pr15707(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -200000
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -200000
%buf1 = alloca i8, i32 100000, align 16
%buf2 = alloca i8, i32 100000, align 16
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %buf1)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %buf1)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %buf1)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %buf1)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %buf1)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %buf2)
- call void @capture8(i8* %buf1)
- call void @capture8(i8* %buf2)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %buf1)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %buf2)
+ call void @capture8(ptr %buf1)
+ call void @capture8(ptr %buf2)
ret void
}
@@ -423,9 +391,9 @@ entry:
define void @bad_range() safestack {
; CHECK-LABEL: define void @bad_range(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
; A.i and B.i unsafe, not merged
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -800
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -800
; A.i1 and B.i2 safe
; CHECK: = alloca [100 x i32], align 4
; CHECK: = alloca [100 x i32], align 4
@@ -434,58 +402,53 @@ entry:
%B.i2 = alloca [100 x i32], align 4
%A.i = alloca [100 x i32], align 4
%B.i = alloca [100 x i32], align 4
- %0 = bitcast [100 x i32]* %A.i to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %0) nounwind
- %1 = bitcast [100 x i32]* %B.i to i8*
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %1) nounwind
- call void @capture100x32([100 x i32]* %A.i)
- call void @capture100x32([100 x i32]* %B.i)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %0) nounwind
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %1) nounwind
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %A.i) nounwind
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %B.i) nounwind
+ call void @capture100x32(ptr %A.i)
+ call void @capture100x32(ptr %B.i)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %A.i) nounwind
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %B.i) nounwind
br label %block2
block2:
; I am used outside the marked lifetime.
- call void @capture100x32([100 x i32]* %A.i)
- call void @capture100x32([100 x i32]* %B.i)
+ call void @capture100x32(ptr %A.i)
+ call void @capture100x32(ptr %B.i)
ret void
}
%struct.Klass = type { i32, i32 }
-define i32 @shady_range(i32 %argc, i8** nocapture %argv) safestack {
+define i32 @shady_range(i32 %argc, ptr nocapture %argv) safestack {
; CHECK-LABEL: define i32 @shady_range(
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -64
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -64
%a.i = alloca [4 x %struct.Klass], align 16
%b.i = alloca [4 x %struct.Klass], align 16
- %a8 = bitcast [4 x %struct.Klass]* %a.i to i8*
- %b8 = bitcast [4 x %struct.Klass]* %b.i to i8*
; I am used outside the lifetime zone below:
- %z2 = getelementptr inbounds [4 x %struct.Klass], [4 x %struct.Klass]* %a.i, i64 0, i64 0, i32 0
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %a8)
- call void @llvm.lifetime.start.p0i8(i64 -1, i8* %b8)
- call void @capture8(i8* %a8)
- call void @capture8(i8* %b8)
- %z3 = load i32, i32* %z2, align 16
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %a8)
- call void @llvm.lifetime.end.p0i8(i64 -1, i8* %b8)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %a.i)
+ call void @llvm.lifetime.start.p0(i64 -1, ptr %b.i)
+ call void @capture8(ptr %a.i)
+ call void @capture8(ptr %b.i)
+ %z3 = load i32, ptr %a.i, align 16
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %a.i)
+ call void @llvm.lifetime.end.p0(i64 -1, ptr %b.i)
ret i32 %z3
}
define void @end_loop() safestack {
; CHECK-LABEL: define void @end_loop()
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i8, align 4
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %x) nounwind
+ call void @llvm.lifetime.start.p0(i64 4, ptr %x) nounwind
br label %l2
l2:
- call void @capture8(i8* %x)
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %x) nounwind
+ call void @capture8(ptr %x)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %x) nounwind
br label %l2
}
@@ -494,22 +457,22 @@ l2:
define void @start_loop() safestack {
; CHECK-LABEL: define void @start_loop()
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
%x = alloca i8, align 4
%y = alloca i8, align 4
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %x) nounwind
+ call void @llvm.lifetime.start.p0(i64 4, ptr %x) nounwind
br label %l2
l2:
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %y) nounwind
- call void @capture8(i8* %y)
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %y) nounwind
-
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %x) nounwind
- call void @capture8(i8* %x)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @llvm.lifetime.start.p0(i64 4, ptr %y) nounwind
+ call void @capture8(ptr %y)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %y) nounwind
+
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
+ call void @llvm.lifetime.start.p0(i64 4, ptr %x) nounwind
+ call void @capture8(ptr %x)
br label %l2
}
@@ -522,43 +485,40 @@ l2:
; CHECK-LABEL: @stack_coloring_liveness_bug
define void @stack_coloring_liveness_bug(i32 %arg0) #0 {
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -64
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -64
%alloca = alloca [32 x i8], align 16
%alloca2 = alloca [32 x i8], align 16
%cond = icmp eq i32 %arg0, 0
br i1 %cond, label %if, label %else
if:
- %alloca.if = bitcast [32 x i8]* %alloca to i8*
br label %end
else:
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
- %alloca.else = bitcast [32 x i8]* %alloca to i8*
- call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %alloca.else)
- call void @capture8(i8* %alloca.else)
- call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %alloca.else)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -32
+ call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %alloca)
+ call void @capture8(ptr %alloca)
+ call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %alloca)
br label %end
end:
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -64
- %alloca.end = phi i8* [ %alloca.if, %if], [%alloca.else, %else]
- %alloca2.bitcast = bitcast [32 x i8]* %alloca2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %alloca2.bitcast)
- call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %alloca.end)
- call void @capture2_8(i8* %alloca2.bitcast, i8* %alloca.end)
- call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %alloca2.bitcast)
- call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %alloca.end)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -64
+ %alloca.end = phi ptr [ %alloca, %if], [%alloca, %else]
+ call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %alloca2)
+ call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %alloca.end)
+ call void @capture2_8(ptr %alloca2, ptr %alloca.end)
+ call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %alloca2)
+ call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %alloca.end)
ret void
}
attributes #0 = { safestack }
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
-declare void @capture8(i8*)
-declare void @capture32(i32*)
-declare void @capture64(i64*)
-declare void @capture100x32([100 x i32]*)
-declare void @capture2_8(i8*, i8*)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
+declare void @capture8(ptr)
+declare void @capture32(ptr)
+declare void @capture64(ptr)
+declare void @capture100x32(ptr)
+declare void @capture2_8(ptr, ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll b/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll
index 456c1cb..880471a 100644
--- a/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll
@@ -16,11 +16,10 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
%c = alloca %struct.nest, align 4
- %b = getelementptr inbounds %struct.nest, %struct.nest* %c, i32 0, i32 1
- %_a = getelementptr inbounds %struct.pair, %struct.pair* %b, i32 0, i32 0
- %0 = load i32, i32* %_a, align 4
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %0)
+ %b = getelementptr inbounds %struct.nest, ptr %c, i32 0, i32 1
+ %0 = load i32, ptr %b, align 4
+ %call = call i32 (ptr, ...) @printf(ptr @.str, i32 %0)
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/constant-gep.ll b/llvm/test/Transforms/SafeStack/X86/constant-gep.ll
index 6468a76..935c362 100644
--- a/llvm/test/Transforms/SafeStack/X86/constant-gep.ll
+++ b/llvm/test/Transforms/SafeStack/X86/constant-gep.ll
@@ -13,8 +13,6 @@ define signext i8 @foo() nounwind uwtable safestack {
entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
%a = alloca %class.A, align 1
- %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0
- %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0
- %0 = load i8, i8* %arrayidx, align 1
+ %0 = load i8, ptr %a, align 1
ret i8 %0
}
diff --git a/llvm/test/Transforms/SafeStack/X86/constant-geps.ll b/llvm/test/Transforms/SafeStack/X86/constant-geps.ll
index 8a6f754..fd099db 100644
--- a/llvm/test/Transforms/SafeStack/X86/constant-geps.ll
+++ b/llvm/test/Transforms/SafeStack/X86/constant-geps.ll
@@ -17,12 +17,6 @@ define signext i8 @foo() nounwind uwtable safestack {
entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
%x = alloca %struct.deep, align 1
- %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0
- %c = bitcast %union.anon* %b to %struct.anon*
- %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0
- %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0
- %array = bitcast %union.anon.1* %e to [2 x i8]*
- %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0
- %0 = load i8, i8* %arrayidx, align 1
+ %0 = load i8, ptr %x, align 1
ret i8 %0
}
diff --git a/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll b/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll
index c944f84..c118c48 100644
--- a/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll
+++ b/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll
@@ -13,17 +13,17 @@ entry:
tail call void @llvm.dbg.value(metadata i32 %n, metadata !11, metadata !14), !dbg !15
%0 = zext i32 %n to i64, !dbg !16
-; CHECK: store i8* %[[VLA:.*]], i8** @__safestack_unsafe_stack_ptr
-; CHECK: tail call void @llvm.dbg.value(metadata i8* %[[VLA]], metadata ![[TYPE:.*]], metadata !DIExpression(DW_OP_deref))
+; CHECK: store ptr %[[VLA:.*]], ptr @__safestack_unsafe_stack_ptr
+; CHECK: tail call void @llvm.dbg.value(metadata ptr %[[VLA]], metadata ![[TYPE:.*]], metadata !DIExpression(DW_OP_deref))
; CHECK: call void @capture({{.*}} %[[VLA]])
%vla = alloca i8, i64 %0, align 16, !dbg !16
- tail call void @llvm.dbg.value(metadata i8* %vla, metadata !12, metadata !17), !dbg !18
- call void @capture(i8* nonnull %vla), !dbg !19
+ tail call void @llvm.dbg.value(metadata ptr %vla, metadata !12, metadata !17), !dbg !18
+ call void @capture(ptr nonnull %vla), !dbg !19
ret void, !dbg !20
}
-declare void @capture(i8*)
+declare void @capture(ptr)
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
diff --git a/llvm/test/Transforms/SafeStack/X86/debug-loc.ll b/llvm/test/Transforms/SafeStack/X86/debug-loc.ll
index 2b0018a..8501f74 100644
--- a/llvm/test/Transforms/SafeStack/X86/debug-loc.ll
+++ b/llvm/test/Transforms/SafeStack/X86/debug-loc.ll
@@ -8,25 +8,25 @@ target triple = "x86_64-unknown-linux-gnu"
%struct.S = type { [100 x i8] }
; Function Attrs: safestack uwtable
-define void @f(%struct.S* byval(%struct.S) align 8 %zzz) #0 !dbg !12 {
+define void @f(ptr byval(%struct.S) align 8 %zzz) #0 !dbg !12 {
; CHECK: define void @f
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
%xxx = alloca %struct.S, align 1
- call void @llvm.dbg.declare(metadata %struct.S* %zzz, metadata !18, metadata !19), !dbg !20
- call void @llvm.dbg.declare(metadata %struct.S* %xxx, metadata !21, metadata !19), !dbg !22
+ call void @llvm.dbg.declare(metadata ptr %zzz, metadata !18, metadata !19), !dbg !20
+ call void @llvm.dbg.declare(metadata ptr %xxx, metadata !21, metadata !19), !dbg !22
; dbg.declare for %zzz and %xxx are gone; replaced with dbg.declare based off the unsafe stack pointer
; CHECK-NOT: call void @llvm.dbg.declare
-; CHECK: call void @llvm.dbg.declare(metadata i8* %[[USP]], metadata ![[VAR_ARG:.*]], metadata !DIExpression(DW_OP_constu, 104, DW_OP_minus))
+; CHECK: call void @llvm.dbg.declare(metadata ptr %[[USP]], metadata ![[VAR_ARG:.*]], metadata !DIExpression(DW_OP_constu, 104, DW_OP_minus))
; CHECK-NOT: call void @llvm.dbg.declare
-; CHECK: call void @llvm.dbg.declare(metadata i8* %[[USP]], metadata ![[VAR_LOCAL:.*]], metadata !DIExpression(DW_OP_constu, 208, DW_OP_minus))
+; CHECK: call void @llvm.dbg.declare(metadata ptr %[[USP]], metadata ![[VAR_LOCAL:.*]], metadata !DIExpression(DW_OP_constu, 208, DW_OP_minus))
; CHECK-NOT: call void @llvm.dbg.declare
- call void @Capture(%struct.S* %zzz), !dbg !23
- call void @Capture(%struct.S* %xxx), !dbg !24
+ call void @Capture(ptr %zzz), !dbg !23
+ call void @Capture(ptr %xxx), !dbg !24
; dbg.declare appears before the first use
; CHECK: call void @Capture
@@ -43,7 +43,7 @@ entry:
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-declare void @Capture(%struct.S*) #2
+declare void @Capture(ptr) #2
attributes #0 = { safestack uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone }
diff --git a/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll b/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll
index 0903378..05b66a5 100644
--- a/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll
@@ -10,46 +10,44 @@ target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: noinline safestack uwtable
define void @f() #0 !dbg !6 {
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
%x1 = alloca i32, align 4
%x2 = alloca i32, align 4
- %0 = bitcast i32* %x1 to i8*, !dbg !13
- %1 = bitcast i32* %x2 to i8*, !dbg !14
; Unhandled dbg.value: expression does not start with OP_DW_deref
-; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}})
- tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !23), !dbg !16
+; CHECK: call void @llvm.dbg.value(metadata ptr undef, metadata !{{.*}}, metadata !{{.*}})
+ tail call void @llvm.dbg.value(metadata ptr %x1, metadata !10, metadata !23), !dbg !16
; Unhandled dbg.value: expression does not start with OP_DW_deref
-; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}})
- tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !24), !dbg !16
+; CHECK: call void @llvm.dbg.value(metadata ptr undef, metadata !{{.*}}, metadata !{{.*}})
+ tail call void @llvm.dbg.value(metadata ptr %x1, metadata !10, metadata !24), !dbg !16
; Supported dbg.value: rewritted based on the [[USP]] value.
-; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref, DW_OP_LLVM_fragment, 0, 4))
- tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !25), !dbg !16
+; CHECK: call void @llvm.dbg.value(metadata ptr %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref, DW_OP_LLVM_fragment, 0, 4))
+ tail call void @llvm.dbg.value(metadata ptr %x1, metadata !10, metadata !25), !dbg !16
; Supported dbg.value: rewritted based on the [[USP]] value.
-; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref))
- tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !15), !dbg !16
- call void @capture(i32* nonnull %x1), !dbg !17
+; CHECK: call void @llvm.dbg.value(metadata ptr %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref))
+ tail call void @llvm.dbg.value(metadata ptr %x1, metadata !10, metadata !15), !dbg !16
+ call void @capture(ptr nonnull %x1), !dbg !17
; An extra non-dbg.value metadata use of %x2. Replaced with undef.
-; CHECK: call void @llvm.random.metadata.use(metadata i32* undef
- call void @llvm.random.metadata.use(metadata i32* %x2)
+; CHECK: call void @llvm.random.metadata.use(metadata ptr undef
+ call void @llvm.random.metadata.use(metadata ptr %x2)
-; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X2:.*]], metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref))
- call void @llvm.dbg.value(metadata i32* %x2, metadata !12, metadata !15), !dbg !18
- call void @capture(i32* nonnull %x2), !dbg !19
+; CHECK: call void @llvm.dbg.value(metadata ptr %[[USP]], metadata ![[X2:.*]], metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref))
+ call void @llvm.dbg.value(metadata ptr %x2, metadata !12, metadata !15), !dbg !18
+ call void @capture(ptr nonnull %x2), !dbg !19
ret void, !dbg !20
}
; Function Attrs: argmemonly nounwind
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
-declare void @capture(i32*) #2
+declare void @capture(ptr) #2
; Function Attrs: argmemonly nounwind
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, metadata, metadata) #3
diff --git a/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll b/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll
index b0571f7..d837778 100644
--- a/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll
+++ b/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll
@@ -8,15 +8,14 @@
; Requires protector.
define void @foo(i32 %n) nounwind uwtable safestack {
entry:
- ; CHECK: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: %[[SP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
%n.addr = alloca i32, align 4
- %a = alloca i32*, align 8
- store i32 %n, i32* %n.addr, align 4
- %0 = load i32, i32* %n.addr, align 4
+ %a = alloca ptr, align 8
+ store i32 %n, ptr %n.addr, align 4
+ %0 = load i32, ptr %n.addr, align 4
%conv = sext i32 %0 to i64
%1 = alloca i8, i64 %conv
- %2 = bitcast i8* %1 to i32*
- store i32* %2, i32** %a, align 8
- ; CHECK: store i8* %[[SP:.*]], i8** @__safestack_unsafe_stack_ptr
+ store ptr %1, ptr %a, align 8
+ ; CHECK: store ptr %[[SP:.*]], ptr @__safestack_unsafe_stack_ptr
ret void
}
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll b/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll
index 615d711..a650ee9 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll
@@ -9,15 +9,15 @@
define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
- %a = alloca i32*, align 8
- %b = alloca i32**, align 8
- %call = call i32* @getp()
- store i32* %call, i32** %a, align 8
- store i32** %a, i32*** %b, align 8
- %0 = load i32**, i32*** %b, align 8
- call void @funcall2(i32** %0)
+ %a = alloca ptr, align 8
+ %b = alloca ptr, align 8
+ %call = call ptr @getp()
+ store ptr %call, ptr %a, align 8
+ store ptr %a, ptr %b, align 8
+ %0 = load ptr, ptr %b, align 8
+ call void @funcall2(ptr %0)
ret void
}
-declare void @funcall2(i32**)
-declare i32* @getp()
+declare void @funcall2(ptr)
+declare ptr @getp()
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll
index 9d556a6..bde9c3a 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll
@@ -4,20 +4,19 @@
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
; Addr-of a local cast to a ptr of a different type
-; (e.g., int a; ... ; float *b = &a;)
+; (e.g., int a; ... ; ptr b = &a;)
; safestack attribute
; Requires protector.
define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%a = alloca i32, align 4
- %b = alloca float*, align 8
- store i32 0, i32* %a, align 4
- %0 = bitcast i32* %a to float*
- store float* %0, float** %b, align 8
- %1 = load float*, float** %b, align 8
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), float* %1)
+ %b = alloca ptr, align 8
+ store i32 0, ptr %a, align 4
+ store ptr %a, ptr %b, align 8
+ %0 = load ptr, ptr %b, align 8
+ %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0)
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll
index 5f1f873..8dd1233 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll
@@ -4,17 +4,16 @@
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
; Addr-of a local cast to a ptr of a different type (optimized)
-; (e.g., int a; ... ; float *b = &a;)
+; (e.g., int a; ... ; ptr b = &a;)
; safestack attribute
; Requires protector.
define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%a = alloca i32, align 4
- store i32 0, i32* %a, align 4
- %0 = bitcast i32* %a to float*
- call void @funfloat(float* %0) nounwind
+ store i32 0, ptr %a, align 4
+ call void @funfloat(ptr %a) nounwind
ret void
}
-declare void @funfloat(float*)
+declare void @funfloat(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-call.ll
index ce09780..9af891e 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-call.ll
@@ -9,8 +9,8 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%b = alloca i32, align 4
- call void @funcall(i32* %b) nounwind
+ call void @funcall(ptr %b) nounwind
ret void
}
-declare void @funcall(i32*)
+declare void @funcall(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll b/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll
index bf6ce1d..d482f0c 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll
@@ -9,16 +9,15 @@
define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
- %a = alloca i32*, align 8
- %b = alloca float**, align 8
- %call = call i32* @getp()
- store i32* %call, i32** %a, align 8
- %0 = bitcast i32** %a to float**
- store float** %0, float*** %b, align 8
- %1 = load float**, float*** %b, align 8
- call void @funfloat2(float** %1)
+ %a = alloca ptr, align 8
+ %b = alloca ptr, align 8
+ %call = call ptr @getp()
+ store ptr %call, ptr %a, align 8
+ store ptr %a, ptr %b, align 8
+ %0 = load ptr, ptr %b, align 8
+ call void @funfloat2(ptr %0)
ret void
}
-declare void @funfloat2(float**)
-declare i32* @getp()
+declare void @funfloat2(ptr)
+declare ptr @getp()
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll
index 42b5dd5..759dc5d 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll
@@ -12,9 +12,9 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%c = alloca %struct.pair, align 4
- %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i64 0, i32 1
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
+ %y = getelementptr inbounds %struct.pair, ptr %c, i64 0, i32 1
+ %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %y) nounwind
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll
index 8495ff9..d09a3d8 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll
@@ -9,26 +9,24 @@
; (GEP followed by an invoke)
; safestack attribute
; Requires protector.
-define i32 @foo() uwtable safestack personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define i32 @foo() uwtable safestack personality ptr @__gxx_personality_v0 {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%c = alloca %struct.pair, align 4
- %exn.slot = alloca i8*
+ %exn.slot = alloca ptr
%ehselector.slot = alloca i32
- %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0
- store i32 0, i32* %a, align 4
- %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0
- invoke void @_Z3exceptPi(i32* %a1)
+ store i32 0, ptr %c, align 4
+ invoke void @_Z3exceptPi(ptr %c)
to label %invoke.cont unwind label %lpad
invoke.cont:
ret i32 0
lpad:
- %0 = landingpad { i8*, i32 }
- catch i8* null
+ %0 = landingpad { ptr, i32 }
+ catch ptr null
ret i32 0
}
-declare void @_Z3exceptPi(i32*)
+declare void @_Z3exceptPi(ptr)
declare i32 @__gxx_personality_v0(...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll
index 80d405d..896cae9 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll
@@ -10,9 +10,9 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%a = alloca i32, align 4
- %add.ptr5 = getelementptr inbounds i32, i32* %a, i64 -12
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
+ %add.ptr5 = getelementptr inbounds i32, ptr %a, i64 -12
+ %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr5) nounwind
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll
index 73a8e58..60783b8 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll
@@ -12,11 +12,11 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%c = alloca %struct.pair, align 4
- %b = alloca i32*, align 8
- %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1
- %0 = ptrtoint i32* %y to i64
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0)
+ %b = alloca ptr, align 8
+ %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1
+ %0 = ptrtoint ptr %y to i64
+ %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0)
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll
index 7c6c0a3..b7dad0e 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll
@@ -12,12 +12,12 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%c = alloca %struct.pair, align 4
- %b = alloca i32*, align 8
- %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1
- store i32* %y, i32** %b, align 8
- %0 = load i32*, i32** %b, align 8
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32* %0)
+ %b = alloca ptr, align 8
+ %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1
+ store ptr %y, ptr %b, align 8
+ %0 = load ptr, ptr %b, align 8
+ %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0)
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll
index 10b6c1f..1dd5d6e 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll
@@ -10,13 +10,13 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
%x = alloca double, align 8
%call = call double @testi_aux() nounwind
- store double %call, double* %x, align 8
+ store double %call, ptr %x, align 8
%cmp = fcmp ogt double %call, 3.140000e+00
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call double @testi_aux() nounwind
- store double %call1, double* %x, align 8
+ store double %call1, ptr %x, align 8
br label %if.end4
if.else: ; preds = %entry
@@ -27,10 +27,10 @@ if.then3: ; preds = %if.else
br label %if.end4
if.end4: ; preds = %if.else, %if.then3, %if.then
- %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
- %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
+ %y.0 = phi ptr [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
+ %call5 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.0) nounwind
ret void
}
declare double @testi_aux()
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll
index 9e54dd8..5d1046c 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll
@@ -11,12 +11,12 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
%x = alloca double, align 8
%call = call double @testi_aux() nounwind
- store double %call, double* %x, align 8
+ store double %call, ptr %x, align 8
%cmp2 = fcmp ogt double %call, 0.000000e+00
- %y.1 = select i1 %cmp2, double* %x, double* null
- %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), double* %y.1)
+ %y.1 = select i1 %cmp2, ptr %x, ptr null
+ %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.1)
ret void
}
declare double @testi_aux()
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-vector.ll b/llvm/test/Transforms/SafeStack/X86/escape-vector.ll
index 76b01c7..c725ba9 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-vector.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-vector.ll
@@ -12,10 +12,9 @@ define void @foo() nounwind uwtable safestack {
entry:
; CHECK: __safestack_unsafe_stack_ptr
%c = alloca %struct.vec, align 16
- %y = getelementptr inbounds %struct.vec, %struct.vec* %c, i64 0, i32 0
- %add.ptr = getelementptr inbounds <4 x i32>, <4 x i32>* %y, i64 -12
- %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
+ %add.ptr = getelementptr inbounds <4 x i32>, ptr %c, i64 -12
+ %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr) nounwind
ret void
}
-declare i32 @printf(i8*, ...)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/invoke.ll b/llvm/test/Transforms/SafeStack/X86/invoke.ll
index bfebc33..5385169 100644
--- a/llvm/test/Transforms/SafeStack/X86/invoke.ll
+++ b/llvm/test/Transforms/SafeStack/X86/invoke.ll
@@ -6,15 +6,15 @@
; Addr-of a variable passed into an invoke instruction.
; safestack attribute
; Requires protector and stack restore after landing pad.
-define i32 @foo() uwtable safestack personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define i32 @foo() uwtable safestack personality ptr @__gxx_personality_v0 {
entry:
- ; CHECK: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
- ; CHECK: %[[STATICTOP:.*]] = getelementptr i8, i8* %[[SP]], i32 -16
+ ; CHECK: %[[SP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+ ; CHECK: %[[STATICTOP:.*]] = getelementptr i8, ptr %[[SP]], i32 -16
%a = alloca i32, align 4
- %exn.slot = alloca i8*
+ %exn.slot = alloca ptr
%ehselector.slot = alloca i32
- store i32 0, i32* %a, align 4
- invoke void @_Z3exceptPi(i32* %a)
+ store i32 0, ptr %a, align 4
+ invoke void @_Z3exceptPi(ptr %a)
to label %invoke.cont unwind label %lpad
invoke.cont:
@@ -23,11 +23,11 @@ invoke.cont:
lpad:
; CHECK: landingpad
; CHECK-NEXT: catch
- %0 = landingpad { i8*, i32 }
- catch i8* null
- ; CHECK-NEXT: store i8* %[[STATICTOP]], i8** @__safestack_unsafe_stack_ptr
+ %0 = landingpad { ptr, i32 }
+ catch ptr null
+ ; CHECK-NEXT: store ptr %[[STATICTOP]], ptr @__safestack_unsafe_stack_ptr
ret i32 0
}
-declare void @_Z3exceptPi(i32*)
+declare void @_Z3exceptPi(ptr)
declare i32 @__gxx_personality_v0(...)
diff --git a/llvm/test/Transforms/SafeStack/X86/layout-frag.ll b/llvm/test/Transforms/SafeStack/X86/layout-frag.ll
index 40b9cf7..19c3855 100644
--- a/llvm/test/Transforms/SafeStack/X86/layout-frag.ll
+++ b/llvm/test/Transforms/SafeStack/X86/layout-frag.ll
@@ -4,36 +4,34 @@
define void @f() safestack {
; CHECK-LABEL: define void @f
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
%x0 = alloca i64, align 8
%x1 = alloca i8, align 1
%x2 = alloca i64, align 8
- %x0a = bitcast i64* %x0 to i8*
- %x2a = bitcast i64* %x2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %x0a)
- call void @capture64(i64* %x0)
- call void @llvm.lifetime.end.p0i8(i64 8, i8* %x0a)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %x0)
+ call void @capture64(ptr %x0)
+ call void @llvm.lifetime.end.p0(i64 8, ptr %x0)
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %x1)
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %x2a)
- call void @capture8(i8* %x1)
- call void @capture64(i64* %x2)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %x1)
- call void @llvm.lifetime.end.p0i8(i64 8, i8* %x2a)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %x1)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %x2)
+ call void @capture8(ptr %x1)
+ call void @capture64(ptr %x2)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %x1)
+ call void @llvm.lifetime.end.p0(i64 8, ptr %x2)
; Test that i64 allocas share space.
-; CHECK: getelementptr i8, i8* %unsafe_stack_ptr, i32 -8
-; CHECK: getelementptr i8, i8* %unsafe_stack_ptr, i32 -9
-; CHECK: getelementptr i8, i8* %unsafe_stack_ptr, i32 -8
+; CHECK: getelementptr i8, ptr %unsafe_stack_ptr, i32 -8
+; CHECK: getelementptr i8, ptr %unsafe_stack_ptr, i32 -9
+; CHECK: getelementptr i8, ptr %unsafe_stack_ptr, i32 -8
ret void
}
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
-declare void @capture8(i8*)
-declare void @capture64(i64*)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
+declare void @capture8(ptr)
+declare void @capture64(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll b/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll
index ceb18bb..3bee855 100644
--- a/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll
+++ b/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll
@@ -4,8 +4,8 @@
define void @f() safestack {
; CHECK-LABEL: define void @f
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -224
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -224
%x0 = alloca i8, align 16
%x1 = alloca i8, align 16
@@ -31,54 +31,54 @@ entry:
%y7 = alloca i8, align 2
%y8 = alloca i8, align 2
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
- call void @capture8(i8* %x0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
- call void @capture8(i8* %x1)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -48
- call void @capture8(i8* %x2)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -64
- call void @capture8(i8* %x3)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -80
- call void @capture8(i8* %x4)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -96
- call void @capture8(i8* %x5)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -112
- call void @capture8(i8* %x6)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -128
- call void @capture8(i8* %x7)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -144
- call void @capture8(i8* %x8)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -160
- call void @capture8(i8* %x9)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -176
- call void @capture8(i8* %x10)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -192
- call void @capture8(i8* %x11)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -208
- call void @capture8(i8* %x12)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -224
- call void @capture8(i8* %x13)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -2
- call void @capture8(i8* %y0)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
- call void @capture8(i8* %y1)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -6
- call void @capture8(i8* %y2)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
- call void @capture8(i8* %y3)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -10
- call void @capture8(i8* %y4)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -12
- call void @capture8(i8* %y5)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -14
- call void @capture8(i8* %y6)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -18
- call void @capture8(i8* %y7)
-; CHECK: getelementptr i8, i8* %[[USP]], i32 -20
- call void @capture8(i8* %y8)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
+ call void @capture8(ptr %x0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -32
+ call void @capture8(ptr %x1)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -48
+ call void @capture8(ptr %x2)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -64
+ call void @capture8(ptr %x3)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -80
+ call void @capture8(ptr %x4)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -96
+ call void @capture8(ptr %x5)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -112
+ call void @capture8(ptr %x6)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -128
+ call void @capture8(ptr %x7)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -144
+ call void @capture8(ptr %x8)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -160
+ call void @capture8(ptr %x9)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -176
+ call void @capture8(ptr %x10)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -192
+ call void @capture8(ptr %x11)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -208
+ call void @capture8(ptr %x12)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -224
+ call void @capture8(ptr %x13)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -2
+ call void @capture8(ptr %y0)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -4
+ call void @capture8(ptr %y1)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -6
+ call void @capture8(ptr %y2)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -8
+ call void @capture8(ptr %y3)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -10
+ call void @capture8(ptr %y4)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -12
+ call void @capture8(ptr %y5)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -14
+ call void @capture8(ptr %y6)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -18
+ call void @capture8(ptr %y7)
+; CHECK: getelementptr i8, ptr %[[USP]], i32 -20
+ call void @capture8(ptr %y8)
ret void
}
-declare void @capture8(i8*)
+declare void @capture8(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll b/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll
index 90af6b3..9bc247e 100644
--- a/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll
+++ b/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll
@@ -4,11 +4,11 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
; CHECK: __safestack_unsafe_stack_ptr
-define void @oob_read(i8* %ptr) safestack {
+define void @oob_read(ptr %ptr) safestack {
%1 = alloca i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %ptr, i8* align 1 %1, i64 4, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 1 %ptr, ptr align 1 %1, i64 4, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/SafeStack/X86/musttail.ll b/llvm/test/Transforms/SafeStack/X86/musttail.ll
index d209b2f..32bc667 100644
--- a/llvm/test/Transforms/SafeStack/X86/musttail.ll
+++ b/llvm/test/Transforms/SafeStack/X86/musttail.ll
@@ -4,43 +4,41 @@
target triple = "x86_64-unknown-linux-gnu"
-declare i32 @foo(i32* %p)
-declare void @alloca_test_use([10 x i8]*)
+declare i32 @foo(ptr %p)
+declare void @alloca_test_use(ptr)
-define i32 @call_foo(i32* %a) safestack {
+define i32 @call_foo(ptr %a) safestack {
; CHECK-LABEL: @call_foo(
-; CHECK-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -16
-; CHECK-NEXT: store i8* [[UNSAFE_STACK_STATIC_TOP]], i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -10
-; CHECK-NEXT: [[X_UNSAFE:%.*]] = bitcast i8* [[TMP1]] to [10 x i8]*
-; CHECK-NEXT: call void @alloca_test_use([10 x i8]* [[X_UNSAFE]])
-; CHECK-NEXT: store i8* [[UNSAFE_STACK_PTR]], i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[R:%.*]] = musttail call i32 @foo(i32* [[A:%.*]])
+; CHECK-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -16
+; CHECK-NEXT: store ptr [[UNSAFE_STACK_STATIC_TOP]], ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -10
+; CHECK-NEXT: call void @alloca_test_use(ptr [[TMP1]])
+; CHECK-NEXT: store ptr [[UNSAFE_STACK_PTR]], ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[R:%.*]] = musttail call i32 @foo(ptr [[A:%.*]])
; CHECK-NEXT: ret i32 [[R]]
;
%x = alloca [10 x i8], align 1
- call void @alloca_test_use([10 x i8]* %x)
- %r = musttail call i32 @foo(i32* %a)
+ call void @alloca_test_use(ptr %x)
+ %r = musttail call i32 @foo(ptr %a)
ret i32 %r
}
-define i32 @call_foo_cast(i32* %a) safestack {
+define i32 @call_foo_cast(ptr %a) safestack {
; CHECK-LABEL: @call_foo_cast(
-; CHECK-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -16
-; CHECK-NEXT: store i8* [[UNSAFE_STACK_STATIC_TOP]], i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -10
-; CHECK-NEXT: [[X_UNSAFE:%.*]] = bitcast i8* [[TMP1]] to [10 x i8]*
-; CHECK-NEXT: call void @alloca_test_use([10 x i8]* [[X_UNSAFE]])
-; CHECK-NEXT: store i8* [[UNSAFE_STACK_PTR]], i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[R:%.*]] = musttail call i32 @foo(i32* [[A:%.*]])
+; CHECK-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -16
+; CHECK-NEXT: store ptr [[UNSAFE_STACK_STATIC_TOP]], ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -10
+; CHECK-NEXT: call void @alloca_test_use(ptr [[TMP1]])
+; CHECK-NEXT: store ptr [[UNSAFE_STACK_PTR]], ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[R:%.*]] = musttail call i32 @foo(ptr [[A:%.*]])
; CHECK-NEXT: [[T:%.*]] = bitcast i32 [[R]] to i32
; CHECK-NEXT: ret i32 [[T]]
;
%x = alloca [10 x i8], align 1
- call void @alloca_test_use([10 x i8]* %x)
- %r = musttail call i32 @foo(i32* %a)
+ call void @alloca_test_use(ptr %x)
+ %r = musttail call i32 @foo(ptr %a)
%t = bitcast i32 %r to i32
ret i32 %t
}
diff --git a/llvm/test/Transforms/SafeStack/X86/no-attr.ll b/llvm/test/Transforms/SafeStack/X86/no-attr.ll
index d9bcefd..7715ca5 100644
--- a/llvm/test/Transforms/SafeStack/X86/no-attr.ll
+++ b/llvm/test/Transforms/SafeStack/X86/no-attr.ll
@@ -9,19 +9,17 @@
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: @foo
-define void @foo(i8* %a) nounwind uwtable {
+define void @foo(ptr %a) nounwind uwtable {
entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
- %a.addr = alloca i8*, align 8
+ %a.addr = alloca ptr, align 8
%buf = alloca [16 x i8], align 16
- store i8* %a, i8** %a.addr, align 8
- %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0
- %0 = load i8*, i8** %a.addr, align 8
- %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
- %arraydecay1 = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0
- %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
+ store ptr %a, ptr %a.addr, align 8
+ %0 = load ptr, ptr %a.addr, align 8
+ %call = call ptr @strcpy(ptr %buf, ptr %0)
+ %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf)
ret void
}
-declare i8* @strcpy(i8*, i8*)
-declare i32 @printf(i8*, ...)
+declare ptr @strcpy(ptr, ptr)
+declare i32 @printf(ptr, ...)
diff --git a/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll b/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll
index c6ad220..45e9fa3 100644
--- a/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll
+++ b/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll
@@ -2,16 +2,15 @@
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu %s -o /dev/null
%class.F = type { %class.o, i8, [7 x i8] }
-%class.o = type <{ i8*, i32, [4 x i8] }>
+%class.o = type <{ ptr, i32, [4 x i8] }>
-define dso_local void @_ZN1s1tE1F(%class.F* byval(%class.F) %g) local_unnamed_addr safestack align 32 {
+define dso_local void @_ZN1s1tE1F(ptr byval(%class.F) %g) local_unnamed_addr safestack align 32 {
entry:
%ref.tmp.i.i.i = alloca i64, align 1
- call void undef(%class.F* %g)
- %ref.tmp.i.i.0..sroa_idx.i5 = bitcast i64* %ref.tmp.i.i.i to i8*
- call void @llvm.lifetime.start.p0i8(i64 3, i8* %ref.tmp.i.i.0..sroa_idx.i5)
+ call void undef(ptr %g)
+ call void @llvm.lifetime.start.p0(i64 3, ptr %ref.tmp.i.i.i)
ret void
}
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
diff --git a/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll b/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll
index 026e887..18e6a7d 100644
--- a/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll
+++ b/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll
@@ -14,20 +14,19 @@
define i32 @foo(i32 %arg) nounwind uwtable safestack {
bb:
; CHECK: __safestack_unsafe_stack_ptr
- %tmp = alloca %struct.small*, align 8
- %tmp1 = call i32 (...) @dummy(%struct.small** %tmp) nounwind
- %tmp2 = load %struct.small*, %struct.small** %tmp, align 8
- %tmp3 = ptrtoint %struct.small* %tmp2 to i64
+ %tmp = alloca ptr, align 8
+ %tmp1 = call i32 (...) @dummy(ptr %tmp) nounwind
+ %tmp2 = load ptr, ptr %tmp, align 8
+ %tmp3 = ptrtoint ptr %tmp2 to i64
%tmp4 = trunc i64 %tmp3 to i32
%tmp5 = icmp sgt i32 %tmp4, 0
br i1 %tmp5, label %bb6, label %bb21
bb6: ; preds = %bb17, %bb
- %tmp7 = phi %struct.small* [ %tmp19, %bb17 ], [ %tmp2, %bb ]
+ %tmp7 = phi ptr [ %tmp19, %bb17 ], [ %tmp2, %bb ]
%tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ]
%tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ]
- %tmp10 = getelementptr inbounds %struct.small, %struct.small* %tmp7, i64 0, i32 0
- %tmp11 = load i8, i8* %tmp10, align 1
+ %tmp11 = load i8, ptr %tmp7, align 1
%tmp12 = icmp eq i8 %tmp11, 1
%tmp13 = add nsw i32 %tmp9, 8
%tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9
@@ -36,8 +35,8 @@ bb6: ; preds = %bb17, %bb
br i1 %tmp16, label %bb21, label %bb17
bb17: ; preds = %bb6
- %tmp18 = getelementptr inbounds %struct.small*, %struct.small** %tmp, i64 %tmp8
- %tmp19 = load %struct.small*, %struct.small** %tmp18, align 8
+ %tmp18 = getelementptr inbounds ptr, ptr %tmp, i64 %tmp8
+ %tmp19 = load ptr, ptr %tmp18, align 8
%tmp20 = add i64 %tmp8, 1
br label %bb6
diff --git a/llvm/test/Transforms/SafeStack/X86/phi.ll b/llvm/test/Transforms/SafeStack/X86/phi.ll
index 3ee56aa..1838043 100644
--- a/llvm/test/Transforms/SafeStack/X86/phi.ll
+++ b/llvm/test/Transforms/SafeStack/X86/phi.ll
@@ -4,8 +4,8 @@
define void @f(i1 %d1, i1 %d2) safestack {
entry:
; CHECK-LABEL: define void @f(
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
; CHECK: br i1 %d1, label %[[BB0:.*]], label %[[BB1:.*]]
%a = alloca i32, align 8
%b = alloca i32, align 8
@@ -13,23 +13,21 @@ entry:
bb0:
; CHECK: [[BB0]]:
-; CHECK: %[[Ai8:.*]] = getelementptr i8, i8* %unsafe_stack_ptr, i32
-; CHECK: %[[AUNSAFE:.*]] = bitcast i8* %[[Ai8]] to i32*
+; CHECK: %[[Ai8:.*]] = getelementptr i8, ptr %unsafe_stack_ptr, i32
; CHECK: br i1
br i1 %d2, label %bb2, label %bb2
bb1:
; CHECK: [[BB1]]:
-; CHECK: %[[Bi8:.*]] = getelementptr i8, i8* %unsafe_stack_ptr, i32
-; CHECK: %[[BUNSAFE:.*]] = bitcast i8* %[[Bi8]] to i32*
+; CHECK: %[[Bi8:.*]] = getelementptr i8, ptr %unsafe_stack_ptr, i32
; CHECK: br label
br label %bb2
bb2:
-; CHECK: phi i32* [ %[[AUNSAFE]], %[[BB0]] ], [ %[[AUNSAFE]], %[[BB0]] ], [ %[[BUNSAFE]], %[[BB1]] ]
- %c = phi i32* [ %a, %bb0 ], [ %a, %bb0 ], [ %b, %bb1 ]
- call void @capture(i32* %c)
+; CHECK: phi ptr [ %[[Ai8]], %[[BB0]] ], [ %[[Ai8]], %[[BB0]] ], [ %[[Bi8]], %[[BB1]] ]
+ %c = phi ptr [ %a, %bb0 ], [ %a, %bb0 ], [ %b, %bb1 ]
+ call void @capture(ptr %c)
ret void
}
-declare void @capture(i32*)
+declare void @capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/pr54784.ll b/llvm/test/Transforms/SafeStack/X86/pr54784.ll
index d8433f9..940f560 100644
--- a/llvm/test/Transforms/SafeStack/X86/pr54784.ll
+++ b/llvm/test/Transforms/SafeStack/X86/pr54784.ll
@@ -3,24 +3,22 @@
target triple = "x86_64-unknown-unknown"
-define void @min_of_pointers(i32* %p) safestack {
+define void @min_of_pointers(ptr %p) safestack {
; CHECK-LABEL: @min_of_pointers(
-; CHECK-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -16
-; CHECK-NEXT: store i8* [[UNSAFE_STACK_STATIC_TOP]], i8** @__safestack_unsafe_stack_ptr, align 8
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -4
-; CHECK-NEXT: [[A_UNSAFE1:%.*]] = bitcast i8* [[TMP1]] to i32*
-; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32* [[A_UNSAFE1]], [[P:%.*]]
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr i8, i8* [[UNSAFE_STACK_PTR]], i32 -4
-; CHECK-NEXT: [[A_UNSAFE:%.*]] = bitcast i8* [[TMP2]] to i32*
-; CHECK-NEXT: [[S:%.*]] = select i1 [[CMP]], i32* [[A_UNSAFE]], i32* [[P]]
-; CHECK-NEXT: store i32 0, i32* [[S]], align 4
-; CHECK-NEXT: store i8* [[UNSAFE_STACK_PTR]], i8** @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -16
+; CHECK-NEXT: store ptr [[UNSAFE_STACK_STATIC_TOP]], ptr @__safestack_unsafe_stack_ptr, align 8
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -4
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[TMP1]], [[P:%.*]]
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr i8, ptr [[UNSAFE_STACK_PTR]], i32 -4
+; CHECK-NEXT: [[S:%.*]] = select i1 [[CMP]], ptr [[TMP2]], ptr [[P]]
+; CHECK-NEXT: store i32 0, ptr [[S]], align 4
+; CHECK-NEXT: store ptr [[UNSAFE_STACK_PTR]], ptr @__safestack_unsafe_stack_ptr, align 8
; CHECK-NEXT: ret void
;
%a = alloca i32
- %cmp = icmp ult i32* %a, %p
- %s = select i1 %cmp, i32* %a, i32* %p
- store i32 0, i32* %s
+ %cmp = icmp ult ptr %a, %p
+ %s = select i1 %cmp, ptr %a, ptr %p
+ store i32 0, ptr %s
ret void
}
diff --git a/llvm/test/Transforms/SafeStack/X86/ret.ll b/llvm/test/Transforms/SafeStack/X86/ret.ll
index b2b8e56..b8a3e05 100644
--- a/llvm/test/Transforms/SafeStack/X86/ret.ll
+++ b/llvm/test/Transforms/SafeStack/X86/ret.ll
@@ -12,6 +12,6 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret i64
%x = alloca [100 x i32], align 16
- %0 = ptrtoint [100 x i32]* %x to i64
+ %0 = ptrtoint ptr %x to i64
ret i64 %0
}
diff --git a/llvm/test/Transforms/SafeStack/X86/setjmp.ll b/llvm/test/Transforms/SafeStack/X86/setjmp.ll
index e38bff6..64a39e0 100644
--- a/llvm/test/Transforms/SafeStack/X86/setjmp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/setjmp.ll
@@ -11,19 +11,19 @@
; Requires protector.
define i32 @foo() nounwind uwtable safestack {
entry:
- ; CHECK: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
- ; CHECK: %[[STATICTOP:.*]] = getelementptr i8, i8* %[[SP]], i32 -16
+ ; CHECK: %[[SP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+ ; CHECK: %[[STATICTOP:.*]] = getelementptr i8, ptr %[[SP]], i32 -16
%retval = alloca i32, align 4
%x = alloca i32, align 4
- store i32 0, i32* %retval
- store i32 42, i32* %x, align 4
- %call = call i32 @_setjmp(%struct.__jmp_buf_tag* getelementptr inbounds ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @buf, i32 0, i32 0)) returns_twice
+ store i32 0, ptr %retval
+ store i32 42, ptr %x, align 4
+ %call = call i32 @_setjmp(ptr @buf) returns_twice
; CHECK: setjmp
- ; CHECK-NEXT: store i8* %[[STATICTOP]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK-NEXT: store ptr %[[STATICTOP]], ptr @__safestack_unsafe_stack_ptr
%tobool = icmp ne i32 %call, 0
br i1 %tobool, label %if.else, label %if.then
if.then: ; preds = %entry
- call void @funcall(i32* %x)
+ call void @funcall(ptr %x)
br label %if.end
if.else: ; preds = %entry
call i32 (...) @dummy()
@@ -32,6 +32,6 @@ if.end: ; preds = %if.else, %if.then
ret i32 0
}
-declare i32 @_setjmp(%struct.__jmp_buf_tag*)
-declare void @funcall(i32*)
+declare i32 @_setjmp(ptr)
+declare void @funcall(ptr)
declare i32 @dummy(...)
diff --git a/llvm/test/Transforms/SafeStack/X86/setjmp2.ll b/llvm/test/Transforms/SafeStack/X86/setjmp2.ll
index dc83c48..97cbc2e 100644
--- a/llvm/test/Transforms/SafeStack/X86/setjmp2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/setjmp2.ll
@@ -12,32 +12,31 @@
; CHECK: @foo(i32 %[[ARG:.*]])
define i32 @foo(i32 %size) nounwind uwtable safestack {
entry:
- ; CHECK: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
- ; CHECK-NEXT: %[[DYNPTR:.*]] = alloca i8*
- ; CHECK-NEXT: store i8* %[[SP]], i8** %[[DYNPTR]]
+ ; CHECK: %[[SP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+ ; CHECK-NEXT: %[[DYNPTR:.*]] = alloca ptr
+ ; CHECK-NEXT: store ptr %[[SP]], ptr %[[DYNPTR]]
; CHECK-NEXT: %[[ZEXT:.*]] = zext i32 %[[ARG]] to i64
; CHECK-NEXT: %[[MUL:.*]] = mul i64 %[[ZEXT]], 4
- ; CHECK-NEXT: %[[SP2:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
- ; CHECK-NEXT: %[[PTRTOINT:.*]] = ptrtoint i8* %[[SP2]] to i64
+ ; CHECK-NEXT: %[[SP2:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+ ; CHECK-NEXT: %[[PTRTOINT:.*]] = ptrtoint ptr %[[SP2]] to i64
; CHECK-NEXT: %[[SUB:.*]] = sub i64 %[[PTRTOINT]], %[[MUL]]
; CHECK-NEXT: %[[AND:.*]] = and i64 %[[SUB]], -16
- ; CHECK-NEXT: %[[INTTOPTR:.*]] = inttoptr i64 %[[AND]] to i8*
- ; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** @__safestack_unsafe_stack_ptr
- ; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** %unsafe_stack_dynamic_ptr
- ; CHECK-NEXT: %[[ALLOCA:.*]] = bitcast i8* %[[INTTOPTR]] to i32*
+ ; CHECK-NEXT: %[[INTTOPTR:.*]] = inttoptr i64 %[[AND]] to ptr
+ ; CHECK-NEXT: store ptr %[[INTTOPTR]], ptr @__safestack_unsafe_stack_ptr
+ ; CHECK-NEXT: store ptr %[[INTTOPTR]], ptr %unsafe_stack_dynamic_ptr
%a = alloca i32, i32 %size
; CHECK: setjmp
- ; CHECK-NEXT: %[[LOAD:.*]] = load i8*, i8** %[[DYNPTR]]
- ; CHECK-NEXT: store i8* %[[LOAD]], i8** @__safestack_unsafe_stack_ptr
- %call = call i32 @_setjmp(%struct.__jmp_buf_tag* getelementptr inbounds ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @buf, i32 0, i32 0)) returns_twice
+ ; CHECK-NEXT: %[[LOAD:.*]] = load ptr, ptr %[[DYNPTR]]
+ ; CHECK-NEXT: store ptr %[[LOAD]], ptr @__safestack_unsafe_stack_ptr
+ %call = call i32 @_setjmp(ptr @buf) returns_twice
- ; CHECK: call void @funcall(i32* %[[ALLOCA]])
- call void @funcall(i32* %a)
- ; CHECK-NEXT: store i8* %[[SP:.*]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: call void @funcall(ptr %[[INTTOPTR]])
+ call void @funcall(ptr %a)
+ ; CHECK-NEXT: store ptr %[[SP:.*]], ptr @__safestack_unsafe_stack_ptr
ret i32 0
}
-declare i32 @_setjmp(%struct.__jmp_buf_tag*)
-declare void @funcall(i32*)
+declare i32 @_setjmp(ptr)
+declare void @funcall(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll b/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll
index e208ce1..1a7984a 100644
--- a/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll
+++ b/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll
@@ -7,16 +7,14 @@ entry:
%x0 = alloca i32, align 4
%x1 = alloca i32, align 4
-; CHECK: %[[A:.*]] = getelementptr i8, i8* %{{.*}}, i32 -4
-; CHECK: %[[X0:.*]] = bitcast i8* %[[A]] to i32*
-; CHECK: call void @use(i32* %[[X0]])
- call void @use(i32* %x0)
+; CHECK: %[[A:.*]] = getelementptr i8, ptr %{{.*}}, i32 -4
+; CHECK: call void @use(ptr %[[A]])
+ call void @use(ptr %x0)
-; CHECK: %[[B:.*]] = getelementptr i8, i8* %{{.*}}, i32 -8
-; CHECK: %[[X1:.*]] = bitcast i8* %[[B]] to i32*
-; CHECK: call void @use(i32* %[[X1]])
- call void @use(i32* %x1)
+; CHECK: %[[B:.*]] = getelementptr i8, ptr %{{.*}}, i32 -8
+; CHECK: call void @use(ptr %[[B]])
+ call void @use(ptr %x1)
ret void
}
-declare void @use(i32*)
+declare void @use(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/ssp.ll b/llvm/test/Transforms/SafeStack/X86/ssp.ll
index e4286db..56e1ac6 100644
--- a/llvm/test/Transforms/SafeStack/X86/ssp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/ssp.ll
@@ -2,29 +2,28 @@
define void @foo() safestack sspreq {
entry:
-; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
-; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
-; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr
+; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
+; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+; CHECK: store ptr %[[USST]], ptr @__safestack_unsafe_stack_ptr
-; CHECK: %[[A:.*]] = getelementptr i8, i8* %[[USP]], i32 -8
-; CHECK: %[[StackGuardSlot:.*]] = bitcast i8* %[[A]] to i8**
-; CHECK: %[[StackGuard:.*]] = call i8* @llvm.stackguard()
-; CHECK: store i8* %[[StackGuard]], i8** %[[StackGuardSlot]]
+; CHECK: %[[A:.*]] = getelementptr i8, ptr %[[USP]], i32 -8
+; CHECK: %[[StackGuard:.*]] = call ptr @llvm.stackguard()
+; CHECK: store ptr %[[StackGuard]], ptr %[[A]]
%a = alloca i8, align 1
; CHECK: call void @Capture
- call void @Capture(i8* %a)
+ call void @Capture(ptr %a)
-; CHECK: %[[B:.*]] = load i8*, i8** %[[StackGuardSlot]]
-; CHECK: %[[COND:.*]] = icmp ne i8* %[[StackGuard]], %[[B]]
+; CHECK: %[[B:.*]] = load ptr, ptr %[[A]]
+; CHECK: %[[COND:.*]] = icmp ne ptr %[[StackGuard]], %[[B]]
; CHECK: br i1 %[[COND]], {{.*}} !prof
; CHECK: call void @__stack_chk_fail()
; CHECK-NEXT: unreachable
-; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr
+; CHECK: store ptr %[[USP]], ptr @__safestack_unsafe_stack_ptr
; CHECK-NEXT: ret void
ret void
}
-declare void @Capture(i8*)
+declare void @Capture(ptr)
diff --git a/llvm/test/Transforms/SafeStack/X86/store.ll b/llvm/test/Transforms/SafeStack/X86/store.ll
index f493dd0..6fc0876 100644
--- a/llvm/test/Transforms/SafeStack/X86/store.ll
+++ b/llvm/test/Transforms/SafeStack/X86/store.ll
@@ -9,9 +9,9 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret void
%a = alloca i32, align 4
- %0 = ptrtoint i32* %a to i64
- %1 = inttoptr i64 %0 to i64*
- store i64 zeroinitializer, i64* %1
+ %0 = ptrtoint ptr %a to i64
+ %1 = inttoptr i64 %0 to ptr
+ store i64 zeroinitializer, ptr %1
ret void
}
@@ -21,8 +21,7 @@ entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret void
%a = alloca i32, align 4
- %0 = bitcast i32* %a to i8*
- store i8 zeroinitializer, i8* %0
+ store i8 zeroinitializer, ptr %a
ret void
}
@@ -32,9 +31,8 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret void
%a = alloca i32, align 4
- %0 = bitcast i32* %a to i8*
- %1 = getelementptr i8, i8* %0, i32 4
- store i8 zeroinitializer, i8* %1
+ %0 = getelementptr i8, ptr %a, i32 4
+ store i8 zeroinitializer, ptr %0
ret void
}
@@ -44,9 +42,8 @@ entry:
; CHECK: __safestack_unsafe_stack_ptr
; CHECK: ret void
%a = alloca i32, align 4
- %0 = bitcast i32* %a to i8*
- %1 = getelementptr i8, i8* %0, i32 -1
- store i8 zeroinitializer, i8* %1
+ %0 = getelementptr i8, ptr %a, i32 -1
+ store i8 zeroinitializer, ptr %0
ret void
}
@@ -56,8 +53,7 @@ entry:
; CHECK-NOT: __safestack_unsafe_stack_ptr
; CHECK: ret void
%a = alloca i32, align 4
- %0 = bitcast i32* %a to i8*
- %1 = getelementptr i8, i8* %0, i32 3
- store i8 zeroinitializer, i8* %1
+ %0 = getelementptr i8, ptr %a, i32 3
+ store i8 zeroinitializer, ptr %0
ret void
}
diff --git a/llvm/test/Transforms/SafeStack/X86/struct.ll b/llvm/test/Transforms/SafeStack/X86/struct.ll
index b64803d..8bce24b 100644
--- a/llvm/test/Transforms/SafeStack/X86/struct.ll
+++ b/llvm/test/Transforms/SafeStack/X86/struct.ll
@@ -7,34 +7,30 @@
; struct { [16 x i8] }
-define void @foo(i8* %a) nounwind uwtable safestack {
+define void @foo(ptr %a) nounwind uwtable safestack {
entry:
- ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
- ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
+ ; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
- ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: store ptr %[[USST]], ptr @__safestack_unsafe_stack_ptr
- %a.addr = alloca i8*, align 8
+ %a.addr = alloca ptr, align 8
%buf = alloca %struct.foo, align 1
- ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8
- ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8
- store i8* %a, i8** %a.addr, align 8
+ ; CHECK: %[[AADDR:.*]] = alloca ptr, align 8
+ ; CHECK: store ptr {{.*}}, ptr %[[AADDR]], align 8
+ store ptr %a, ptr %a.addr, align 8
- ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
- ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to %struct.foo*
- ; CHECK: %[[GEP:.*]] = getelementptr inbounds %struct.foo, %struct.foo* %[[BUFPTR2]], i32 0, i32 0, i32 0
- %gep = getelementptr inbounds %struct.foo, %struct.foo* %buf, i32 0, i32 0, i32 0
+ ; CHECK: %[[A:.*]] = load ptr, ptr %[[AADDR]], align 8
+ ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
+ %a2 = load ptr, ptr %a.addr, align 8
- ; CHECK: %[[A:.*]] = load i8*, i8** %[[AADDR]], align 8
- %a2 = load i8*, i8** %a.addr, align 8
+ ; CHECK: call ptr @strcpy(ptr %[[BUFPTR]], ptr %[[A]])
+ %call = call ptr @strcpy(ptr %buf, ptr %a2)
- ; CHECK: call i8* @strcpy(i8* %[[GEP]], i8* %[[A]])
- %call = call i8* @strcpy(i8* %gep, i8* %a2)
-
- ; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr
+ ; CHECK: store ptr %[[USP]], ptr @__safestack_unsafe_stack_ptr
ret void
}
-declare i8* @strcpy(i8*, i8*)
+declare ptr @strcpy(ptr, ptr)