[llvm] 9343738 - [Attributor] Convert some tests to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 07:39:06 PDT 2023
Author: Nikita Popov
Date: 2023-04-13T16:38:52+02:00
New Revision: 934373886e08492e70245c56468c91d4f59595b8
URL: https://github.com/llvm/llvm-project/commit/934373886e08492e70245c56468c91d4f59595b8
DIFF: https://github.com/llvm/llvm-project/commit/934373886e08492e70245c56468c91d4f59595b8.diff
LOG: [Attributor] Convert some tests to opaque pointers (NFC)
Added:
Modified:
llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
llvm/test/Transforms/Attributor/heap_to_stack.ll
llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
index 16d3598dae5d1..4b4c2e95b47e1 100644
--- a/llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
+++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
-; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
-; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -32,14 +32,14 @@ define void @run() {
; CGSCC-NEXT: unreachable
;
entry:
- tail call i8 @UseLongDoubleUnsafely(%union.u* byval(%union.u) align 16 bitcast (%struct.s* @b to %union.u*))
- tail call x86_fp80 @UseLongDoubleSafely(%union.u* byval(%union.u) align 16 bitcast (%struct.s* @b to %union.u*))
- call i64 @AccessPaddingOfStruct(%struct.Foo* byval(%struct.Foo) @a)
- call i64 @CaptureAStruct(%struct.Foo* byval(%struct.Foo) @a)
+ tail call i8 @UseLongDoubleUnsafely(ptr byval(%union.u) align 16 @b)
+ tail call x86_fp80 @UseLongDoubleSafely(ptr byval(%union.u) align 16 @b)
+ call i64 @AccessPaddingOfStruct(ptr byval(%struct.Foo) @a)
+ call i64 @CaptureAStruct(ptr byval(%struct.Foo) @a)
ret void
}
-define internal i8 @UseLongDoubleUnsafely(%union.u* byval(%union.u) align 16 %arg) {
+define internal i8 @UseLongDoubleUnsafely(ptr byval(%union.u) align 16 %arg) {
; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@UseLongDoubleUnsafely
; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
@@ -47,60 +47,59 @@ define internal i8 @UseLongDoubleUnsafely(%union.u* byval(%union.u) align 16 %ar
; CGSCC-NEXT: ret i8 undef
;
entry:
- %bitcast = bitcast %union.u* %arg to %struct.s*
- %gep = getelementptr inbounds %struct.s, %struct.s* %bitcast, i64 0, i32 2
- %result = load i8, i8* %gep
+ %bitcast = bitcast ptr %arg to ptr
+ %gep = getelementptr inbounds %struct.s, ptr %bitcast, i64 0, i32 2
+ %result = load i8, ptr %gep
ret i8 %result
}
-define internal x86_fp80 @UseLongDoubleSafely(%union.u* byval(%union.u) align 16 %arg) {
+define internal x86_fp80 @UseLongDoubleSafely(ptr byval(%union.u) align 16 %arg) {
; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@UseLongDoubleSafely
; CGSCC-SAME: () #[[ATTR1]] {
; CGSCC-NEXT: ret x86_fp80 undef
;
- %gep = getelementptr inbounds %union.u, %union.u* %arg, i64 0, i32 0
- %fp80 = load x86_fp80, x86_fp80* %gep
+ %gep = getelementptr inbounds %union.u, ptr %arg, i64 0, i32 0
+ %fp80 = load x86_fp80, ptr %gep
ret x86_fp80 %fp80
}
-define internal i64 @AccessPaddingOfStruct(%struct.Foo* byval(%struct.Foo) %a) {
+define internal i64 @AccessPaddingOfStruct(ptr byval(%struct.Foo) %a) {
; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@AccessPaddingOfStruct
; CGSCC-SAME: () #[[ATTR1]] {
; CGSCC-NEXT: ret i64 undef
;
- %p = bitcast %struct.Foo* %a to i64*
- %v = load i64, i64* %p
+ %p = bitcast ptr %a to ptr
+ %v = load i64, ptr %p
ret i64 %v
}
-define internal i64 @CaptureAStruct(%struct.Foo* byval(%struct.Foo) %a) {
+define internal i64 @CaptureAStruct(ptr byval(%struct.Foo) %a) {
; CGSCC: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none)
; CGSCC-LABEL: define {{[^@]+}}@CaptureAStruct
; CGSCC-SAME: (i32 [[TMP0:%.*]], i64 [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_FOO:%.*]], align 8
-; CGSCC-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.Foo* [[A_PRIV]] to i32*
-; CGSCC-NEXT: store i32 [[TMP0]], i32* [[A_PRIV_CAST]], align 4
-; CGSCC-NEXT: [[A_PRIV_0_1:%.*]] = getelementptr [[STRUCT_FOO]], %struct.Foo* [[A_PRIV]], i64 0, i32 1
-; CGSCC-NEXT: store i64 [[TMP1]], i64* [[A_PRIV_0_1]], align 8
-; CGSCC-NEXT: [[A_PTR:%.*]] = alloca %struct.Foo*, align 8
+; CGSCC-NEXT: store i32 [[TMP0]], ptr [[A_PRIV]], align 4
+; CGSCC-NEXT: [[A_PRIV_0_1:%.*]] = getelementptr [[STRUCT_FOO]], ptr [[A_PRIV]], i64 0, i32 1
+; CGSCC-NEXT: store i64 [[TMP1]], ptr [[A_PRIV_0_1]], align 8
+; CGSCC-NEXT: [[A_PTR:%.*]] = alloca ptr, align 8
; CGSCC-NEXT: br label [[LOOP:%.*]]
; CGSCC: loop:
-; CGSCC-NEXT: [[PHI:%.*]] = phi %struct.Foo* [ null, [[ENTRY:%.*]] ], [ [[A_PRIV]], [[LOOP]] ]
-; CGSCC-NEXT: [[TMP2:%.*]] = phi %struct.Foo* [ [[A_PRIV]], [[ENTRY]] ], [ [[TMP2]], [[LOOP]] ]
+; CGSCC-NEXT: [[PHI:%.*]] = phi ptr [ null, [[ENTRY:%.*]] ], [ [[A_PRIV]], [[LOOP]] ]
+; CGSCC-NEXT: [[TMP2:%.*]] = phi ptr [ [[A_PRIV]], [[ENTRY]] ], [ [[TMP2]], [[LOOP]] ]
; CGSCC-NEXT: br label [[LOOP]]
;
entry:
- %a_ptr = alloca %struct.Foo*
+ %a_ptr = alloca ptr
br label %loop
loop:
- %phi = phi %struct.Foo* [ null, %entry ], [ %gep, %loop ]
- %0 = phi %struct.Foo* [ %a, %entry ], [ %0, %loop ]
- store %struct.Foo* %phi, %struct.Foo** %a_ptr
- %gep = getelementptr %struct.Foo, %struct.Foo* %a, i64 0
+ %phi = phi ptr [ null, %entry ], [ %gep, %loop ]
+ %0 = phi ptr [ %a, %entry ], [ %0, %loop ]
+ store ptr %phi, ptr %a_ptr
+ %gep = getelementptr %struct.Foo, ptr %a, i64 0
br label %loop
}
;.
diff --git a/llvm/test/Transforms/Attributor/heap_to_stack.ll b/llvm/test/Transforms/Attributor/heap_to_stack.ll
index c7902836d0278..88e7672ddd8b3 100644
--- a/llvm/test/Transforms/Attributor/heap_to_stack.ll
+++ b/llvm/test/Transforms/Attributor/heap_to_stack.ll
@@ -1,63 +1,63 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
-; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=9 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
-; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=9 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
-declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0)
+declare noalias ptr @malloc(i64) allockind("alloc,uninitialized") allocsize(0)
-declare void @nocapture_func_frees_pointer(i8* nocapture)
+declare void @nocapture_func_frees_pointer(ptr nocapture)
declare void @func_throws(...)
-declare void @sync_func(i8* %p)
+declare void @sync_func(ptr %p)
-declare void @sync_will_return(i8* %p) willreturn nounwind
+declare void @sync_will_return(ptr %p) willreturn nounwind
-declare void @no_sync_func(i8* nocapture %p) nofree nosync willreturn
+declare void @no_sync_func(ptr nocapture %p) nofree nosync willreturn
-declare void @nofree_func(i8* nocapture %p) nofree nosync willreturn
+declare void @nofree_func(ptr nocapture %p) nofree nosync willreturn
-declare void @foo(i32* %p)
+declare void @foo(ptr %p)
-declare void @foo_nounw(i32* %p) nounwind nofree
+declare void @foo_nounw(ptr %p) nounwind nofree
declare void @usei8(i8)
-declare void @usei8p(i8* nocapture)
+declare void @usei8p(ptr nocapture)
declare i32 @no_return_call() noreturn
-declare void @free(i8* nocapture) allockind("free")
+declare void @free(ptr nocapture) allockind("free")
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind
;.
-; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global i8* undef, align 4
+; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global ptr undef, align 4
;.
-define void @h2s_value_simplify_interaction(i1 %c, i8* %A) {
+define void @h2s_value_simplify_interaction(i1 %c, ptr %A) {
; CHECK-LABEL: define {{[^@]+}}@h2s_value_simplify_interaction
-; CHECK-SAME: (i1 [[C:%.*]], i8* nocapture nofree readnone [[A:%.*]]) {
+; CHECK-SAME: (i1 [[C:%.*]], ptr nocapture nofree readnone [[A:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ADD:%.*]] = add i64 2, 2
-; CHECK-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef [[ADD]])
+; CHECK-NEXT: [[M:%.*]] = tail call noalias align 16 ptr @malloc(i64 noundef [[ADD]])
; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CHECK: t:
; CHECK-NEXT: br i1 false, label [[DEAD:%.*]], label [[F2:%.*]]
; CHECK: f:
; CHECK-NEXT: br label [[J:%.*]]
; CHECK: f2:
-; CHECK-NEXT: [[L:%.*]] = load i8, i8* [[M]], align 16
+; CHECK-NEXT: [[L:%.*]] = load i8, ptr [[M]], align 16
; CHECK-NEXT: call void @usei8(i8 [[L]])
-; CHECK-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M]]) #[[ATTR11:[0-9]+]]
+; CHECK-NEXT: call void @no_sync_func(ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(1) [[M]]) #[[ATTR11:[0-9]+]]
; CHECK-NEXT: br label [[J]]
; CHECK: dead:
; CHECK-NEXT: unreachable
; CHECK: j:
-; CHECK-NEXT: [[PHI:%.*]] = phi i8* [ [[M]], [[F]] ], [ null, [[F2]] ]
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR11]]
+; CHECK-NEXT: [[PHI:%.*]] = phi ptr [ [[M]], [[F]] ], [ null, [[F2]] ]
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree noundef align 16 [[PHI]]) #[[ATTR11]]
; CHECK-NEXT: ret void
;
entry:
%add = add i64 2, 2
- %m = tail call noalias align 16 i8* @malloc(i64 %add)
+ %m = tail call noalias align 16 ptr @malloc(i64 %add)
br i1 %c, label %t, label %f
t:
@@ -67,33 +67,31 @@ f:
br label %j
f2:
- %c1 = bitcast i8* %m to i32*
- %c2 = bitcast i32* %c1 to i8*
- %l = load i8, i8* %c2, align 1
+ %l = load i8, ptr %m, align 1
call void @usei8(i8 %l)
- call void @no_sync_func(i8* noundef %c2) nounwind
+ call void @no_sync_func(ptr noundef %m) nounwind
br label %j
dead:
br label %j
j:
- %phi = phi i8* [ %m, %f ], [ null, %f2 ], [ %A, %dead ]
- tail call void @no_sync_func(i8* noundef %phi) nounwind
+ %phi = phi ptr [ %m, %f ], [ null, %f2 ], [ %A, %dead ]
+ tail call void @no_sync_func(ptr noundef %phi) nounwind
ret void
}
-define void @nofree_arg_only(i8* %p1, i8* %p2) {
+define void @nofree_arg_only(ptr %p1, ptr %p2) {
; CHECK-LABEL: define {{[^@]+}}@nofree_arg_only
-; CHECK-SAME: (i8* nocapture nofree [[P1:%.*]], i8* nocapture [[P2:%.*]]) {
+; CHECK-SAME: (ptr nocapture nofree [[P1:%.*]], ptr nocapture [[P2:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: tail call void @free(i8* nocapture [[P2]])
-; CHECK-NEXT: tail call void @nofree_func(i8* nocapture nofree [[P1]])
+; CHECK-NEXT: tail call void @free(ptr nocapture [[P2]])
+; CHECK-NEXT: tail call void @nofree_func(ptr nocapture nofree [[P1]])
; CHECK-NEXT: ret void
;
bb:
- tail call void @free(i8* %p2)
- tail call void @nofree_func(i8* %p1)
+ tail call void @free(ptr %p2)
+ tail call void @nofree_func(ptr %p1)
ret void
}
@@ -102,17 +100,17 @@ bb:
define void @test1() {
; CHECK-LABEL: define {{[^@]+}}@test1() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @nocapture_func_frees_pointer(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @nocapture_func_frees_pointer(ptr noalias nocapture [[I]])
; CHECK-NEXT: tail call void (...) @func_throws()
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @nocapture_func_frees_pointer(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @nocapture_func_frees_pointer(ptr %i)
tail call void (...) @func_throws()
- tail call void @free(i8* %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -121,15 +119,15 @@ bb:
define void @test2() {
; CHECK-LABEL: define {{[^@]+}}@test2() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @sync_func(i8* [[I]])
-; CHECK-NEXT: tail call void @free(i8* nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @sync_func(ptr [[I]])
+; CHECK-NEXT: tail call void @free(ptr nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -139,45 +137,45 @@ define void @test3() {
; CHECK-LABEL: define {{[^@]+}}@test3() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I_H2S]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
-define void @test3a(i8* %p) {
+define void @test3a(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test3a
-; CHECK-SAME: (i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I_H2S]], i8* nocapture [[P]])
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I_H2S]], ptr nocapture [[P]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
ret void
}
-declare noalias i8* @aligned_alloc(i64 allocalign, i64) allockind("alloc,uninitialized,aligned") allocsize(1)
+declare noalias ptr @aligned_alloc(i64 allocalign, i64) allockind("alloc,uninitialized,aligned") allocsize(1)
-define void @test3b(i8* %p) {
+define void @test3b(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test3b
-; CHECK-SAME: (i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 128, align 32
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I_H2S]], i8* nocapture [[P]])
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I_H2S]], ptr nocapture [[P]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @aligned_alloc(i64 32, i64 128)
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @aligned_alloc(i64 32, i64 128)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
ret void
}
@@ -186,47 +184,47 @@ define void @test3c(i64 %alignment) {
; CHECK-LABEL: define {{[^@]+}}@test3c
; CHECK-SAME: (i64 [[ALIGNMENT:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @aligned_alloc(i64 [[ALIGNMENT]], i64 noundef 128)
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @aligned_alloc(i64 [[ALIGNMENT]], i64 noundef 128)
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @aligned_alloc(i64 %alignment, i64 128)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @aligned_alloc(i64 %alignment, i64 128)
+ tail call void @free(ptr %i)
ret void
}
; leave alone a constant-but-invalid alignment
-define void @test3d(i8* %p) {
+define void @test3d(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test3d
-; CHECK-SAME: (i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @aligned_alloc(i64 noundef 33, i64 noundef 128)
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I]], i8* nocapture [[P]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @aligned_alloc(i64 noundef 33, i64 noundef 128)
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I]], ptr nocapture [[P]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @aligned_alloc(i64 33, i64 128)
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @aligned_alloc(i64 33, i64 128)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
ret void
}
-declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1)
+declare noalias ptr @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1)
define void @test0() {
; CHECK-LABEL: define {{[^@]+}}@test0() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 8, align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[I_H2S]], i8 0, i64 8, i1 false)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[I_H2S]], i8 0, i64 8, i1 false)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I_H2S]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @calloc(i64 2, i64 4)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @calloc(i64 2, i64 4)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -235,46 +233,46 @@ define void @test4() {
; CHECK-LABEL: define {{[^@]+}}@test4() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: tail call void @nofree_func(ptr noalias nocapture nofree [[I_H2S]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @nofree_func(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @nofree_func(ptr %i)
ret void
}
; TEST 5 - not all exit paths have a call to free, but all uses of malloc
; are in nofree functions and are not captured
-define void @test5(i32 %arg, i8* %p) {
+define void @test5(i32 %arg, ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test5
-; CHECK-SAME: (i32 [[ARG:%.*]], i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (i32 [[ARG:%.*]], ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
; CHECK-NEXT: [[I1:%.*]] = icmp eq i32 [[ARG]], 0
; CHECK-NEXT: br i1 [[I1]], label [[BB3:%.*]], label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: tail call void @nofree_func(ptr noalias nocapture nofree [[I_H2S]])
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I_H2S]], i8* nocapture [[P]])
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I_H2S]], ptr nocapture [[P]])
; CHECK-NEXT: br label [[BB4]]
; CHECK: bb4:
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
+ %i = tail call noalias ptr @malloc(i64 4)
%i1 = icmp eq i32 %arg, 0
br i1 %i1, label %bb3, label %bb2
bb2:
- tail call void @nofree_func(i8* %i)
+ tail call void @nofree_func(ptr %i)
br label %bb4
bb3:
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
br label %bb4
bb4:
@@ -291,7 +289,7 @@ define void @test6(i32 %arg) {
; CHECK-NEXT: [[I1:%.*]] = icmp eq i32 [[ARG]], 0
; CHECK-NEXT: br i1 [[I1]], label [[BB3:%.*]], label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: tail call void @nofree_func(ptr noalias nocapture nofree [[I_H2S]])
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br label [[BB4]]
@@ -299,17 +297,17 @@ define void @test6(i32 %arg) {
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
+ %i = tail call noalias ptr @malloc(i64 4)
%i1 = icmp eq i32 %arg, 0
br i1 %i1, label %bb3, label %bb2
bb2:
- tail call void @nofree_func(i8* %i)
- tail call void @free(i8* %i)
+ tail call void @nofree_func(ptr %i)
+ tail call void @free(ptr %i)
br label %bb4
bb3:
- tail call void @free(i8* %i)
+ tail call void @free(ptr %i)
br label %bb4
bb4:
@@ -326,9 +324,9 @@ define void @test7() {
; CHECK-NEXT: unreachable
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
+ %i = tail call noalias ptr @malloc(i64 4)
%i1 = tail call i32 @no_return_call()
- tail call void @free(i8* %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -337,22 +335,20 @@ bb:
define void @test8() {
; CHECK-LABEL: define {{[^@]+}}@test8() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @foo(i32* noundef align 4 [[I1]])
-; CHECK-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @foo(ptr nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: tail call void @free(ptr nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @foo(i32* %i1)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @foo(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -360,22 +356,20 @@ bb:
define void @test9() {
; CHECK-LABEL: define {{[^@]+}}@test9() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[I1]]) #[[ATTR11]]
-; CHECK-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @foo_nounw(ptr nofree nonnull align 4 dereferenceable(4) [[I]]) #[[ATTR11]]
+; CHECK-NEXT: tail call void @free(ptr nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @foo_nounw(i32* %i1)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @foo_nounw(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -385,19 +379,17 @@ define i32 @test10() {
; CHECK-LABEL: define {{[^@]+}}@test10() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I_H2S]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I_H2S]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: store i32 10, ptr [[I_H2S]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I_H2S]], align 4
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
@@ -405,21 +397,19 @@ define i32 @test_lifetime() {
; CHECK-LABEL: define {{[^@]+}}@test_lifetime() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I_H2S]])
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 noundef 4, i8* noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[I_H2S]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I_H2S]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I_H2S]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree nonnull align 4 dereferenceable(4) [[I_H2S]])
+; CHECK-NEXT: store i32 10, ptr [[I_H2S]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I_H2S]], align 4
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
@@ -429,13 +419,13 @@ define void @test11() {
; CHECK-LABEL: define {{[^@]+}}@test11() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: tail call void @sync_will_return(i8* [[I_H2S]]) #[[ATTR11]]
+; CHECK-NEXT: tail call void @sync_will_return(ptr [[I_H2S]]) #[[ATTR11]]
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @sync_will_return(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @sync_will_return(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -445,8 +435,7 @@ define i32 @irreducible_cfg(i32 %arg) {
; CHECK-SAME: (i32 [[ARG:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I_H2S]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
+; CHECK-NEXT: store i32 10, ptr [[I_H2S]], align 4
; CHECK-NEXT: [[I2:%.*]] = icmp eq i32 [[ARG]], 1
; CHECK-NEXT: br i1 [[I2]], label [[BB3:%.*]], label [[BB5:%.*]]
; CHECK: bb3:
@@ -456,9 +445,9 @@ define i32 @irreducible_cfg(i32 %arg) {
; CHECK-NEXT: br label [[BB6:%.*]]
; CHECK: bb6:
; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ [[I12:%.*]], [[BB11]] ], [ 1, [[BB5]] ]
-; CHECK-NEXT: [[I7:%.*]] = load i32, i32* [[I1]], align 4
+; CHECK-NEXT: [[I7:%.*]] = load i32, ptr [[I_H2S]], align 4
; CHECK-NEXT: [[I8:%.*]] = add nsw i32 [[I7]], -1
-; CHECK-NEXT: store i32 [[I8]], i32* [[I1]], align 4
+; CHECK-NEXT: store i32 [[I8]], ptr [[I_H2S]], align 4
; CHECK-NEXT: [[I9:%.*]] = icmp ne i32 [[I7]], 0
; CHECK-NEXT: br i1 [[I9]], label [[BB10:%.*]], label [[BB13:%.*]]
; CHECK: bb10:
@@ -468,13 +457,12 @@ define i32 @irreducible_cfg(i32 %arg) {
; CHECK-NEXT: [[I12]] = add nsw i32 [[DOT1]], 1
; CHECK-NEXT: br label [[BB6]]
; CHECK: bb13:
-; CHECK-NEXT: [[I16:%.*]] = load i32, i32* [[I1]], align 4
+; CHECK-NEXT: [[I16:%.*]] = load i32, ptr [[I_H2S]], align 4
; CHECK-NEXT: ret i32 [[I16]]
;
bb:
- %i = call noalias i8* @malloc(i64 4)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
+ %i = call noalias ptr @malloc(i64 4)
+ store i32 10, ptr %i, align 4
%i2 = icmp eq i32 %arg, 1
br i1 %i2, label %bb3, label %bb5
@@ -487,9 +475,9 @@ bb5:
bb6:
%.0 = phi i32 [ %i12, %bb11 ], [ 1, %bb5 ]
- %i7 = load i32, i32* %i1, align 4
+ %i7 = load i32, ptr %i, align 4
%i8 = add nsw i32 %i7, -1
- store i32 %i8, i32* %i1, align 4
+ store i32 %i8, ptr %i, align 4
%i9 = icmp ne i32 %i7, 0
br i1 %i9, label %bb10, label %bb13
@@ -502,10 +490,9 @@ bb11:
br label %bb6
bb13:
- %i14 = load i32, i32* %i1, align 4
- %i15 = bitcast i32* %i1 to i8*
- call void @free(i8* %i15)
- %i16 = load i32, i32* %i1, align 4
+ %i14 = load i32, ptr %i, align 4
+ call void @free(ptr %i)
+ %i16 = load i32, ptr %i, align 4
ret i32 %i16
}
@@ -515,39 +502,37 @@ define i32 @malloc_in_loop(i32 %arg) {
; CHECK-SAME: (i32 [[ARG:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[I1:%.*]] = alloca i32*, align 8
-; CHECK-NEXT: store i32 [[ARG]], i32* [[I]], align 4
+; CHECK-NEXT: [[I1:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: store i32 [[ARG]], ptr [[I]], align 4
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: [[I3:%.*]] = load i32, i32* [[I]], align 4
+; CHECK-NEXT: [[I3:%.*]] = load i32, ptr [[I]], align 4
; CHECK-NEXT: [[I4:%.*]] = add nsw i32 [[I3]], -1
-; CHECK-NEXT: store i32 [[I4]], i32* [[I]], align 4
+; CHECK-NEXT: store i32 [[I4]], ptr [[I]], align 4
; CHECK-NEXT: [[I5:%.*]] = icmp sgt i32 [[I4]], 0
; CHECK-NEXT: br i1 [[I5]], label [[BB6:%.*]], label [[BB9:%.*]]
; CHECK: bb6:
; CHECK-NEXT: [[I7_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: [[I8:%.*]] = bitcast i8* [[I7_H2S]] to i32*
; CHECK-NEXT: br label [[BB2]]
; CHECK: bb9:
; CHECK-NEXT: ret i32 5
;
bb:
%i = alloca i32, align 4
- %i1 = alloca i32*, align 8
- store i32 %arg, i32* %i, align 4
+ %i1 = alloca ptr, align 8
+ store i32 %arg, ptr %i, align 4
br label %bb2
bb2:
- %i3 = load i32, i32* %i, align 4
+ %i3 = load i32, ptr %i, align 4
%i4 = add nsw i32 %i3, -1
- store i32 %i4, i32* %i, align 4
+ store i32 %i4, ptr %i, align 4
%i5 = icmp sgt i32 %i4, 0
br i1 %i5, label %bb6, label %bb9
bb6:
- %i7 = call noalias i8* @malloc(i64 4)
- %i8 = bitcast i8* %i7 to i32*
- store i32 1, i32* %i8, align 8
+ %i7 = call noalias ptr @malloc(i64 4)
+ store i32 1, ptr %i7, align 8
br label %bb2
bb9:
@@ -558,78 +543,72 @@ bb9:
define i32 @test13() {
; CHECK-LABEL: define {{[^@]+}}@test13() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 256)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 256)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 256)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 256)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define i32 @test_sle() {
; CHECK-LABEL: define {{[^@]+}}@test_sle() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef -1)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef -1)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 -1)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 -1)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define i32 @test_overflow() {
; CHECK-LABEL: define {{[^@]+}}@test_overflow() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @calloc(i64 noundef 65537, i64 noundef 65537)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @calloc(i64 noundef 65537, i64 noundef 65537)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @calloc(i64 65537, i64 65537)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @calloc(i64 65537, i64 65537)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define void @test14() {
; CHECK-LABEL: define {{[^@]+}}@test14() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @calloc(i64 noundef 64, i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @calloc(i64 noundef 64, i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @calloc(i64 64, i64 4)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @calloc(i64 64, i64 4)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -637,101 +616,101 @@ define void @test15(i64 %S) {
; CHECK-LABEL: define {{[^@]+}}@test15
; CHECK-SAME: (i64 [[S:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 [[S]])
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 [[S]])
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 %S)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 %S)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
-define void @test16a(i8 %v, i8** %P) {
+define void @test16a(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16a
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree readnone [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree readnone [[P:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: store i8 [[V]], i8* [[I_H2S]], align 1
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[I_H2S]])
+; CHECK-NEXT: store i8 [[V]], ptr [[I_H2S]], align 1
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree noundef nonnull dereferenceable(1) [[I_H2S]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8 %v, i8* %i, align 1
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* nonnull dereferenceable(1) %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store i8 %v, ptr %i, align 1
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr nonnull dereferenceable(1) %i)
ret void
}
-define void @test16b(i8 %v, i8** %P) {
+define void @test16b(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16b
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: store i8* [[I]], i8** [[P]], align 8
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store ptr [[I]], ptr [[P]], align 8
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** %P, align 8
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr %P, align 8
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
-define void @test16c(i8 %v, i8** %P) {
+define void @test16c(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16c
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: store i8* [[I_H2S]], i8** [[P]], align 8
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I_H2S]]) #[[ATTR11]]
+; CHECK-NEXT: store ptr [[I_H2S]], ptr [[P]], align 8
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I_H2S]]) #[[ATTR11]]
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** %P, align 8
- tail call void @no_sync_func(i8* %i) nounwind
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr %P, align 8
+ tail call void @no_sync_func(ptr %i) nounwind
+ tail call void @free(ptr %i)
ret void
}
-define void @test16d(i8 %v, i8** %P) {
+define void @test16d(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16d
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: store i8* [[I]], i8** [[P]], align 8
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store ptr [[I]], ptr [[P]], align 8
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** %P, align 8
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr %P, align 8
ret void
}
- at G = internal global i8* undef, align 4
+ at G = internal global ptr undef, align 4
define void @test16e(i8 %v) norecurse {
; CHECK: Function Attrs: norecurse
; CHECK-LABEL: define {{[^@]+}}@test16e
; CHECK-SAME: (i8 [[V:%.*]]) #[[ATTR9:[0-9]+]] {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1
-; CHECK-NEXT: store i8* [[I_H2S]], i8** @G, align 8
-; CHECK-NEXT: call void @usei8p(i8* nocapture nofree [[I_H2S]]) #[[ATTR12:[0-9]+]]
+; CHECK-NEXT: store ptr [[I_H2S]], ptr @G, align 8
+; CHECK-NEXT: call void @usei8p(ptr nocapture nofree [[I_H2S]]) #[[ATTR12:[0-9]+]]
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** @G, align 8
- %i1 = load i8*, i8** @G, align 8
- call void @usei8p(i8* nocapture nofree %i1) nocallback nosync nounwind willreturn
- call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr @G, align 8
+ %i1 = load ptr, ptr @G, align 8
+ call void @usei8p(ptr nocapture nofree %i1) nocallback nosync nounwind willreturn
+ call void @free(ptr %i)
ret void
}
diff --git a/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll b/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
index 116a942f5d999..0a3d5b678c53a 100644
--- a/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
+++ b/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
-; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
-; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
; FIXME: amdgpu doesn't claim malloc is a thing, so the test is somewhat
; useless except the __kmpc_alloc_shared part which now also covers the important
@@ -9,46 +9,46 @@
target triple = "amdgcn-amd-amdhsa"
target datalayout = "A5"
-declare noalias i8* @malloc(i64)
+declare noalias ptr @malloc(i64)
-declare void @nocapture_func_frees_pointer(i8* nocapture)
+declare void @nocapture_func_frees_pointer(ptr nocapture)
declare void @func_throws(...)
-declare void @sync_func(i8* %p)
+declare void @sync_func(ptr %p)
-declare void @sync_will_return(i8* %p) willreturn nounwind
+declare void @sync_will_return(ptr %p) willreturn nounwind
-declare void @no_sync_func(i8* nocapture %p) nofree nosync willreturn
+declare void @no_sync_func(ptr nocapture %p) nofree nosync willreturn
-declare void @nofree_func(i8* nocapture %p) nofree nosync willreturn
+declare void @nofree_func(ptr nocapture %p) nofree nosync willreturn
-declare void @usei8(i8* %p)
-declare void @foo(i32* %p)
+declare void @usei8(ptr %p)
+declare void @foo(ptr %p)
-declare void @foo_nounw(i32* %p) nounwind nofree
+declare void @foo_nounw(ptr %p) nounwind nofree
declare i32 @no_return_call() noreturn
-declare void @free(i8* nocapture)
+declare void @free(ptr nocapture)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind
;.
-; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global i8* undef, align 4
-; CHECK: @[[GTL:[a-zA-Z0-9_$"\\.-]+]] = internal thread_local global i8* undef, align 4
+; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global ptr undef, align 4
+; CHECK: @[[GTL:[a-zA-Z0-9_$"\\.-]+]] = internal thread_local global ptr undef, align 4
;.
-define void @nofree_arg_only(i8* %p1, i8* %p2) {
+define void @nofree_arg_only(ptr %p1, ptr %p2) {
; CHECK-LABEL: define {{[^@]+}}@nofree_arg_only
-; CHECK-SAME: (i8* nocapture nofree [[P1:%.*]], i8* nocapture [[P2:%.*]]) {
+; CHECK-SAME: (ptr nocapture nofree [[P1:%.*]], ptr nocapture [[P2:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: tail call void @free(i8* nocapture [[P2]])
-; CHECK-NEXT: tail call void @nofree_func(i8* nocapture nofree [[P1]])
+; CHECK-NEXT: tail call void @free(ptr nocapture [[P2]])
+; CHECK-NEXT: tail call void @nofree_func(ptr nocapture nofree [[P1]])
; CHECK-NEXT: ret void
;
bb:
- tail call void @free(i8* %p2)
- tail call void @nofree_func(i8* %p1)
+ tail call void @free(ptr %p2)
+ tail call void @nofree_func(ptr %p1)
ret void
}
@@ -57,17 +57,17 @@ bb:
define void @test1() {
; CHECK-LABEL: define {{[^@]+}}@test1() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @nocapture_func_frees_pointer(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @nocapture_func_frees_pointer(ptr noalias nocapture [[I]])
; CHECK-NEXT: tail call void (...) @func_throws()
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @nocapture_func_frees_pointer(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @nocapture_func_frees_pointer(ptr %i)
tail call void (...) @func_throws()
- tail call void @free(i8* %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -76,15 +76,15 @@ bb:
define void @test2() {
; CHECK-LABEL: define {{[^@]+}}@test2() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @sync_func(i8* [[I]])
-; CHECK-NEXT: tail call void @free(i8* nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @sync_func(ptr [[I]])
+; CHECK-NEXT: tail call void @free(ptr nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -93,49 +93,49 @@ bb:
define void @test3() {
; CHECK-LABEL: define {{[^@]+}}@test3() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
-define void @test3a(i8* %p) {
+define void @test3a(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test3a
-; CHECK-SAME: (i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I]], i8* nocapture [[P]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I]], ptr nocapture [[P]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
ret void
}
-declare noalias i8* @aligned_alloc(i64, i64)
+declare noalias ptr @aligned_alloc(i64, i64)
-define void @test3b(i8* %p) {
+define void @test3b(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test3b
-; CHECK-SAME: (i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @aligned_alloc(i64 noundef 32, i64 noundef 128)
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I]], i8* nocapture [[P]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @aligned_alloc(i64 noundef 32, i64 noundef 128)
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I]], ptr nocapture [[P]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @aligned_alloc(i64 32, i64 128)
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @aligned_alloc(i64 32, i64 128)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
ret void
}
@@ -144,30 +144,30 @@ define void @test3c(i64 %alignment) {
; CHECK-LABEL: define {{[^@]+}}@test3c
; CHECK-SAME: (i64 [[ALIGNMENT:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @aligned_alloc(i64 [[ALIGNMENT]], i64 noundef 128)
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @aligned_alloc(i64 [[ALIGNMENT]], i64 noundef 128)
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @aligned_alloc(i64 %alignment, i64 128)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @aligned_alloc(i64 %alignment, i64 128)
+ tail call void @free(ptr %i)
ret void
}
-declare noalias i8* @calloc(i64, i64)
+declare noalias ptr @calloc(i64, i64)
define void @test0() {
; CHECK-LABEL: define {{[^@]+}}@test0() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @calloc(i64 noundef 2, i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @calloc(i64 noundef 2, i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @calloc(i64 2, i64 4)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @calloc(i64 2, i64 4)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -175,48 +175,48 @@ bb:
define void @test4() {
; CHECK-LABEL: define {{[^@]+}}@test4() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @nofree_func(ptr noalias nocapture nofree [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @nofree_func(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @nofree_func(ptr %i)
ret void
}
; TEST 5 - not all exit paths have a call to free, but all uses of malloc
; are in nofree functions and are not captured
-define void @test5(i32 %arg, i8* %p) {
+define void @test5(i32 %arg, ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@test5
-; CHECK-SAME: (i32 [[ARG:%.*]], i8* nocapture [[P:%.*]]) {
+; CHECK-SAME: (i32 [[ARG:%.*]], ptr nocapture [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
; CHECK-NEXT: [[I1:%.*]] = icmp eq i32 [[ARG]], 0
; CHECK-NEXT: br i1 [[I1]], label [[BB3:%.*]], label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @nofree_func(ptr noalias nocapture nofree [[I]])
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[I]], i8* nocapture [[P]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: tail call void @nofree_arg_only(ptr noalias nocapture nofree [[I]], ptr nocapture [[P]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: br label [[BB4]]
; CHECK: bb4:
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
+ %i = tail call noalias ptr @malloc(i64 4)
%i1 = icmp eq i32 %arg, 0
br i1 %i1, label %bb3, label %bb2
bb2:
- tail call void @nofree_func(i8* %i)
+ tail call void @nofree_func(ptr %i)
br label %bb4
bb3:
- tail call void @nofree_arg_only(i8* %i, i8* %p)
- tail call void @free(i8* %i)
+ tail call void @nofree_arg_only(ptr %i, ptr %p)
+ tail call void @free(ptr %i)
br label %bb4
bb4:
@@ -229,31 +229,31 @@ define void @test6(i32 %arg) {
; CHECK-LABEL: define {{[^@]+}}@test6
; CHECK-SAME: (i32 [[ARG:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
; CHECK-NEXT: [[I1:%.*]] = icmp eq i32 [[ARG]], 0
; CHECK-NEXT: br i1 [[I1]], label [[BB3:%.*]], label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: tail call void @nofree_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: br label [[BB4]]
; CHECK: bb4:
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
+ %i = tail call noalias ptr @malloc(i64 4)
%i1 = icmp eq i32 %arg, 0
br i1 %i1, label %bb3, label %bb2
bb2:
- tail call void @nofree_func(i8* %i)
- tail call void @free(i8* %i)
+ tail call void @nofree_func(ptr %i)
+ tail call void @free(ptr %i)
br label %bb4
bb3:
- tail call void @free(i8* %i)
+ tail call void @free(ptr %i)
br label %bb4
bb4:
@@ -265,14 +265,14 @@ bb4:
define void @test7() {
; CHECK-LABEL: define {{[^@]+}}@test7() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
; CHECK-NEXT: [[I1:%.*]] = tail call i32 @no_return_call() #[[ATTR3:[0-9]+]]
; CHECK-NEXT: unreachable
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
+ %i = tail call noalias ptr @malloc(i64 4)
%i1 = tail call i32 @no_return_call()
- tail call void @free(i8* %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -281,22 +281,20 @@ bb:
define void @test8() {
; CHECK-LABEL: define {{[^@]+}}@test8() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @foo(i32* noundef align 4 [[I1]])
-; CHECK-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @foo(ptr nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: tail call void @free(ptr nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @foo(i32* %i1)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @foo(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -304,22 +302,20 @@ bb:
define void @test9() {
; CHECK-LABEL: define {{[^@]+}}@test9() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[I1]]) #[[ATTR6:[0-9]+]]
-; CHECK-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @foo_nounw(ptr nofree nonnull align 4 dereferenceable(4) [[I]]) #[[ATTR6:[0-9]+]]
+; CHECK-NEXT: tail call void @free(ptr nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @foo_nounw(i32* %i1)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @foo_nounw(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -328,44 +324,40 @@ bb:
define i32 @test10() {
; CHECK-LABEL: define {{[^@]+}}@test10() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define i32 @test_lifetime() {
; CHECK-LABEL: define {{[^@]+}}@test_lifetime() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 noundef 4, i8* noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @no_sync_func(i8* %i)
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @no_sync_func(ptr %i)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
@@ -374,15 +366,15 @@ bb:
define void @test11() {
; CHECK-LABEL: define {{[^@]+}}@test11() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: tail call void @sync_will_return(i8* [[I]]) #[[ATTR6]]
-; CHECK-NEXT: tail call void @free(i8* nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: tail call void @sync_will_return(ptr [[I]]) #[[ATTR6]]
+; CHECK-NEXT: tail call void @free(ptr nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- tail call void @sync_will_return(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ tail call void @sync_will_return(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -391,9 +383,8 @@ define i32 @irreducible_cfg(i32 %arg) {
; CHECK-LABEL: define {{[^@]+}}@irreducible_cfg
; CHECK-SAME: (i32 [[ARG:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
+; CHECK-NEXT: [[I:%.*]] = call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
; CHECK-NEXT: [[I2:%.*]] = icmp eq i32 [[ARG]], 1
; CHECK-NEXT: br i1 [[I2]], label [[BB3:%.*]], label [[BB5:%.*]]
; CHECK: bb3:
@@ -403,9 +394,9 @@ define i32 @irreducible_cfg(i32 %arg) {
; CHECK-NEXT: br label [[BB6:%.*]]
; CHECK: bb6:
; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ [[I12:%.*]], [[BB11]] ], [ 1, [[BB5]] ]
-; CHECK-NEXT: [[I7:%.*]] = load i32, i32* [[I1]], align 4
+; CHECK-NEXT: [[I7:%.*]] = load i32, ptr [[I]], align 4
; CHECK-NEXT: [[I8:%.*]] = add nsw i32 [[I7]], -1
-; CHECK-NEXT: store i32 [[I8]], i32* [[I1]], align 4
+; CHECK-NEXT: store i32 [[I8]], ptr [[I]], align 4
; CHECK-NEXT: [[I9:%.*]] = icmp ne i32 [[I7]], 0
; CHECK-NEXT: br i1 [[I9]], label [[BB10:%.*]], label [[BB13:%.*]]
; CHECK: bb10:
@@ -415,15 +406,13 @@ define i32 @irreducible_cfg(i32 %arg) {
; CHECK-NEXT: [[I12]] = add nsw i32 [[DOT1]], 1
; CHECK-NEXT: br label [[BB6]]
; CHECK: bb13:
-; CHECK-NEXT: [[I14:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: call void @free(i8* nocapture noundef [[I]])
-; CHECK-NEXT: [[I16:%.*]] = load i32, i32* [[I1]], align 4
+; CHECK-NEXT: call void @free(ptr noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I16:%.*]] = load i32, ptr [[I]], align 4
; CHECK-NEXT: ret i32 [[I16]]
;
bb:
- %i = call noalias i8* @malloc(i64 4)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
+ %i = call noalias ptr @malloc(i64 4)
+ store i32 10, ptr %i, align 4
%i2 = icmp eq i32 %arg, 1
br i1 %i2, label %bb3, label %bb5
@@ -436,9 +425,9 @@ bb5:
bb6:
%.0 = phi i32 [ %i12, %bb11 ], [ 1, %bb5 ]
- %i7 = load i32, i32* %i1, align 4
+ %i7 = load i32, ptr %i, align 4
%i8 = add nsw i32 %i7, -1
- store i32 %i8, i32* %i1, align 4
+ store i32 %i8, ptr %i, align 4
%i9 = icmp ne i32 %i7, 0
br i1 %i9, label %bb10, label %bb13
@@ -451,10 +440,9 @@ bb11:
br label %bb6
bb13:
- %i14 = load i32, i32* %i1, align 4
- %i15 = bitcast i32* %i1 to i8*
- call void @free(i8* %i15)
- %i16 = load i32, i32* %i1, align 4
+ %i14 = load i32, ptr %i, align 4
+ call void @free(ptr %i)
+ %i16 = load i32, ptr %i, align 4
ret i32 %i16
}
@@ -464,39 +452,37 @@ define i32 @malloc_in_loop(i32 %arg) {
; CHECK-SAME: (i32 [[ARG:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[I1:%.*]] = alloca i32*, align 8
-; CHECK-NEXT: store i32 [[ARG]], i32* [[I]], align 4
+; CHECK-NEXT: [[I1:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: store i32 [[ARG]], ptr [[I]], align 4
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: [[I3:%.*]] = load i32, i32* [[I]], align 4
+; CHECK-NEXT: [[I3:%.*]] = load i32, ptr [[I]], align 4
; CHECK-NEXT: [[I4:%.*]] = add nsw i32 [[I3]], -1
-; CHECK-NEXT: store i32 [[I4]], i32* [[I]], align 4
+; CHECK-NEXT: store i32 [[I4]], ptr [[I]], align 4
; CHECK-NEXT: [[I5:%.*]] = icmp sgt i32 [[I4]], 0
; CHECK-NEXT: br i1 [[I5]], label [[BB6:%.*]], label [[BB9:%.*]]
; CHECK: bb6:
-; CHECK-NEXT: [[I7:%.*]] = call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: [[I8:%.*]] = bitcast i8* [[I7]] to i32*
+; CHECK-NEXT: [[I7:%.*]] = call noalias ptr @malloc(i64 noundef 4)
; CHECK-NEXT: br label [[BB2]]
; CHECK: bb9:
; CHECK-NEXT: ret i32 5
;
bb:
%i = alloca i32, align 4
- %i1 = alloca i32*, align 8
- store i32 %arg, i32* %i, align 4
+ %i1 = alloca ptr, align 8
+ store i32 %arg, ptr %i, align 4
br label %bb2
bb2:
- %i3 = load i32, i32* %i, align 4
+ %i3 = load i32, ptr %i, align 4
%i4 = add nsw i32 %i3, -1
- store i32 %i4, i32* %i, align 4
+ store i32 %i4, ptr %i, align 4
%i5 = icmp sgt i32 %i4, 0
br i1 %i5, label %bb6, label %bb9
bb6:
- %i7 = call noalias i8* @malloc(i64 4)
- %i8 = bitcast i8* %i7 to i32*
- store i32 1, i32* %i8, align 8
+ %i7 = call noalias ptr @malloc(i64 4)
+ store i32 1, ptr %i7, align 8
br label %bb2
bb9:
@@ -507,78 +493,72 @@ bb9:
define i32 @test13() {
; CHECK-LABEL: define {{[^@]+}}@test13() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 256)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 256)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 256)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 256)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define i32 @test_sle() {
; CHECK-LABEL: define {{[^@]+}}@test_sle() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef -1)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef -1)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @malloc(i64 -1)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 -1)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define i32 @test_overflow() {
; CHECK-LABEL: define {{[^@]+}}@test_overflow() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @calloc(i64 noundef 65537, i64 noundef 65537)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: [[I1:%.*]] = bitcast i8* [[I]] to i32*
-; CHECK-NEXT: store i32 10, i32* [[I1]], align 4
-; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[I1]], align 4
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @calloc(i64 noundef 65537, i64 noundef 65537)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: store i32 10, ptr [[I]], align 4
+; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[I]], align 4
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture nonnull align 4 dereferenceable(4) [[I]])
; CHECK-NEXT: ret i32 [[I2]]
;
bb:
- %i = tail call noalias i8* @calloc(i64 65537, i64 65537)
- tail call void @no_sync_func(i8* %i)
- %i1 = bitcast i8* %i to i32*
- store i32 10, i32* %i1, align 4
- %i2 = load i32, i32* %i1, align 4
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @calloc(i64 65537, i64 65537)
+ tail call void @no_sync_func(ptr %i)
+ store i32 10, ptr %i, align 4
+ %i2 = load i32, ptr %i, align 4
+ tail call void @free(ptr %i)
ret i32 %i2
}
define void @test14() {
; CHECK-LABEL: define {{[^@]+}}@test14() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @calloc(i64 noundef 64, i64 noundef 4)
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @calloc(i64 noundef 64, i64 noundef 4)
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @calloc(i64 64, i64 4)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @calloc(i64 64, i64 4)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
@@ -586,116 +566,116 @@ define void @test15(i64 %S) {
; CHECK-LABEL: define {{[^@]+}}@test15
; CHECK-SAME: (i64 [[S:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 [[S]])
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 [[S]])
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 %S)
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 %S)
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
-define void @test16a(i8 %v, i8** %P) {
+define void @test16a(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16a
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree readnone [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree readnone [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: store i8 [[V]], i8* [[I]], align 1
-; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[I]])
-; CHECK-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull dereferenceable(1) [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store i8 [[V]], ptr [[I]], align 1
+; CHECK-NEXT: tail call void @no_sync_func(ptr noalias nocapture nofree noundef nonnull dereferenceable(1) [[I]])
+; CHECK-NEXT: tail call void @free(ptr noalias nocapture noundef nonnull dereferenceable(1) [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8 %v, i8* %i, align 1
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* nonnull dereferenceable(1) %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store i8 %v, ptr %i, align 1
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr nonnull dereferenceable(1) %i)
ret void
}
-define void @test16b(i8 %v, i8** %P) {
+define void @test16b(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16b
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: store i8* [[I]], i8** [[P]], align 8
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]])
-; CHECK-NEXT: tail call void @free(i8* nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store ptr [[I]], ptr [[P]], align 8
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]])
+; CHECK-NEXT: tail call void @free(ptr nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** %P, align 8
- tail call void @no_sync_func(i8* %i)
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr %P, align 8
+ tail call void @no_sync_func(ptr %i)
+ tail call void @free(ptr %i)
ret void
}
-define void @test16c(i8 %v, i8** %P) {
+define void @test16c(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16c
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: store i8* [[I]], i8** [[P]], align 8
-; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[I]]) #[[ATTR6]]
-; CHECK-NEXT: tail call void @free(i8* nocapture [[I]])
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store ptr [[I]], ptr [[P]], align 8
+; CHECK-NEXT: tail call void @no_sync_func(ptr nocapture nofree [[I]]) #[[ATTR6]]
+; CHECK-NEXT: tail call void @free(ptr nocapture [[I]])
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** %P, align 8
- tail call void @no_sync_func(i8* %i) nounwind
- tail call void @free(i8* %i)
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr %P, align 8
+ tail call void @no_sync_func(ptr %i) nounwind
+ tail call void @free(ptr %i)
ret void
}
-define void @test16d(i8 %v, i8** %P) {
+define void @test16d(i8 %v, ptr %P) {
; CHECK-LABEL: define {{[^@]+}}@test16d
-; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) {
+; CHECK-SAME: (i8 [[V:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
-; CHECK-NEXT: store i8* [[I]], i8** [[P]], align 8
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @malloc(i64 noundef 4)
+; CHECK-NEXT: store ptr [[I]], ptr [[P]], align 8
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @malloc(i64 4)
- store i8* %i, i8** %P, align 8
+ %i = tail call noalias ptr @malloc(i64 4)
+ store ptr %i, ptr %P, align 8
ret void
}
-declare i8* @__kmpc_alloc_shared(i64)
-declare void @__kmpc_free_shared(i8* nocapture, i64)
+declare ptr @__kmpc_alloc_shared(i64)
+declare void @__kmpc_free_shared(ptr nocapture, i64)
define void @test17() {
; CHECK-LABEL: define {{[^@]+}}@test17() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
-; CHECK-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[I_H2S]] to i8*
-; CHECK-NEXT: tail call void @usei8(i8* noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR7:[0-9]+]]
+; CHECK-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast ptr addrspace(5) [[I_H2S]] to ptr
+; CHECK-NEXT: tail call void @usei8(ptr noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR7:[0-9]+]]
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @__kmpc_alloc_shared(i64 4)
- tail call void @usei8(i8* nocapture nofree %i) nosync nounwind willreturn
- tail call void @__kmpc_free_shared(i8* %i, i64 4)
+ %i = tail call noalias ptr @__kmpc_alloc_shared(i64 4)
+ tail call void @usei8(ptr nocapture nofree %i) nosync nounwind willreturn
+ tail call void @__kmpc_free_shared(ptr %i, i64 4)
ret void
}
define void @test17b() {
; CHECK-LABEL: define {{[^@]+}}@test17b() {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @__kmpc_alloc_shared(i64 noundef 4)
-; CHECK-NEXT: tail call void @usei8(i8* nofree [[I]]) #[[ATTR7]]
-; CHECK-NEXT: tail call void @__kmpc_free_shared(i8* nocapture [[I]], i64 noundef 4)
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @__kmpc_alloc_shared(i64 noundef 4)
+; CHECK-NEXT: tail call void @usei8(ptr nofree [[I]]) #[[ATTR7]]
+; CHECK-NEXT: tail call void @__kmpc_free_shared(ptr nocapture [[I]], i64 noundef 4)
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @__kmpc_alloc_shared(i64 4)
- tail call void @usei8(i8* nofree %i) nosync nounwind willreturn
- tail call void @__kmpc_free_shared(i8* %i, i64 4)
+ %i = tail call noalias ptr @__kmpc_alloc_shared(i64 4)
+ tail call void @usei8(ptr nofree %i) nosync nounwind willreturn
+ tail call void @__kmpc_free_shared(ptr %i, i64 4)
ret void
}
@@ -705,59 +685,59 @@ define void @move_alloca() {
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
; CHECK-NEXT: br label [[NOT_ENTRY:%.*]]
; CHECK: not_entry:
-; CHECK-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[I_H2S]] to i8*
-; CHECK-NEXT: tail call void @usei8(i8* noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR7]]
+; CHECK-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast ptr addrspace(5) [[I_H2S]] to ptr
+; CHECK-NEXT: tail call void @usei8(ptr noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR7]]
; CHECK-NEXT: ret void
;
entry:
br label %not_entry
not_entry:
- %i = tail call noalias i8* @__kmpc_alloc_shared(i64 4)
- tail call void @usei8(i8* nocapture nofree %i) nosync nounwind willreturn
- tail call void @__kmpc_free_shared(i8* %i, i64 4)
+ %i = tail call noalias ptr @__kmpc_alloc_shared(i64 4)
+ tail call void @usei8(ptr nocapture nofree %i) nosync nounwind willreturn
+ tail call void @__kmpc_free_shared(ptr %i, i64 4)
ret void
}
- at G = internal global i8* undef, align 4
+ at G = internal global ptr undef, align 4
define void @test16e(i8 %v) norecurse {
; CHECK: Function Attrs: norecurse
; CHECK-LABEL: define {{[^@]+}}@test16e
; CHECK-SAME: (i8 [[V:%.*]]) #[[ATTR5:[0-9]+]] {
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[I:%.*]] = tail call noalias i8* @__kmpc_alloc_shared(i64 noundef 4)
-; CHECK-NEXT: store i8* [[I]], i8** @G, align 8
-; CHECK-NEXT: call void @usei8(i8* nocapture nofree [[I]]) #[[ATTR8:[0-9]+]]
-; CHECK-NEXT: tail call void @__kmpc_free_shared(i8* noalias nocapture [[I]], i64 noundef 4)
+; CHECK-NEXT: [[I:%.*]] = tail call noalias ptr @__kmpc_alloc_shared(i64 noundef 4)
+; CHECK-NEXT: store ptr [[I]], ptr @G, align 8
+; CHECK-NEXT: call void @usei8(ptr nocapture nofree [[I]]) #[[ATTR8:[0-9]+]]
+; CHECK-NEXT: tail call void @__kmpc_free_shared(ptr noalias nocapture [[I]], i64 noundef 4)
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @__kmpc_alloc_shared(i64 4)
- store i8* %i, i8** @G, align 8
- %i1 = load i8*, i8** @G, align 8
- call void @usei8(i8* nocapture nofree %i1) nocallback nosync nounwind willreturn
- tail call void @__kmpc_free_shared(i8* %i, i64 4)
+ %i = tail call noalias ptr @__kmpc_alloc_shared(i64 4)
+ store ptr %i, ptr @G, align 8
+ %i1 = load ptr, ptr @G, align 8
+ call void @usei8(ptr nocapture nofree %i1) nocallback nosync nounwind willreturn
+ tail call void @__kmpc_free_shared(ptr %i, i64 4)
ret void
}
- at Gtl = internal thread_local global i8* undef, align 4
+ at Gtl = internal thread_local global ptr undef, align 4
define void @test16f(i8 %v) norecurse {
; CHECK: Function Attrs: norecurse
; CHECK-LABEL: define {{[^@]+}}@test16f
; CHECK-SAME: (i8 [[V:%.*]]) #[[ATTR5]] {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I_H2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
-; CHECK-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[I_H2S]] to i8*
-; CHECK-NEXT: store i8* [[MALLOC_CAST]], i8** @Gtl, align 8
-; CHECK-NEXT: call void @usei8(i8* nocapture nofree [[MALLOC_CAST]]) #[[ATTR8]]
+; CHECK-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast ptr addrspace(5) [[I_H2S]] to ptr
+; CHECK-NEXT: store ptr [[MALLOC_CAST]], ptr @Gtl, align 8
+; CHECK-NEXT: call void @usei8(ptr nocapture nofree [[MALLOC_CAST]]) #[[ATTR8]]
; CHECK-NEXT: ret void
;
bb:
- %i = tail call noalias i8* @__kmpc_alloc_shared(i64 4)
- store i8* %i, i8** @Gtl, align 8
- %i1 = load i8*, i8** @Gtl, align 8
- call void @usei8(i8* nocapture nofree %i1) nocallback nosync nounwind willreturn
- tail call void @__kmpc_free_shared(i8* %i, i64 4)
+ %i = tail call noalias ptr @__kmpc_alloc_shared(i64 4)
+ store ptr %i, ptr @Gtl, align 8
+ %i1 = load ptr, ptr @Gtl, align 8
+ call void @usei8(ptr nocapture nofree %i1) nocallback nosync nounwind willreturn
+ tail call void @__kmpc_free_shared(ptr %i, i64 4)
ret void
}
More information about the llvm-commits
mailing list