[llvm] e74390c - [FunctionAttrs] Convert tests to use opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 13 01:39:10 PDT 2022
Author: Nikita Popov
Date: 2022-10-13T10:38:11+02:00
New Revision: e74390cc9616417c3741af75f8eb19fdc5cd589f
URL: https://github.com/llvm/llvm-project/commit/e74390cc9616417c3741af75f8eb19fdc5cd589f
DIFF: https://github.com/llvm/llvm-project/commit/e74390cc9616417c3741af75f8eb19fdc5cd589f.diff
LOG: [FunctionAttrs] Convert tests to use opaque pointers (NFC)
Conversion performed using the script at:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
Added:
Modified:
llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
llvm/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
llvm/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
llvm/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
llvm/test/Transforms/FunctionAttrs/arg_returned.ll
llvm/test/Transforms/FunctionAttrs/argmemonly.ll
llvm/test/Transforms/FunctionAttrs/atomic.ll
llvm/test/Transforms/FunctionAttrs/comdat-ipo.ll
llvm/test/Transforms/FunctionAttrs/convergent.ll
llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
llvm/test/Transforms/FunctionAttrs/invalidate.ll
llvm/test/Transforms/FunctionAttrs/naked_functions.ll
llvm/test/Transforms/FunctionAttrs/nocapture.ll
llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
llvm/test/Transforms/FunctionAttrs/nofree.ll
llvm/test/Transforms/FunctionAttrs/nonnull-global.ll
llvm/test/Transforms/FunctionAttrs/nonnull.ll
llvm/test/Transforms/FunctionAttrs/noreturn.ll
llvm/test/Transforms/FunctionAttrs/nosync.ll
llvm/test/Transforms/FunctionAttrs/nounwind.ll
llvm/test/Transforms/FunctionAttrs/optnone-simple.ll
llvm/test/Transforms/FunctionAttrs/optnone.ll
llvm/test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll
llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
llvm/test/Transforms/FunctionAttrs/readattrs.ll
llvm/test/Transforms/FunctionAttrs/readnone.ll
llvm/test/Transforms/FunctionAttrs/stats.ll
llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
llvm/test/Transforms/FunctionAttrs/willreturn.ll
llvm/test/Transforms/FunctionAttrs/writeonly.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll b/llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
index b8c0d6c8542b..75fb113f1143 100644
--- a/llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
+++ b/llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
@@ -26,9 +26,9 @@ define i32 @g() readonly {
define i32 @h() readnone {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
; CHECK-LABEL: @h(
-; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* @x, align 4
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr @x, align 4
; CHECK-NEXT: ret i32 [[TMP]]
;
- %tmp = load i32, i32* @x
+ %tmp = load i32, ptr @x
ret i32 %tmp
}
diff --git a/llvm/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll b/llvm/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
index a296c78570f8..e77e6866d1d4 100644
--- a/llvm/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
+++ b/llvm/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
@@ -2,10 +2,10 @@
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
; PR2792
- at g = global i32 0 ; <i32*> [#uses=1]
+ at g = global i32 0 ; <ptr> [#uses=1]
define i32 @f() {
- %t = load volatile i32, i32* @g ; <i32> [#uses=1]
+ %t = load volatile i32, ptr @g ; <i32> [#uses=1]
ret i32 %t
}
diff --git a/llvm/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll b/llvm/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
index f6207fc74435..178b075f1ec7 100644
--- a/llvm/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
+++ b/llvm/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
@@ -6,9 +6,9 @@
define i8 @f() {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
; CHECK-LABEL: @f(
-; CHECK-NEXT: [[TMP:%.*]] = load i8, i8* @s, align 1
+; CHECK-NEXT: [[TMP:%.*]] = load i8, ptr @s, align 1
; CHECK-NEXT: ret i8 [[TMP]]
;
- %tmp = load i8, i8* @s
+ %tmp = load i8, ptr @s
ret i8 %tmp
}
diff --git a/llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll b/llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
index 435f7810fbde..b121842877d6 100644
--- a/llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
+++ b/llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
@@ -1,24 +1,24 @@
; RUN: opt < %s -function-attrs -S | FileCheck %s
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
-; CHECK: define i32* @a(i32** nocapture readonly %p)
-define i32* @a(i32** %p) {
- %tmp = load i32*, i32** %p
- ret i32* %tmp
+; CHECK: define ptr @a(ptr nocapture readonly %p)
+define ptr @a(ptr %p) {
+ %tmp = load ptr, ptr %p
+ ret ptr %tmp
}
-; CHECK: define i32* @b(i32* %q)
-define i32* @b(i32 *%q) {
- %mem = alloca i32*
- store i32* %q, i32** %mem
- %tmp = call i32* @a(i32** %mem)
- ret i32* %tmp
+; CHECK: define ptr @b(ptr %q)
+define ptr @b(ptr %q) {
+ %mem = alloca ptr
+ store ptr %q, ptr %mem
+ %tmp = call ptr @a(ptr %mem)
+ ret ptr %tmp
}
-; CHECK: define i32* @c(i32* readnone returned %r)
+; CHECK: define ptr @c(ptr readnone returned %r)
@g = global i32 0
-define i32* @c(i32 *%r) {
- %a = icmp eq i32* %r, null
- store i32 1, i32* @g
- ret i32* %r
+define ptr @c(ptr %r) {
+ %a = icmp eq ptr %r, null
+ store i32 1, ptr @g
+ ret ptr %r
}
diff --git a/llvm/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll b/llvm/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
index c5361b995482..1e2b242eda14 100644
--- a/llvm/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
+++ b/llvm/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
@@ -9,6 +9,6 @@
; CHECK-NOT: readonly
; CHECK-NEXT: void @foo()
define void @foo() {
- %tmp = load volatile i32, i32* @g
+ %tmp = load volatile i32, ptr @g
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/arg_returned.ll b/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
index 9ee90f9719e7..7df782e41183 100644
--- a/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
+++ b/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
@@ -145,84 +145,84 @@ return: ; preds = %cond.end, %if.then3
; TEST SCC test returning a pointer value argument
;
-; FNATTR: define double* @ptr_sink_r0(double* readnone returned %r)
-; FNATTR: define double* @ptr_scc_r1(double* %a, double* readnone %r, double* nocapture readnone %b)
-; FNATTR: define double* @ptr_scc_r2(double* readnone %a, double* readnone %b, double* readnone %r)
+; FNATTR: define ptr @ptr_sink_r0(ptr readnone returned %r)
+; FNATTR: define ptr @ptr_scc_r1(ptr %a, ptr readnone %r, ptr nocapture readnone %b)
+; FNATTR: define ptr @ptr_scc_r2(ptr readnone %a, ptr readnone %b, ptr readnone %r)
;
;
-; double* ptr_scc_r1(double* a, double* b, double* r);
-; double* ptr_scc_r2(double* a, double* b, double* r);
+; ptr ptr_scc_r1(ptr a, ptr b, ptr r);
+; ptr ptr_scc_r2(ptr a, ptr b, ptr r);
;
-; __attribute__((noinline)) double* ptr_sink_r0(double* r) {
+; __attribute__((noinline)) ptr ptr_sink_r0(ptr r) {
; return r;
; }
;
-; __attribute__((noinline)) double* ptr_scc_r1(double* a, double* r, double* b) {
+; __attribute__((noinline)) ptr ptr_scc_r1(ptr a, ptr r, ptr b) {
; return ptr_scc_r2(r, a, ptr_sink_r0(r));
; }
;
-; __attribute__((noinline)) double* ptr_scc_r2(double* a, double* b, double* r) {
+; __attribute__((noinline)) ptr ptr_scc_r2(ptr a, ptr b, ptr r) {
; if (a > b)
; return ptr_scc_r2(b, a, ptr_sink_r0(r));
; if (a < b)
; return ptr_scc_r1(ptr_sink_r0(b), ptr_scc_r2(ptr_scc_r1(a, b, r), ptr_scc_r1(a, ptr_scc_r2(r, r, r), r), ptr_scc_r2(a, b, r)), ptr_scc_r1(a, b, r));
; return a == b ? r : ptr_scc_r2(a, b, r);
; }
-define double* @ptr_sink_r0(double* %r) #0 {
+define ptr @ptr_sink_r0(ptr %r) #0 {
entry:
- ret double* %r
+ ret ptr %r
}
-define double* @ptr_scc_r1(double* %a, double* %r, double* %b) #0 {
+define ptr @ptr_scc_r1(ptr %a, ptr %r, ptr %b) #0 {
entry:
- %call = call double* @ptr_sink_r0(double* %r)
- %call1 = call double* @ptr_scc_r2(double* %r, double* %a, double* %call)
- ret double* %call1
+ %call = call ptr @ptr_sink_r0(ptr %r)
+ %call1 = call ptr @ptr_scc_r2(ptr %r, ptr %a, ptr %call)
+ ret ptr %call1
}
-define double* @ptr_scc_r2(double* %a, double* %b, double* %r) #0 {
+define ptr @ptr_scc_r2(ptr %a, ptr %b, ptr %r) #0 {
entry:
- %cmp = icmp ugt double* %a, %b
+ %cmp = icmp ugt ptr %a, %b
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
- %call = call double* @ptr_sink_r0(double* %r)
- %call1 = call double* @ptr_scc_r2(double* %b, double* %a, double* %call)
+ %call = call ptr @ptr_sink_r0(ptr %r)
+ %call1 = call ptr @ptr_scc_r2(ptr %b, ptr %a, ptr %call)
br label %return
if.end: ; preds = %entry
- %cmp2 = icmp ult double* %a, %b
+ %cmp2 = icmp ult ptr %a, %b
br i1 %cmp2, label %if.then3, label %if.end12
if.then3: ; preds = %if.end
- %call4 = call double* @ptr_sink_r0(double* %b)
- %call5 = call double* @ptr_scc_r1(double* %a, double* %b, double* %r)
- %call6 = call double* @ptr_scc_r2(double* %r, double* %r, double* %r)
- %call7 = call double* @ptr_scc_r1(double* %a, double* %call6, double* %r)
- %call8 = call double* @ptr_scc_r2(double* %a, double* %b, double* %r)
- %call9 = call double* @ptr_scc_r2(double* %call5, double* %call7, double* %call8)
- %call10 = call double* @ptr_scc_r1(double* %a, double* %b, double* %r)
- %call11 = call double* @ptr_scc_r1(double* %call4, double* %call9, double* %call10)
+ %call4 = call ptr @ptr_sink_r0(ptr %b)
+ %call5 = call ptr @ptr_scc_r1(ptr %a, ptr %b, ptr %r)
+ %call6 = call ptr @ptr_scc_r2(ptr %r, ptr %r, ptr %r)
+ %call7 = call ptr @ptr_scc_r1(ptr %a, ptr %call6, ptr %r)
+ %call8 = call ptr @ptr_scc_r2(ptr %a, ptr %b, ptr %r)
+ %call9 = call ptr @ptr_scc_r2(ptr %call5, ptr %call7, ptr %call8)
+ %call10 = call ptr @ptr_scc_r1(ptr %a, ptr %b, ptr %r)
+ %call11 = call ptr @ptr_scc_r1(ptr %call4, ptr %call9, ptr %call10)
br label %return
if.end12: ; preds = %if.end
- %cmp13 = icmp eq double* %a, %b
+ %cmp13 = icmp eq ptr %a, %b
br i1 %cmp13, label %cond.true, label %cond.false
cond.true: ; preds = %if.end12
br label %cond.end
cond.false: ; preds = %if.end12
- %call14 = call double* @ptr_scc_r2(double* %a, double* %b, double* %r)
+ %call14 = call ptr @ptr_scc_r2(ptr %a, ptr %b, ptr %r)
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
- %cond = phi double* [ %r, %cond.true ], [ %call14, %cond.false ]
+ %cond = phi ptr [ %r, %cond.true ], [ %call14, %cond.false ]
br label %return
return: ; preds = %cond.end, %if.then3, %if.then
- %retval.0 = phi double* [ %call1, %if.then ], [ %call11, %if.then3 ], [ %cond, %cond.end ]
- ret double* %retval.0
+ %retval.0 = phi ptr [ %call1, %if.then ], [ %call11, %if.then3 ], [ %cond, %cond.end ]
+ ret ptr %retval.0
}
@@ -232,14 +232,14 @@ return: ; preds = %cond.end, %if.then3
; return *a ? a : rt0(a);
; }
;
-; FNATTR: define i32* @rt0(i32* readonly %a)
-define i32* @rt0(i32* %a) #0 {
+; FNATTR: define ptr @rt0(ptr readonly %a)
+define ptr @rt0(ptr %a) #0 {
entry:
- %v = load i32, i32* %a, align 4
+ %v = load i32, ptr %a, align 4
%tobool = icmp ne i32 %v, 0
- %call = call i32* @rt0(i32* %a)
- %sel = select i1 %tobool, i32* %a, i32* %call
- ret i32* %sel
+ %call = call ptr @rt0(ptr %a)
+ %sel = select i1 %tobool, ptr %a, ptr %call
+ ret ptr %sel
}
; TEST a no-return singleton SCC
@@ -248,67 +248,67 @@ entry:
; return *a ? undef : rt1(a);
; }
;
-; FNATTR: define noalias i32* @rt1(i32* nocapture readonly %a)
-define i32* @rt1(i32* %a) #0 {
+; FNATTR: define noalias ptr @rt1(ptr nocapture readonly %a)
+define ptr @rt1(ptr %a) #0 {
entry:
- %v = load i32, i32* %a, align 4
+ %v = load i32, ptr %a, align 4
%tobool = icmp ne i32 %v, 0
- %call = call i32* @rt1(i32* %a)
- %sel = select i1 %tobool, i32* undef, i32* %call
- ret i32* %sel
+ %call = call ptr @rt1(ptr %a)
+ %sel = select i1 %tobool, ptr undef, ptr %call
+ ret ptr %sel
}
; TEST another SCC test
;
-; FNATTR: define i32* @rt2_helper(i32* %a)
-; FNATTR: define i32* @rt2(i32* readnone %a, i32* readnone %b)
-define i32* @rt2_helper(i32* %a) #0 {
+; FNATTR: define ptr @rt2_helper(ptr %a)
+; FNATTR: define ptr @rt2(ptr readnone %a, ptr readnone %b)
+define ptr @rt2_helper(ptr %a) #0 {
entry:
- %call = call i32* @rt2(i32* %a, i32* %a)
- ret i32* %call
+ %call = call ptr @rt2(ptr %a, ptr %a)
+ ret ptr %call
}
-define i32* @rt2(i32* %a, i32 *%b) #0 {
+define ptr @rt2(ptr %a, ptr %b) #0 {
entry:
- %cmp = icmp eq i32* %a, null
+ %cmp = icmp eq ptr %a, null
br i1 %cmp, label %if.then, label %if.end
if.then:
- %call = call i32* @rt2_helper(i32* %a)
+ %call = call ptr @rt2_helper(ptr %a)
br label %if.end
if.end:
- %sel = phi i32* [ %b, %entry], [%call, %if.then]
- ret i32* %sel
+ %sel = phi ptr [ %b, %entry], [%call, %if.then]
+ ret ptr %sel
}
; TEST another SCC test
;
-; FNATTR: define i32* @rt3_helper(i32* %a, i32* %b)
-; FNATTR: define i32* @rt3(i32* readnone %a, i32* readnone %b)
-define i32* @rt3_helper(i32* %a, i32* %b) #0 {
+; FNATTR: define ptr @rt3_helper(ptr %a, ptr %b)
+; FNATTR: define ptr @rt3(ptr readnone %a, ptr readnone %b)
+define ptr @rt3_helper(ptr %a, ptr %b) #0 {
entry:
- %call = call i32* @rt3(i32* %a, i32* %b)
- ret i32* %call
+ %call = call ptr @rt3(ptr %a, ptr %b)
+ ret ptr %call
}
-define i32* @rt3(i32* %a, i32 *%b) #0 {
+define ptr @rt3(ptr %a, ptr %b) #0 {
entry:
- %cmp = icmp eq i32* %a, null
+ %cmp = icmp eq ptr %a, null
br i1 %cmp, label %if.then, label %if.end
if.then:
- %call = call i32* @rt3_helper(i32* %a, i32* %b)
+ %call = call ptr @rt3_helper(ptr %a, ptr %b)
br label %if.end
if.end:
- %sel = phi i32* [ %b, %entry], [%call, %if.then]
- ret i32* %sel
+ %sel = phi ptr [ %b, %entry], [%call, %if.then]
+ ret ptr %sel
}
; TEST address taken function with call to an external functions
;
-; void unknown_fn(void *);
+; void unknown_fn(ptr);
;
; int* calls_unknown_fn(int *r) {
; unknown_fn(&calls_unknown_fn);
@@ -316,12 +316,12 @@ if.end:
; }
;
;
-; FNATTR: define i32* @calls_unknown_fn(i32* readnone returned %r)
-declare void @unknown_fn(i32* (i32*)*) #0
+; FNATTR: define ptr @calls_unknown_fn(ptr readnone returned %r)
+declare void @unknown_fn(ptr) #0
-define i32* @calls_unknown_fn(i32* %r) #0 {
- tail call void @unknown_fn(i32* (i32*)* nonnull @calls_unknown_fn)
- ret i32* %r
+define ptr @calls_unknown_fn(ptr %r) #0 {
+ tail call void @unknown_fn(ptr nonnull @calls_unknown_fn)
+ ret ptr %r
}
@@ -338,16 +338,16 @@ define i32* @calls_unknown_fn(i32* %r) #0 {
; Verify the maybe-redefined function is not annotated:
;
;
-; FNATTR: define i32* @calls_maybe_redefined_fn2(i32* %r)
-define linkonce_odr i32* @maybe_redefined_fn2(i32* %r) #0 {
+; FNATTR: define ptr @calls_maybe_redefined_fn2(ptr %r)
+define linkonce_odr ptr @maybe_redefined_fn2(ptr %r) #0 {
entry:
- ret i32* %r
+ ret ptr %r
}
-define i32* @calls_maybe_redefined_fn2(i32* %r) #0 {
+define ptr @calls_maybe_redefined_fn2(ptr %r) #0 {
entry:
- %call = call i32* @maybe_redefined_fn2(i32* %r)
- ret i32* %call
+ %call = call ptr @maybe_redefined_fn2(ptr %r)
+ ret ptr %call
}
@@ -410,150 +410,139 @@ if.end: ; preds = %if.then, %entry
; TEST returned argument goes through bitcasts
;
-; double* bitcast(int* b) {
-; return (double*)b;
+; ptr bitcast(int* b) {
+; return (ptr)b;
; }
;
;
-; FNATTR: define double* @bitcast(i32* readnone %b)
+; FNATTR: define ptr @bitcast(ptr readnone returned %b)
;
-define double* @bitcast(i32* %b) #0 {
+define ptr @bitcast(ptr %b) #0 {
entry:
- %bc0 = bitcast i32* %b to double*
- ret double* %bc0
+ ret ptr %b
}
; TEST returned argument goes through select and phi interleaved with bitcasts
;
-; double* bitcasts_select_and_phi(int* b) {
-; double* x = b;
+; ptr bitcasts_select_and_phi(int* b) {
+; ptr x = b;
; if (b == 0)
; x = b;
; return b != 0 ? b : x;
; }
;
;
-; FNATTR: define double* @bitcasts_select_and_phi(i32* readnone %b)
+; FNATTR: define ptr @bitcasts_select_and_phi(ptr readnone %b)
;
-define double* @bitcasts_select_and_phi(i32* %b) #0 {
+define ptr @bitcasts_select_and_phi(ptr %b) #0 {
entry:
- %bc0 = bitcast i32* %b to double*
- %cmp = icmp eq double* %bc0, null
+ %cmp = icmp eq ptr %b, null
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
- %bc1 = bitcast i32* %b to double*
br label %if.end
if.end: ; preds = %if.then, %entry
- %phi = phi double* [ %bc1, %if.then ], [ %bc0, %entry ]
- %bc2 = bitcast double* %phi to i8*
- %bc3 = bitcast i32* %b to i8*
- %cmp2 = icmp ne double* %bc0, null
- %sel = select i1 %cmp2, i8* %bc2, i8* %bc3
- %bc4 = bitcast i8* %sel to double*
- ret double* %bc4
+ %phi = phi ptr [ %b, %if.then ], [ %b, %entry ]
+ %cmp2 = icmp ne ptr %b, null
+ %sel = select i1 %cmp2, ptr %phi, ptr %b
+ ret ptr %sel
}
; TEST return argument or argument or undef
;
-; double* ret_arg_arg_undef(int* b) {
+; ptr ret_arg_arg_undef(int* b) {
; if (b == 0)
-; return (double*)b;
+; return (ptr)b;
; if (b == 0)
-; return (double*)b;
+; return (ptr)b;
; /* return undef */
; }
;
;
-; FNATTR: define double* @ret_arg_arg_undef(i32* readnone %b)
+; FNATTR: define ptr @ret_arg_arg_undef(ptr readnone %b)
;
-define double* @ret_arg_arg_undef(i32* %b) #0 {
+define ptr @ret_arg_arg_undef(ptr %b) #0 {
entry:
- %bc0 = bitcast i32* %b to double*
- %cmp = icmp eq double* %bc0, null
+ %cmp = icmp eq ptr %b, null
br i1 %cmp, label %ret_arg0, label %if.end
ret_arg0:
- %bc1 = bitcast i32* %b to double*
- ret double* %bc1
+ ret ptr %b
if.end:
br i1 %cmp, label %ret_arg1, label %ret_undef
ret_arg1:
- ret double* %bc0
+ ret ptr %b
ret_undef:
- ret double *undef
+ ret ptr undef
}
; TEST return undef or argument or argument
;
-; double* ret_undef_arg_arg(int* b) {
+; ptr ret_undef_arg_arg(int* b) {
; if (b == 0)
-; return (double*)b;
+; return (ptr)b;
; if (b == 0)
-; return (double*)b;
+; return (ptr)b;
; /* return undef */
; }
;
;
-; FNATTR: define double* @ret_undef_arg_arg(i32* readnone %b)
+; FNATTR: define ptr @ret_undef_arg_arg(ptr readnone %b)
;
-define double* @ret_undef_arg_arg(i32* %b) #0 {
+define ptr @ret_undef_arg_arg(ptr %b) #0 {
entry:
- %bc0 = bitcast i32* %b to double*
- %cmp = icmp eq double* %bc0, null
+ %cmp = icmp eq ptr %b, null
br i1 %cmp, label %ret_undef, label %if.end
ret_undef:
- ret double *undef
+ ret ptr undef
if.end:
br i1 %cmp, label %ret_arg0, label %ret_arg1
ret_arg0:
- ret double* %bc0
+ ret ptr %b
ret_arg1:
- %bc1 = bitcast i32* %b to double*
- ret double* %bc1
+ ret ptr %b
}
; TEST return undef or argument or undef
;
-; double* ret_undef_arg_undef(int* b) {
+; ptr ret_undef_arg_undef(int* b) {
; if (b == 0)
; /* return undef */
; if (b == 0)
-; return (double*)b;
+; return (ptr)b;
; /* return undef */
; }
;
;
-; FNATTR: define double* @ret_undef_arg_undef(i32* readnone %b)
-define double* @ret_undef_arg_undef(i32* %b) #0 {
+; FNATTR: define ptr @ret_undef_arg_undef(ptr readnone %b)
+define ptr @ret_undef_arg_undef(ptr %b) #0 {
entry:
- %bc0 = bitcast i32* %b to double*
- %cmp = icmp eq double* %bc0, null
+ %cmp = icmp eq ptr %b, null
br i1 %cmp, label %ret_undef0, label %if.end
ret_undef0:
- ret double *undef
+ ret ptr undef
if.end:
br i1 %cmp, label %ret_arg, label %ret_undef1
ret_arg:
- ret double* %bc0
+ ret ptr %b
ret_undef1:
- ret double *undef
+ ret ptr undef
}
; TEST return argument or unknown call result
@@ -566,38 +555,38 @@ ret_undef1:
;
; Verify we do not assume b is returned
;
-; FNATTR: define i32* @ret_arg_or_unknown(i32* %b)
-; FNATTR: define i32* @ret_arg_or_unknown_through_phi(i32* %b)
-declare i32* @unknown(i32*)
+; FNATTR: define ptr @ret_arg_or_unknown(ptr %b)
+; FNATTR: define ptr @ret_arg_or_unknown_through_phi(ptr %b)
+declare ptr @unknown(ptr)
-define i32* @ret_arg_or_unknown(i32* %b) #0 {
+define ptr @ret_arg_or_unknown(ptr %b) #0 {
entry:
- %cmp = icmp eq i32* %b, null
+ %cmp = icmp eq ptr %b, null
br i1 %cmp, label %ret_arg, label %ret_unknown
ret_arg:
- ret i32* %b
+ ret ptr %b
ret_unknown:
- %call = call i32* @unknown(i32* %b)
- ret i32* %call
+ %call = call ptr @unknown(ptr %b)
+ ret ptr %call
}
-define i32* @ret_arg_or_unknown_through_phi(i32* %b) #0 {
+define ptr @ret_arg_or_unknown_through_phi(ptr %b) #0 {
entry:
- %cmp = icmp eq i32* %b, null
+ %cmp = icmp eq ptr %b, null
br i1 %cmp, label %ret_arg, label %ret_unknown
ret_arg:
br label %r
ret_unknown:
- %call = call i32* @unknown(i32* %b)
+ %call = call ptr @unknown(ptr %b)
br label %r
r:
- %phi = phi i32* [ %b, %ret_arg ], [ %call, %ret_unknown ]
- ret i32* %phi
+ %phi = phi ptr [ %b, %ret_arg ], [ %call, %ret_unknown ]
+ ret ptr %phi
}
; TEST inconsistent IR in dead code.
diff --git a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
index 4b67d2feca08..5ea9582dfe10 100644
--- a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
+++ b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
@@ -13,27 +13,27 @@ entry:
ret void
}
-define i32 @test_only_read_arg(i32* %ptr) {
+define i32 @test_only_read_arg(ptr %ptr) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn
; CHECK-LABEL: @test_only_read_arg(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[L:%.*]] = load i32, i32* [[PTR:%.*]], align 4
+; CHECK-NEXT: [[L:%.*]] = load i32, ptr [[PTR:%.*]], align 4
; CHECK-NEXT: ret i32 [[L]]
;
entry:
- %l = load i32, i32* %ptr
+ %l = load i32, ptr %ptr
ret i32 %l
}
-define i32 @test_only_read_arg_already_has_argmemonly(i32* %ptr) argmemonly {
+define i32 @test_only_read_arg_already_has_argmemonly(ptr %ptr) argmemonly {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn
; CHECK-LABEL: @test_only_read_arg_already_has_argmemonly(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[L:%.*]] = load i32, i32* [[PTR:%.*]], align 4
+; CHECK-NEXT: [[L:%.*]] = load i32, ptr [[PTR:%.*]], align 4
; CHECK-NEXT: ret i32 [[L]]
;
entry:
- %l = load i32, i32* %ptr
+ %l = load i32, ptr %ptr
ret i32 %l
}
@@ -41,37 +41,37 @@ define i32 @test_read_global() {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readonly willreturn
; CHECK-LABEL: @test_read_global(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[L:%.*]] = load i32, i32* @g, align 4
+; CHECK-NEXT: [[L:%.*]] = load i32, ptr @g, align 4
; CHECK-NEXT: ret i32 [[L]]
;
entry:
- %l = load i32, i32* @g
+ %l = load i32, ptr @g
ret i32 %l
}
-define i32 @test_read_loaded_ptr(i32** %ptr) {
+define i32 @test_read_loaded_ptr(ptr %ptr) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readonly willreturn
; CHECK-LABEL: @test_read_loaded_ptr(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[L:%.*]] = load i32*, i32** [[PTR:%.*]], align 8
-; CHECK-NEXT: [[L_2:%.*]] = load i32, i32* [[L]], align 4
+; CHECK-NEXT: [[L:%.*]] = load ptr, ptr [[PTR:%.*]], align 8
+; CHECK-NEXT: [[L_2:%.*]] = load i32, ptr [[L]], align 4
; CHECK-NEXT: ret i32 [[L_2]]
;
entry:
- %l = load i32*, i32** %ptr
- %l.2 = load i32, i32* %l
+ %l = load ptr, ptr %ptr
+ %l.2 = load i32, ptr %l
ret i32 %l.2
}
-define void @test_only_write_arg(i32* %ptr) {
+define void @test_only_write_arg(ptr %ptr) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn writeonly
; CHECK-LABEL: @test_only_write_arg(
; CHECK-NEXT: entry:
-; CHECK-NEXT: store i32 0, i32* [[PTR:%.*]], align 4
+; CHECK-NEXT: store i32 0, ptr [[PTR:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
- store i32 0, i32* %ptr
+ store i32 0, ptr %ptr
ret void
}
@@ -79,11 +79,11 @@ define void @test_write_global() {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn writeonly
; CHECK-LABEL: @test_write_global(
; CHECK-NEXT: entry:
-; CHECK-NEXT: store i32 0, i32* @g, align 4
+; CHECK-NEXT: store i32 0, ptr @g, align 4
; CHECK-NEXT: ret void
;
entry:
- store i32 0, i32* @g
+ store i32 0, ptr @g
ret void
}
@@ -102,105 +102,101 @@ entry:
declare i32 @fn_readnone() readnone
-define void @test_call_readnone(i32* %ptr) {
+define void @test_call_readnone(ptr %ptr) {
; CHECK: Function Attrs: argmemonly writeonly
; CHECK-LABEL: @test_call_readnone(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C:%.*]] = call i32 @fn_readnone()
-; CHECK-NEXT: store i32 [[C]], i32* [[PTR:%.*]], align 4
+; CHECK-NEXT: store i32 [[C]], ptr [[PTR:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%c = call i32 @fn_readnone()
- store i32 %c, i32* %ptr
+ store i32 %c, ptr %ptr
ret void
}
-declare i32 @fn_argmemonly(i32*) argmemonly
+declare i32 @fn_argmemonly(ptr) argmemonly
-define i32 @test_call_argmemonly(i32* %ptr) {
+define i32 @test_call_argmemonly(ptr %ptr) {
; CHECK: Function Attrs: argmemonly
; CHECK-LABEL: @test_call_argmemonly(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[C:%.*]] = call i32 @fn_argmemonly(i32* [[PTR:%.*]])
+; CHECK-NEXT: [[C:%.*]] = call i32 @fn_argmemonly(ptr [[PTR:%.*]])
; CHECK-NEXT: ret i32 [[C]]
;
entry:
- %c = call i32 @fn_argmemonly(i32* %ptr)
+ %c = call i32 @fn_argmemonly(ptr %ptr)
ret i32 %c
}
-define i32 @test_call_fn_where_argmemonly_can_be_inferred(i32* %ptr) {
+define i32 @test_call_fn_where_argmemonly_can_be_inferred(ptr %ptr) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn
; CHECK-LABEL: @test_call_fn_where_argmemonly_can_be_inferred(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[C:%.*]] = call i32 @test_only_read_arg(i32* [[PTR:%.*]])
+; CHECK-NEXT: [[C:%.*]] = call i32 @test_only_read_arg(ptr [[PTR:%.*]])
; CHECK-NEXT: ret i32 [[C]]
;
entry:
- %c = call i32 @test_only_read_arg(i32* %ptr)
+ %c = call i32 @test_only_read_arg(ptr %ptr)
ret i32 %c
}
-define void @test_memcpy_argonly(i8* %dst, i8* %src) {
+define void @test_memcpy_argonly(ptr %dst, ptr %src) {
; CHECK: Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn
; CHECK-LABEL: @test_memcpy_argonly(
; CHECK-NEXT: entry:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[SRC:%.*]], i64 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr [[SRC:%.*]], i64 32, i1 false)
; CHECK-NEXT: ret void
;
entry:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 32, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
@arr = global [32 x i8] zeroinitializer
-define void @test_memcpy_src_global(i8* %dst) {
+define void @test_memcpy_src_global(ptr %dst) {
; CHECK: Function Attrs: mustprogress nofree nosync nounwind willreturn
; CHECK-LABEL: @test_memcpy_src_global(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[BC:%.*]] = bitcast [32 x i8]* @arr to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[BC]], i64 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr @arr, i64 32, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %bc = bitcast [32 x i8]* @arr to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %bc, i64 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr @arr, i64 32, i1 false)
ret void
}
-define void @test_memcpy_dst_global(i8* %src) {
+define void @test_memcpy_dst_global(ptr %src) {
; CHECK: Function Attrs: mustprogress nofree nosync nounwind willreturn
; CHECK-LABEL: @test_memcpy_dst_global(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[BC:%.*]] = bitcast [32 x i8]* @arr to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[BC]], i8* [[SRC:%.*]], i64 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr @arr, ptr [[SRC:%.*]], i64 32, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %bc = bitcast [32 x i8]* @arr to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bc, i8* %src, i64 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr @arr, ptr %src, i64 32, i1 false)
ret void
}
-define i32 @test_read_arg_access_alloca(i32* %ptr) {
+define i32 @test_read_arg_access_alloca(ptr %ptr) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn
; CHECK-LABEL: @test_read_arg_access_alloca(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[L:%.*]] = load i32, i32* [[PTR:%.*]], align 4
-; CHECK-NEXT: store i32 [[L]], i32* [[A]], align 4
-; CHECK-NEXT: [[L_2:%.*]] = load i32, i32* [[A]], align 4
+; CHECK-NEXT: [[L:%.*]] = load i32, ptr [[PTR:%.*]], align 4
+; CHECK-NEXT: store i32 [[L]], ptr [[A]], align 4
+; CHECK-NEXT: [[L_2:%.*]] = load i32, ptr [[A]], align 4
; CHECK-NEXT: ret i32 [[L_2]]
;
entry:
%a = alloca i32
- %l = load i32, i32* %ptr
- store i32 %l, i32* %a
- %l.2 = load i32, i32* %a
+ %l = load i32, ptr %ptr
+ store i32 %l, ptr %a
+ %l.2 = load i32, ptr %a
ret i32 %l.2
}
@@ -226,26 +222,26 @@ define void @test_inaccessiblememonly_readonly() {
ret void
}
-define void @test_inaccessibleorargmemonly_readonly(i32* %arg) {
+define void @test_inaccessibleorargmemonly_readonly(ptr %arg) {
; CHECK: Function Attrs: inaccessiblemem_or_argmemonly nofree readonly
; CHECK-LABEL: @test_inaccessibleorargmemonly_readonly(
-; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[ARG:%.*]], align 4
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARG:%.*]], align 4
; CHECK-NEXT: call void @fn_inaccessiblememonly() #[[ATTR15]]
; CHECK-NEXT: ret void
;
- load i32, i32* %arg
+ load i32, ptr %arg
call void @fn_inaccessiblememonly() readonly
ret void
}
-define void @test_inaccessibleorargmemonly_readwrite(i32* %arg) {
+define void @test_inaccessibleorargmemonly_readwrite(ptr %arg) {
; CHECK: Function Attrs: inaccessiblemem_or_argmemonly
; CHECK-LABEL: @test_inaccessibleorargmemonly_readwrite(
-; CHECK-NEXT: store i32 0, i32* [[ARG:%.*]], align 4
+; CHECK-NEXT: store i32 0, ptr [[ARG:%.*]], align 4
; CHECK-NEXT: call void @fn_inaccessiblememonly() #[[ATTR15]]
; CHECK-NEXT: ret void
;
- store i32 0, i32* %arg
+ store i32 0, ptr %arg
call void @fn_inaccessiblememonly() readonly
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/atomic.ll b/llvm/test/Transforms/FunctionAttrs/atomic.ll
index 50d9263d78e4..33711acd7d54 100644
--- a/llvm/test/Transforms/FunctionAttrs/atomic.ll
+++ b/llvm/test/Transforms/FunctionAttrs/atomic.ll
@@ -8,26 +8,26 @@ define i32 @test1(i32 %x) uwtable ssp {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4
-; CHECK-NEXT: store atomic i32 [[X:%.*]], i32* [[X_ADDR]] seq_cst, align 4
-; CHECK-NEXT: [[R:%.*]] = load atomic i32, i32* [[X_ADDR]] seq_cst, align 4
+; CHECK-NEXT: store atomic i32 [[X:%.*]], ptr [[X_ADDR]] seq_cst, align 4
+; CHECK-NEXT: [[R:%.*]] = load atomic i32, ptr [[X_ADDR]] seq_cst, align 4
; CHECK-NEXT: ret i32 [[R]]
;
entry:
%x.addr = alloca i32, align 4
- store atomic i32 %x, i32* %x.addr seq_cst, align 4
- %r = load atomic i32, i32* %x.addr seq_cst, align 4
+ store atomic i32 %x, ptr %x.addr seq_cst, align 4
+ %r = load atomic i32, ptr %x.addr seq_cst, align 4
ret i32 %r
}
; A function with an Acquire load is not readonly.
-define i32 @test2(i32* %x) uwtable ssp {
+define i32 @test2(ptr %x) uwtable ssp {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind ssp willreturn uwtable
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[R:%.*]] = load atomic i32, i32* [[X:%.*]] seq_cst, align 4
+; CHECK-NEXT: [[R:%.*]] = load atomic i32, ptr [[X:%.*]] seq_cst, align 4
; CHECK-NEXT: ret i32 [[R]]
;
entry:
- %r = load atomic i32, i32* %x seq_cst, align 4
+ %r = load atomic i32, ptr %x seq_cst, align 4
ret i32 %r
}
diff --git a/llvm/test/Transforms/FunctionAttrs/comdat-ipo.ll b/llvm/test/Transforms/FunctionAttrs/comdat-ipo.ll
index 4ad080bff425..ed249cdaa9c2 100644
--- a/llvm/test/Transforms/FunctionAttrs/comdat-ipo.ll
+++ b/llvm/test/Transforms/FunctionAttrs/comdat-ipo.ll
@@ -3,15 +3,15 @@
; See PR26774
-; CHECK-LABEL: define void @bar(i8* readonly %0) {
-define void @bar(i8* readonly) {
- call void @foo(i8* %0)
+; CHECK-LABEL: define void @bar(ptr readonly %0) {
+define void @bar(ptr readonly) {
+ call void @foo(ptr %0)
ret void
}
-; CHECK-LABEL: define linkonce_odr void @foo(i8* readonly %0) {
-define linkonce_odr void @foo(i8* readonly) {
- call void @bar(i8* %0)
+; CHECK-LABEL: define linkonce_odr void @foo(ptr readonly %0) {
+define linkonce_odr void @foo(ptr readonly) {
+ call void @bar(ptr %0)
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/convergent.ll b/llvm/test/Transforms/FunctionAttrs/convergent.ll
index e31a80b9c934..34598628688f 100644
--- a/llvm/test/Transforms/FunctionAttrs/convergent.ll
+++ b/llvm/test/Transforms/FunctionAttrs/convergent.ll
@@ -47,10 +47,10 @@ define i32 @extern_non_convergent_call() convergent {
ret i32 %a
}
-define i32 @indirect_convergent_call(i32 ()* %f) convergent {
+define i32 @indirect_convergent_call(ptr %f) convergent {
; CHECK: Function Attrs: convergent
; CHECK-LABEL: define {{[^@]+}}@indirect_convergent_call
-; CHECK-SAME: (i32 ()* nocapture readonly [[F:%.*]]) #[[ATTR1]] {
+; CHECK-SAME: (ptr nocapture readonly [[F:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[A:%.*]] = call i32 [[F]]() #[[ATTR1]]
; CHECK-NEXT: ret i32 [[A]]
;
@@ -59,10 +59,10 @@ define i32 @indirect_convergent_call(i32 ()* %f) convergent {
}
; Give indirect_non_convergent_call the norecurse attribute so we get a
; "Function Attrs" comment in the output.
-define i32 @indirect_non_convergent_call(i32 ()* %f) convergent norecurse {
+define i32 @indirect_non_convergent_call(ptr %f) convergent norecurse {
; CHECK: Function Attrs: norecurse
; CHECK-LABEL: define {{[^@]+}}@indirect_non_convergent_call
-; CHECK-SAME: (i32 ()* nocapture readonly [[F:%.*]]) #[[ATTR2:[0-9]+]] {
+; CHECK-SAME: (ptr nocapture readonly [[F:%.*]]) #[[ATTR2:[0-9]+]] {
; CHECK-NEXT: [[A:%.*]] = call i32 [[F]]()
; CHECK-NEXT: ret i32 [[A]]
;
diff --git a/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll b/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
index 24d05684668a..073fb97c8da2 100644
--- a/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
+++ b/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
@@ -5,24 +5,24 @@
; function attributes when we derive readnone.
; Function Attrs: argmemonly
-define i32* @given_argmem_infer_readnone(i32* %p) #0 {
-; CHECK: define i32* @given_argmem_infer_readnone(i32* readnone returned %p) #0 {
+define ptr @given_argmem_infer_readnone(ptr %p) #0 {
+; CHECK: define ptr @given_argmem_infer_readnone(ptr readnone returned %p) #0 {
entry:
- ret i32* %p
+ ret ptr %p
}
; Function Attrs: inaccessiblememonly
-define i32* @given_inaccessible_infer_readnone(i32* %p) #1 {
-; CHECK: define i32* @given_inaccessible_infer_readnone(i32* readnone returned %p) #0 {
+define ptr @given_inaccessible_infer_readnone(ptr %p) #1 {
+; CHECK: define ptr @given_inaccessible_infer_readnone(ptr readnone returned %p) #0 {
entry:
- ret i32* %p
+ ret ptr %p
}
; Function Attrs: inaccessiblemem_or_argmemonly
-define i32* @given_inaccessible_or_argmem_infer_readnone(i32* %p) #2 {
-; CHECK: define i32* @given_inaccessible_or_argmem_infer_readnone(i32* readnone returned %p) #0 {
+define ptr @given_inaccessible_or_argmem_infer_readnone(ptr %p) #2 {
+; CHECK: define ptr @given_inaccessible_or_argmem_infer_readnone(ptr readnone returned %p) #0 {
entry:
- ret i32* %p
+ ret ptr %p
}
attributes #0 = { argmemonly }
diff --git a/llvm/test/Transforms/FunctionAttrs/invalidate.ll b/llvm/test/Transforms/FunctionAttrs/invalidate.ll
index 34fd6995642a..923b219a83ba 100644
--- a/llvm/test/Transforms/FunctionAttrs/invalidate.ll
+++ b/llvm/test/Transforms/FunctionAttrs/invalidate.ll
@@ -8,7 +8,7 @@
; CHECK: Running pass: PostOrderFunctionAttrsPass on (g)
; CHECK: Running pass: PostOrderFunctionAttrsPass on (h)
-declare i32 @e(i32(i32)*)
+declare i32 @e(ptr)
define i32 @f(i32 %a) {
ret i32 %a
@@ -20,6 +20,6 @@ define i32 @g(i32 %b) {
}
define i32 @h(i32 %b) {
- %c = call i32 @e(i32(i32)* @f)
+ %c = call i32 @e(ptr @f)
ret i32 %c
}
diff --git a/llvm/test/Transforms/FunctionAttrs/naked_functions.ll b/llvm/test/Transforms/FunctionAttrs/naked_functions.ll
index 20df047ce0f4..d8fda4b9023e 100644
--- a/llvm/test/Transforms/FunctionAttrs/naked_functions.ll
+++ b/llvm/test/Transforms/FunctionAttrs/naked_functions.ll
@@ -8,18 +8,18 @@
define i32 @bar() {
entry:
- %call = call i32 @foo(i32* @g)
-; CHECK: %call = call i32 @foo(i32* @g)
+ %call = call i32 @foo(ptr @g)
+; CHECK: %call = call i32 @foo(ptr @g)
ret i32 %call
}
-define internal i32 @foo(i32*) #0 {
+define internal i32 @foo(ptr) #0 {
entry:
%retval = alloca i32, align 4
call void asm sideeffect "ldr r0, [r0] \0Abx lr \0A", ""()
unreachable
}
-; CHECK: define internal i32 @foo(i32* %0)
+; CHECK: define internal i32 @foo(ptr %0)
attributes #0 = { naked }
diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
index ab84a0cece52..53f46603e3c6 100644
--- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
@@ -1,29 +1,29 @@
; RUN: opt -function-attrs -S < %s | FileCheck %s --check-prefixes=FNATTR
; RUN: opt -passes=function-attrs -S < %s | FileCheck %s --check-prefixes=FNATTR
- at g = global i32* null ; <i32**> [#uses=1]
+ at g = global ptr null ; <ptr> [#uses=1]
-; FNATTR: define i32* @c1(i32* readnone returned %q)
-define i32* @c1(i32* %q) {
- ret i32* %q
+; FNATTR: define ptr @c1(ptr readnone returned %q)
+define ptr @c1(ptr %q) {
+ ret ptr %q
}
-; FNATTR: define void @c2(i32* %q)
+; FNATTR: define void @c2(ptr %q)
; It would also be acceptable to mark %q as readnone. Update @c3 too.
-define void @c2(i32* %q) {
- store i32* %q, i32** @g
+define void @c2(ptr %q) {
+ store ptr %q, ptr @g
ret void
}
-; FNATTR: define void @c3(i32* %q)
-define void @c3(i32* %q) {
- call void @c2(i32* %q)
+; FNATTR: define void @c3(ptr %q)
+define void @c3(ptr %q) {
+ call void @c2(ptr %q)
ret void
}
-; FNATTR: define i1 @c4(i32* %q, i32 %bitno)
-define i1 @c4(i32* %q, i32 %bitno) {
- %tmp = ptrtoint i32* %q to i32
+; FNATTR: define i1 @c4(ptr %q, i32 %bitno)
+define i1 @c4(ptr %q, i32 %bitno) {
+ %tmp = ptrtoint ptr %q to i32
%tmp2 = lshr i32 %tmp, %bitno
%bit = trunc i32 %tmp2 to i1
br i1 %bit, label %l1, label %l0
@@ -34,9 +34,9 @@ l1:
}
; c4b is c4 but without the escaping part
-; FNATTR: define i1 @c4b(i32* %q, i32 %bitno)
-define i1 @c4b(i32* %q, i32 %bitno) {
- %tmp = ptrtoint i32* %q to i32
+; FNATTR: define i1 @c4b(ptr %q, i32 %bitno)
+define i1 @c4b(ptr %q, i32 %bitno) {
+ %tmp = ptrtoint ptr %q to i32
%tmp2 = lshr i32 %tmp, %bitno
%bit = trunc i32 %tmp2 to i1
br i1 %bit, label %l1, label %l0
@@ -48,297 +48,292 @@ l1:
@lookup_table = global [2 x i1] [ i1 0, i1 1 ]
-; FNATTR: define i1 @c5(i32* %q, i32 %bitno)
-define i1 @c5(i32* %q, i32 %bitno) {
- %tmp = ptrtoint i32* %q to i32
+; FNATTR: define i1 @c5(ptr %q, i32 %bitno)
+define i1 @c5(ptr %q, i32 %bitno) {
+ %tmp = ptrtoint ptr %q to i32
%tmp2 = lshr i32 %tmp, %bitno
%bit = and i32 %tmp2, 1
; subtle escape mechanism follows
- %lookup = getelementptr [2 x i1], [2 x i1]* @lookup_table, i32 0, i32 %bit
- %val = load i1, i1* %lookup
+ %lookup = getelementptr [2 x i1], ptr @lookup_table, i32 0, i32 %bit
+ %val = load i1, ptr %lookup
ret i1 %val
}
-declare void @throw_if_bit_set(i8*, i8) readonly
+declare void @throw_if_bit_set(ptr, i8) readonly
-; FNATTR: define i1 @c6(i8* readonly %q, i8 %bit)
-define i1 @c6(i8* %q, i8 %bit) personality i32 (...)* @__gxx_personality_v0 {
- invoke void @throw_if_bit_set(i8* %q, i8 %bit)
+; FNATTR: define i1 @c6(ptr readonly %q, i8 %bit)
+define i1 @c6(ptr %q, i8 %bit) personality ptr @__gxx_personality_v0 {
+ invoke void @throw_if_bit_set(ptr %q, i8 %bit)
to label %ret0 unwind label %ret1
ret0:
ret i1 0
ret1:
- %exn = landingpad {i8*, i32}
+ %exn = landingpad {ptr, i32}
cleanup
ret i1 1
}
declare i32 @__gxx_personality_v0(...)
-define i1* @lookup_bit(i32* %q, i32 %bitno) readnone nounwind {
- %tmp = ptrtoint i32* %q to i32
+define ptr @lookup_bit(ptr %q, i32 %bitno) readnone nounwind {
+ %tmp = ptrtoint ptr %q to i32
%tmp2 = lshr i32 %tmp, %bitno
%bit = and i32 %tmp2, 1
- %lookup = getelementptr [2 x i1], [2 x i1]* @lookup_table, i32 0, i32 %bit
- ret i1* %lookup
+ %lookup = getelementptr [2 x i1], ptr @lookup_table, i32 0, i32 %bit
+ ret ptr %lookup
}
-; FNATTR: define i1 @c7(i32* readonly %q, i32 %bitno)
-define i1 @c7(i32* %q, i32 %bitno) {
- %ptr = call i1* @lookup_bit(i32* %q, i32 %bitno)
- %val = load i1, i1* %ptr
+; FNATTR: define i1 @c7(ptr readonly %q, i32 %bitno)
+define i1 @c7(ptr %q, i32 %bitno) {
+ %ptr = call ptr @lookup_bit(ptr %q, i32 %bitno)
+ %val = load i1, ptr %ptr
ret i1 %val
}
-; FNATTR: define i32 @nc1(i32* %q, i32* nocapture %p, i1 %b)
-define i32 @nc1(i32* %q, i32* %p, i1 %b) {
+; FNATTR: define i32 @nc1(ptr %q, ptr nocapture %p, i1 %b)
+define i32 @nc1(ptr %q, ptr %p, i1 %b) {
e:
br label %l
l:
- %x = phi i32* [ %p, %e ]
- %y = phi i32* [ %q, %e ]
- %tmp = bitcast i32* %x to i32* ; <i32*> [#uses=2]
- %tmp2 = select i1 %b, i32* %tmp, i32* %y
- %val = load i32, i32* %tmp2 ; <i32> [#uses=1]
- store i32 0, i32* %tmp
- store i32* %y, i32** @g
+ %x = phi ptr [ %p, %e ]
+ %y = phi ptr [ %q, %e ]
+ %tmp2 = select i1 %b, ptr %x, ptr %y
+ %val = load i32, ptr %tmp2 ; <i32> [#uses=1]
+ store i32 0, ptr %x
+ store ptr %y, ptr @g
ret i32 %val
}
-; FNATTR: define i32 @nc1_addrspace(i32* %q, i32 addrspace(1)* nocapture %p, i1 %b)
-define i32 @nc1_addrspace(i32* %q, i32 addrspace(1)* %p, i1 %b) {
+; FNATTR: define i32 @nc1_addrspace(ptr %q, ptr addrspace(1) nocapture %p, i1 %b)
+define i32 @nc1_addrspace(ptr %q, ptr addrspace(1) %p, i1 %b) {
e:
br label %l
l:
- %x = phi i32 addrspace(1)* [ %p, %e ]
- %y = phi i32* [ %q, %e ]
- %tmp = addrspacecast i32 addrspace(1)* %x to i32* ; <i32*> [#uses=2]
- %tmp2 = select i1 %b, i32* %tmp, i32* %y
- %val = load i32, i32* %tmp2 ; <i32> [#uses=1]
- store i32 0, i32* %tmp
- store i32* %y, i32** @g
+ %x = phi ptr addrspace(1) [ %p, %e ]
+ %y = phi ptr [ %q, %e ]
+ %tmp = addrspacecast ptr addrspace(1) %x to ptr ; <ptr> [#uses=2]
+ %tmp2 = select i1 %b, ptr %tmp, ptr %y
+ %val = load i32, ptr %tmp2 ; <i32> [#uses=1]
+ store i32 0, ptr %tmp
+ store ptr %y, ptr @g
ret i32 %val
}
-; FNATTR: define void @nc2(i32* nocapture %p, i32* %q)
-define void @nc2(i32* %p, i32* %q) {
- %1 = call i32 @nc1(i32* %q, i32* %p, i1 0) ; <i32> [#uses=0]
+; FNATTR: define void @nc2(ptr nocapture %p, ptr %q)
+define void @nc2(ptr %p, ptr %q) {
+ %1 = call i32 @nc1(ptr %q, ptr %p, i1 0) ; <i32> [#uses=0]
ret void
}
-; FNATTR: define void @nc3(void ()* nocapture readonly %p)
-define void @nc3(void ()* %p) {
+; FNATTR: define void @nc3(ptr nocapture readonly %p)
+define void @nc3(ptr %p) {
call void %p()
ret void
}
-declare void @external(i8*) readonly nounwind
-; FNATTR: define void @nc4(i8* nocapture readonly %p)
-define void @nc4(i8* %p) {
- call void @external(i8* %p)
+declare void @external(ptr) readonly nounwind
+; FNATTR: define void @nc4(ptr nocapture readonly %p)
+define void @nc4(ptr %p) {
+ call void @external(ptr %p)
ret void
}
-; FNATTR: define void @nc5(void (i8*)* nocapture readonly %f, i8* nocapture %p)
-define void @nc5(void (i8*)* %f, i8* %p) {
- call void %f(i8* %p) readonly nounwind
- call void %f(i8* nocapture %p)
+; FNATTR: define void @nc5(ptr nocapture readonly %f, ptr nocapture %p)
+define void @nc5(ptr %f, ptr %p) {
+ call void %f(ptr %p) readonly nounwind
+ call void %f(ptr nocapture %p)
ret void
}
-; FNATTR: define void @test1_1(i8* nocapture readnone %x1_1, i8* %y1_1, i1 %c)
+; FNATTR: define void @test1_1(ptr nocapture readnone %x1_1, ptr %y1_1, i1 %c)
; It would be acceptable to add readnone to %y1_1 and %y1_2.
-define void @test1_1(i8* %x1_1, i8* %y1_1, i1 %c) {
- call i8* @test1_2(i8* %x1_1, i8* %y1_1, i1 %c)
- store i32* null, i32** @g
+define void @test1_1(ptr %x1_1, ptr %y1_1, i1 %c) {
+ call ptr @test1_2(ptr %x1_1, ptr %y1_1, i1 %c)
+ store ptr null, ptr @g
ret void
}
-; FNATTR: define i8* @test1_2(i8* nocapture readnone %x1_2, i8* returned %y1_2, i1 %c)
-define i8* @test1_2(i8* %x1_2, i8* %y1_2, i1 %c) {
+; FNATTR: define ptr @test1_2(ptr nocapture readnone %x1_2, ptr returned %y1_2, i1 %c)
+define ptr @test1_2(ptr %x1_2, ptr %y1_2, i1 %c) {
br i1 %c, label %t, label %f
t:
- call void @test1_1(i8* %x1_2, i8* %y1_2, i1 %c)
- store i32* null, i32** @g
+ call void @test1_1(ptr %x1_2, ptr %y1_2, i1 %c)
+ store ptr null, ptr @g
br label %f
f:
- ret i8* %y1_2
+ ret ptr %y1_2
}
-; FNATTR: define void @test2(i8* nocapture readnone %x2)
-define void @test2(i8* %x2) {
- call void @test2(i8* %x2)
- store i32* null, i32** @g
+; FNATTR: define void @test2(ptr nocapture readnone %x2)
+define void @test2(ptr %x2) {
+ call void @test2(ptr %x2)
+ store ptr null, ptr @g
ret void
}
-; FNATTR: define void @test3(i8* nocapture readnone %x3, i8* nocapture readnone %y3, i8* nocapture readnone %z3)
-define void @test3(i8* %x3, i8* %y3, i8* %z3) {
- call void @test3(i8* %z3, i8* %y3, i8* %x3)
- store i32* null, i32** @g
+; FNATTR: define void @test3(ptr nocapture readnone %x3, ptr nocapture readnone %y3, ptr nocapture readnone %z3)
+define void @test3(ptr %x3, ptr %y3, ptr %z3) {
+ call void @test3(ptr %z3, ptr %y3, ptr %x3)
+ store ptr null, ptr @g
ret void
}
-; FNATTR: define void @test4_1(i8* %x4_1, i1 %c)
-define void @test4_1(i8* %x4_1, i1 %c) {
- call i8* @test4_2(i8* %x4_1, i8* %x4_1, i8* %x4_1, i1 %c)
- store i32* null, i32** @g
+; FNATTR: define void @test4_1(ptr %x4_1, i1 %c)
+define void @test4_1(ptr %x4_1, i1 %c) {
+ call ptr @test4_2(ptr %x4_1, ptr %x4_1, ptr %x4_1, i1 %c)
+ store ptr null, ptr @g
ret void
}
-; FNATTR: define i8* @test4_2(i8* nocapture readnone %x4_2, i8* readnone returned %y4_2, i8* nocapture readnone %z4_2, i1 %c)
-define i8* @test4_2(i8* %x4_2, i8* %y4_2, i8* %z4_2, i1 %c) {
+; FNATTR: define ptr @test4_2(ptr nocapture readnone %x4_2, ptr readnone returned %y4_2, ptr nocapture readnone %z4_2, i1 %c)
+define ptr @test4_2(ptr %x4_2, ptr %y4_2, ptr %z4_2, i1 %c) {
br i1 %c, label %t, label %f
t:
- call void @test4_1(i8* null, i1 %c)
- store i32* null, i32** @g
+ call void @test4_1(ptr null, i1 %c)
+ store ptr null, ptr @g
br label %f
f:
- ret i8* %y4_2
+ ret ptr %y4_2
}
-declare i8* @test5_1(i8* %x5_1)
+declare ptr @test5_1(ptr %x5_1)
-; FNATTR: define void @test5_2(i8* %x5_2)
-define void @test5_2(i8* %x5_2) {
- call i8* @test5_1(i8* %x5_2)
- store i32* null, i32** @g
+; FNATTR: define void @test5_2(ptr %x5_2)
+define void @test5_2(ptr %x5_2) {
+ call ptr @test5_1(ptr %x5_2)
+ store ptr null, ptr @g
ret void
}
-declare void @test6_1(i8* %x6_1, i8* nocapture %y6_1, ...)
+declare void @test6_1(ptr %x6_1, ptr nocapture %y6_1, ...)
-; FNATTR: define void @test6_2(i8* %x6_2, i8* nocapture %y6_2, i8* %z6_2)
-define void @test6_2(i8* %x6_2, i8* %y6_2, i8* %z6_2) {
- call void (i8*, i8*, ...) @test6_1(i8* %x6_2, i8* %y6_2, i8* %z6_2)
- store i32* null, i32** @g
+; FNATTR: define void @test6_2(ptr %x6_2, ptr nocapture %y6_2, ptr %z6_2)
+define void @test6_2(ptr %x6_2, ptr %y6_2, ptr %z6_2) {
+ call void (ptr, ptr, ...) @test6_1(ptr %x6_2, ptr %y6_2, ptr %z6_2)
+ store ptr null, ptr @g
ret void
}
-; FNATTR: define void @test_cmpxchg(i32* nocapture %p)
-define void @test_cmpxchg(i32* %p) {
- cmpxchg i32* %p, i32 0, i32 1 acquire monotonic
+; FNATTR: define void @test_cmpxchg(ptr nocapture %p)
+define void @test_cmpxchg(ptr %p) {
+ cmpxchg ptr %p, i32 0, i32 1 acquire monotonic
ret void
}
-; FNATTR: define void @test_cmpxchg_ptr(i32** nocapture %p, i32* %q)
-define void @test_cmpxchg_ptr(i32** %p, i32* %q) {
- cmpxchg i32** %p, i32* null, i32* %q acquire monotonic
+; FNATTR: define void @test_cmpxchg_ptr(ptr nocapture %p, ptr %q)
+define void @test_cmpxchg_ptr(ptr %p, ptr %q) {
+ cmpxchg ptr %p, ptr null, ptr %q acquire monotonic
ret void
}
-; FNATTR: define void @test_atomicrmw(i32* nocapture %p)
-define void @test_atomicrmw(i32* %p) {
- atomicrmw add i32* %p, i32 1 seq_cst
+; FNATTR: define void @test_atomicrmw(ptr nocapture %p)
+define void @test_atomicrmw(ptr %p) {
+ atomicrmw add ptr %p, i32 1 seq_cst
ret void
}
-; FNATTR: define void @test_volatile(i32* %x)
-define void @test_volatile(i32* %x) {
+; FNATTR: define void @test_volatile(ptr %x)
+define void @test_volatile(ptr %x) {
entry:
- %gep = getelementptr i32, i32* %x, i64 1
- store volatile i32 0, i32* %gep, align 4
+ %gep = getelementptr i32, ptr %x, i64 1
+ store volatile i32 0, ptr %gep, align 4
ret void
}
-; FNATTR: nocaptureLaunder(i8* nocapture %p)
-define void @nocaptureLaunder(i8* %p) {
+; FNATTR: nocaptureLaunder(ptr nocapture %p)
+define void @nocaptureLaunder(ptr %p) {
entry:
- %b = call i8* @llvm.launder.invariant.group.p0i8(i8* %p)
- store i8 42, i8* %b
+ %b = call ptr @llvm.launder.invariant.group.p0(ptr %p)
+ store i8 42, ptr %b
ret void
}
- at g2 = global i8* null
-; FNATTR: define void @captureLaunder(i8* %p)
-define void @captureLaunder(i8* %p) {
- %b = call i8* @llvm.launder.invariant.group.p0i8(i8* %p)
- store i8* %b, i8** @g2
+ at g2 = global ptr null
+; FNATTR: define void @captureLaunder(ptr %p)
+define void @captureLaunder(ptr %p) {
+ %b = call ptr @llvm.launder.invariant.group.p0(ptr %p)
+ store ptr %b, ptr @g2
ret void
}
-; FNATTR: @nocaptureStrip(i8* nocapture writeonly %p)
-define void @nocaptureStrip(i8* %p) {
+; FNATTR: @nocaptureStrip(ptr nocapture writeonly %p)
+define void @nocaptureStrip(ptr %p) {
entry:
- %b = call i8* @llvm.strip.invariant.group.p0i8(i8* %p)
- store i8 42, i8* %b
+ %b = call ptr @llvm.strip.invariant.group.p0(ptr %p)
+ store i8 42, ptr %b
ret void
}
- at g3 = global i8* null
-; FNATTR: define void @captureStrip(i8* %p)
-define void @captureStrip(i8* %p) {
- %b = call i8* @llvm.strip.invariant.group.p0i8(i8* %p)
- store i8* %b, i8** @g3
+ at g3 = global ptr null
+; FNATTR: define void @captureStrip(ptr %p)
+define void @captureStrip(ptr %p) {
+ %b = call ptr @llvm.strip.invariant.group.p0(ptr %p)
+ store ptr %b, ptr @g3
ret void
}
-; FNATTR: define i1 @captureICmp(i32* readnone %x)
-define i1 @captureICmp(i32* %x) {
- %1 = icmp eq i32* %x, null
+; FNATTR: define i1 @captureICmp(ptr readnone %x)
+define i1 @captureICmp(ptr %x) {
+ %1 = icmp eq ptr %x, null
ret i1 %1
}
-; FNATTR: define i1 @captureICmpRev(i32* readnone %x)
-define i1 @captureICmpRev(i32* %x) {
- %1 = icmp eq i32* null, %x
+; FNATTR: define i1 @captureICmpRev(ptr readnone %x)
+define i1 @captureICmpRev(ptr %x) {
+ %1 = icmp eq ptr null, %x
ret i1 %1
}
-; FNATTR: define i1 @nocaptureInboundsGEPICmp(i32* nocapture readnone %x)
-define i1 @nocaptureInboundsGEPICmp(i32* %x) {
- %1 = getelementptr inbounds i32, i32* %x, i32 5
- %2 = bitcast i32* %1 to i8*
- %3 = icmp eq i8* %2, null
- ret i1 %3
+; FNATTR: define i1 @nocaptureInboundsGEPICmp(ptr nocapture readnone %x)
+define i1 @nocaptureInboundsGEPICmp(ptr %x) {
+ %1 = getelementptr inbounds i32, ptr %x, i32 5
+ %2 = icmp eq ptr %1, null
+ ret i1 %2
}
-; FNATTR: define i1 @nocaptureInboundsGEPICmpRev(i32* nocapture readnone %x)
-define i1 @nocaptureInboundsGEPICmpRev(i32* %x) {
- %1 = getelementptr inbounds i32, i32* %x, i32 5
- %2 = bitcast i32* %1 to i8*
- %3 = icmp eq i8* null, %2
- ret i1 %3
+; FNATTR: define i1 @nocaptureInboundsGEPICmpRev(ptr nocapture readnone %x)
+define i1 @nocaptureInboundsGEPICmpRev(ptr %x) {
+ %1 = getelementptr inbounds i32, ptr %x, i32 5
+ %2 = icmp eq ptr null, %1
+ ret i1 %2
}
-; FNATTR: define i1 @nocaptureDereferenceableOrNullICmp(i32* nocapture readnone dereferenceable_or_null(4) %x)
-define i1 @nocaptureDereferenceableOrNullICmp(i32* dereferenceable_or_null(4) %x) {
- %1 = bitcast i32* %x to i8*
- %2 = icmp eq i8* %1, null
- ret i1 %2
+; FNATTR: define i1 @nocaptureDereferenceableOrNullICmp(ptr nocapture readnone dereferenceable_or_null(4) %x)
+define i1 @nocaptureDereferenceableOrNullICmp(ptr dereferenceable_or_null(4) %x) {
+ %1 = icmp eq ptr %x, null
+ ret i1 %1
}
-; FNATTR: define i1 @captureDereferenceableOrNullICmp(i32* readnone dereferenceable_or_null(4) %x)
-define i1 @captureDereferenceableOrNullICmp(i32* dereferenceable_or_null(4) %x) null_pointer_is_valid {
- %1 = bitcast i32* %x to i8*
- %2 = icmp eq i8* %1, null
- ret i1 %2
+; FNATTR: define i1 @captureDereferenceableOrNullICmp(ptr readnone dereferenceable_or_null(4) %x)
+define i1 @captureDereferenceableOrNullICmp(ptr dereferenceable_or_null(4) %x) null_pointer_is_valid {
+ %1 = icmp eq ptr %x, null
+ ret i1 %1
}
-declare void @capture(i8*)
+declare void @capture(ptr)
-; FNATTR: define void @nocapture_fptr(i8* (i8*)* nocapture readonly %f, i8* %p)
-define void @nocapture_fptr(i8* (i8*)* %f, i8* %p) {
- %res = call i8* %f(i8* %p)
- call void @capture(i8* %res)
+; FNATTR: define void @nocapture_fptr(ptr nocapture readonly %f, ptr %p)
+define void @nocapture_fptr(ptr %f, ptr %p) {
+ %res = call ptr %f(ptr %p)
+ call void @capture(ptr %res)
ret void
}
-; FNATTR: define void @recurse_fptr(i8* (i8*)* nocapture readonly %f, i8* %p)
-define void @recurse_fptr(i8* (i8*)* %f, i8* %p) {
- %res = call i8* %f(i8* %p)
- store i8 0, i8* %res
+; FNATTR: define void @recurse_fptr(ptr nocapture readonly %f, ptr %p)
+define void @recurse_fptr(ptr %f, ptr %p) {
+ %res = call ptr %f(ptr %p)
+ store i8 0, ptr %res
ret void
}
-; FNATTR: define void @readnone_indirec(void (i8*)* nocapture readonly %f, i8* readnone %p)
-define void @readnone_indirec(void (i8*)* %f, i8* %p) {
- call void %f(i8* %p) readnone
+; FNATTR: define void @readnone_indirec(ptr nocapture readonly %f, ptr readnone %p)
+define void @readnone_indirec(ptr %f, ptr %p) {
+ call void %f(ptr %p) readnone
ret void
}
-declare i8* @llvm.launder.invariant.group.p0i8(i8*)
-declare i8* @llvm.strip.invariant.group.p0i8(i8*)
+declare ptr @llvm.launder.invariant.group.p0(ptr)
+declare ptr @llvm.strip.invariant.group.p0(ptr)
diff --git a/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll b/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
index a824a409b3ef..81064c2f3488 100644
--- a/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
@@ -7,9 +7,9 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; We use FIXME's to indicate problems and missing attributes.
; Free functions
-declare void @free(i8* nocapture) local_unnamed_addr #1
-declare noalias i8* @realloc(i8* nocapture, i64) local_unnamed_addr #0
-declare void @_ZdaPv(i8*) local_unnamed_addr #2
+declare void @free(ptr nocapture) local_unnamed_addr #1
+declare noalias ptr @realloc(ptr nocapture, i64) local_unnamed_addr #0
+declare void @_ZdaPv(ptr) local_unnamed_addr #2
; TEST 1 (positive case)
@@ -29,14 +29,14 @@ define void @only_return() #0 {
; free(p);
; }
-define void @only_free(i8* nocapture %0) local_unnamed_addr #0 {
+define void @only_free(ptr nocapture %0) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-LABEL: define {{[^@]+}}@only_free
-; FNATTR-SAME: (i8* nocapture [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
-; FNATTR-NEXT: tail call void @free(i8* [[TMP0]]) #[[ATTR0:[0-9]+]]
+; FNATTR-SAME: (ptr nocapture [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; FNATTR-NEXT: tail call void @free(ptr [[TMP0]]) #[[ATTR0:[0-9]+]]
; FNATTR-NEXT: ret void
;
- tail call void @free(i8* %0) #1
+ tail call void @free(ptr %0) #1
ret void
}
@@ -51,39 +51,39 @@ define void @only_free(i8* nocapture %0) local_unnamed_addr #0 {
; free(p);
; }
-define void @free_in_scc1(i8* nocapture %0) local_unnamed_addr #0 {
+define void @free_in_scc1(ptr nocapture %0) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-LABEL: define {{[^@]+}}@free_in_scc1
-; FNATTR-SAME: (i8* nocapture [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
-; FNATTR-NEXT: tail call void @free_in_scc2(i8* [[TMP0]]) #[[ATTR0]]
+; FNATTR-SAME: (ptr nocapture [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
+; FNATTR-NEXT: tail call void @free_in_scc2(ptr [[TMP0]]) #[[ATTR0]]
; FNATTR-NEXT: ret void
;
- tail call void @free_in_scc2(i8* %0) #1
+ tail call void @free_in_scc2(ptr %0) #1
ret void
}
-define void @free_in_scc2(i8* nocapture %0) local_unnamed_addr #0 {
+define void @free_in_scc2(ptr nocapture %0) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-LABEL: define {{[^@]+}}@free_in_scc2
-; FNATTR-SAME: (i8* nocapture [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
-; FNATTR-NEXT: [[CMP:%.*]] = icmp eq i8* [[TMP0]], null
+; FNATTR-SAME: (ptr nocapture [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
+; FNATTR-NEXT: [[CMP:%.*]] = icmp eq ptr [[TMP0]], null
; FNATTR-NEXT: br i1 [[CMP]], label [[REC:%.*]], label [[CALL:%.*]]
; FNATTR: call:
-; FNATTR-NEXT: tail call void @free(i8* [[TMP0]]) #[[ATTR0]]
+; FNATTR-NEXT: tail call void @free(ptr [[TMP0]]) #[[ATTR0]]
; FNATTR-NEXT: br label [[END:%.*]]
; FNATTR: rec:
-; FNATTR-NEXT: tail call void @free_in_scc1(i8* [[TMP0]])
+; FNATTR-NEXT: tail call void @free_in_scc1(ptr [[TMP0]])
; FNATTR-NEXT: br label [[END]]
; FNATTR: end:
; FNATTR-NEXT: ret void
;
- %cmp = icmp eq i8* %0, null
+ %cmp = icmp eq ptr %0, null
br i1 %cmp, label %rec, label %call
call:
- tail call void @free(i8* %0) #1
+ tail call void @free(ptr %0) #1
br label %end
rec:
- tail call void @free_in_scc1(i8* %0)
+ tail call void @free_in_scc1(ptr %0)
br label %end
end:
ret void
@@ -129,23 +129,23 @@ define void @mutual_recursion2() #0 {
; delete [] p;
; }
-define void @_Z9delete_opPc(i8* %0) local_unnamed_addr #0 {
+define void @_Z9delete_opPc(ptr %0) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-LABEL: define {{[^@]+}}@_Z9delete_opPc
-; FNATTR-SAME: (i8* [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
-; FNATTR-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
+; FNATTR-SAME: (ptr [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
+; FNATTR-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
; FNATTR-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
; FNATTR: 3:
-; FNATTR-NEXT: tail call void @_ZdaPv(i8* nonnull [[TMP0]]) #[[ATTR2:[0-9]+]]
+; FNATTR-NEXT: tail call void @_ZdaPv(ptr nonnull [[TMP0]]) #[[ATTR2:[0-9]+]]
; FNATTR-NEXT: br label [[TMP4]]
; FNATTR: 4:
; FNATTR-NEXT: ret void
;
- %2 = icmp eq i8* %0, null
+ %2 = icmp eq ptr %0, null
br i1 %2, label %4, label %3
; <label>:3: ; preds = %1
- tail call void @_ZdaPv(i8* nonnull %0) #2
+ tail call void @_ZdaPv(ptr nonnull %0) #2
br label %4
; <label>:4: ; preds = %3, %1
@@ -155,15 +155,15 @@ define void @_Z9delete_opPc(i8* %0) local_unnamed_addr #0 {
; TEST 6 (negative case)
; Call realloc
-define noalias i8* @call_realloc(i8* nocapture %0, i64 %1) local_unnamed_addr #0 {
+define noalias ptr @call_realloc(ptr nocapture %0, i64 %1) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-LABEL: define {{[^@]+}}@call_realloc
-; FNATTR-SAME: (i8* nocapture [[TMP0:%.*]], i64 [[TMP1:%.*]]) local_unnamed_addr #[[ATTR1]] {
-; FNATTR-NEXT: [[RET:%.*]] = tail call i8* @realloc(i8* [[TMP0]], i64 [[TMP1]]) #[[ATTR2]]
-; FNATTR-NEXT: ret i8* [[RET]]
+; FNATTR-SAME: (ptr nocapture [[TMP0:%.*]], i64 [[TMP1:%.*]]) local_unnamed_addr #[[ATTR1]] {
+; FNATTR-NEXT: [[RET:%.*]] = tail call ptr @realloc(ptr [[TMP0]], i64 [[TMP1]]) #[[ATTR2]]
+; FNATTR-NEXT: ret ptr [[RET]]
;
- %ret = tail call i8* @realloc(i8* %0, i64 %1) #2
- ret i8* %ret
+ %ret = tail call ptr @realloc(ptr %0, i64 %1) #2
+ ret ptr %ret
}
@@ -261,7 +261,7 @@ define void @f2() #0 {
}
-declare noalias i8* @malloc(i64)
+declare noalias ptr @malloc(i64)
attributes #0 = { nounwind uwtable noinline }
attributes #1 = { nounwind }
diff --git a/llvm/test/Transforms/FunctionAttrs/nofree.ll b/llvm/test/Transforms/FunctionAttrs/nofree.ll
index 852404697326..020d6d23af0a 100644
--- a/llvm/test/Transforms/FunctionAttrs/nofree.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nofree.ll
@@ -5,7 +5,7 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define void @_Z4foo1Pi(i32* nocapture readnone %a) local_unnamed_addr #0 {
+define void @_Z4foo1Pi(ptr nocapture readnone %a) local_unnamed_addr #0 {
; CHECK: Function Attrs: uwtable
; CHECK-LABEL: @_Z4foo1Pi(
; CHECK-NEXT: entry:
@@ -19,136 +19,124 @@ entry:
declare void @_Z3extv() local_unnamed_addr
-define void @_Z4foo2Pi(i32* nocapture %a) local_unnamed_addr #1 {
+define void @_Z4foo2Pi(ptr nocapture %a) local_unnamed_addr #1 {
; CHECK: Function Attrs: nounwind uwtable
; CHECK-LABEL: @_Z4foo2Pi(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[A:%.*]] to i8*
-; CHECK-NEXT: tail call void @free(i8* [[TMP0]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: tail call void @free(ptr [[A:%.*]]) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: ret void
;
entry:
- %0 = bitcast i32* %a to i8*
- tail call void @free(i8* %0) #2
+ tail call void @free(ptr %a) #2
ret void
}
-declare void @free(i8* nocapture) local_unnamed_addr #2
+declare void @free(ptr nocapture) local_unnamed_addr #2
-define i32 @_Z4foo3Pi(i32* nocapture readonly %a) local_unnamed_addr #3 {
+define i32 @_Z4foo3Pi(ptr nocapture readonly %a) local_unnamed_addr #3 {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn uwtable
; CHECK-LABEL: @_Z4foo3Pi(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[A:%.*]], align 4
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 4
; CHECK-NEXT: ret i32 [[TMP0]]
;
entry:
- %0 = load i32, i32* %a, align 4
+ %0 = load i32, ptr %a, align 4
ret i32 %0
}
-define double @_Z4foo4Pd(double* nocapture readonly %a) local_unnamed_addr #1 {
+define double @_Z4foo4Pd(ptr nocapture readonly %a) local_unnamed_addr #1 {
; CHECK: Function Attrs: nounwind uwtable
; CHECK-LABEL: @_Z4foo4Pd(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = load double, double* [[A:%.*]], align 8
+; CHECK-NEXT: [[TMP0:%.*]] = load double, ptr [[A:%.*]], align 8
; CHECK-NEXT: [[CALL:%.*]] = tail call double @cos(double [[TMP0]]) #[[ATTR2]]
; CHECK-NEXT: ret double [[CALL]]
;
entry:
- %0 = load double, double* %a, align 8
+ %0 = load double, ptr %a, align 8
%call = tail call double @cos(double %0) #2
ret double %call
}
declare double @cos(double) local_unnamed_addr #2
-define noalias i32* @_Z4foo5Pm(i64* nocapture readonly %a) local_unnamed_addr #1 {
+define noalias ptr @_Z4foo5Pm(ptr nocapture readonly %a) local_unnamed_addr #1 {
; CHECK: Function Attrs: nounwind uwtable
; CHECK-LABEL: @_Z4foo5Pm(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[A:%.*]], align 8
-; CHECK-NEXT: [[CALL:%.*]] = tail call noalias i8* @malloc(i64 [[TMP0]]) #[[ATTR2]]
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[CALL]] to i32*
-; CHECK-NEXT: ret i32* [[TMP1]]
+; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[A:%.*]], align 8
+; CHECK-NEXT: [[CALL:%.*]] = tail call noalias ptr @malloc(i64 [[TMP0]]) #[[ATTR2]]
+; CHECK-NEXT: ret ptr [[CALL]]
;
entry:
- %0 = load i64, i64* %a, align 8
- %call = tail call noalias i8* @malloc(i64 %0) #2
- %1 = bitcast i8* %call to i32*
- ret i32* %1
+ %0 = load i64, ptr %a, align 8
+ %call = tail call noalias ptr @malloc(i64 %0) #2
+ ret ptr %call
}
-declare noalias i8* @malloc(i64) local_unnamed_addr #2
+declare noalias ptr @malloc(i64) local_unnamed_addr #2
-define noalias i64* @_Z4foo6Pm(i64* nocapture %a) local_unnamed_addr #1 {
+define noalias ptr @_Z4foo6Pm(ptr nocapture %a) local_unnamed_addr #1 {
; CHECK: Function Attrs: nounwind uwtable
; CHECK-LABEL: @_Z4foo6Pm(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64* [[A:%.*]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = load i64, i64* [[A]], align 8
-; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @realloc(i8* [[TMP0]], i64 [[TMP1]]) #[[ATTR2]]
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[CALL]] to i64*
-; CHECK-NEXT: ret i64* [[TMP2]]
+; CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr [[A:%.*]], align 8
+; CHECK-NEXT: [[CALL:%.*]] = tail call ptr @realloc(ptr [[A]], i64 [[TMP1]]) #[[ATTR2]]
+; CHECK-NEXT: ret ptr [[CALL]]
;
entry:
- %0 = bitcast i64* %a to i8*
- %1 = load i64, i64* %a, align 8
- %call = tail call i8* @realloc(i8* %0, i64 %1) #2
- %2 = bitcast i8* %call to i64*
- ret i64* %2
+ %0 = load i64, ptr %a, align 8
+ %call = tail call ptr @realloc(ptr %a, i64 %0) #2
+ ret ptr %call
}
-declare noalias i8* @realloc(i8* nocapture, i64) local_unnamed_addr #2
+declare noalias ptr @realloc(ptr nocapture, i64) local_unnamed_addr #2
-define void @_Z4foo7Pi(i32* %a) local_unnamed_addr #1 {
+define void @_Z4foo7Pi(ptr %a) local_unnamed_addr #1 {
; CHECK: Function Attrs: nounwind uwtable
; CHECK-LABEL: @_Z4foo7Pi(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ISNULL:%.*]] = icmp eq i32* [[A:%.*]], null
+; CHECK-NEXT: [[ISNULL:%.*]] = icmp eq ptr [[A:%.*]], null
; CHECK-NEXT: br i1 [[ISNULL]], label [[DELETE_END:%.*]], label [[DELETE_NOTNULL:%.*]]
; CHECK: delete.notnull:
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[A]] to i8*
-; CHECK-NEXT: tail call void @_ZdlPv(i8* [[TMP0]]) #[[ATTR6:[0-9]+]]
+; CHECK-NEXT: tail call void @_ZdlPv(ptr [[A]]) #[[ATTR6:[0-9]+]]
; CHECK-NEXT: br label [[DELETE_END]]
; CHECK: delete.end:
; CHECK-NEXT: ret void
;
entry:
- %isnull = icmp eq i32* %a, null
+ %isnull = icmp eq ptr %a, null
br i1 %isnull, label %delete.end, label %delete.notnull
delete.notnull: ; preds = %entry
- %0 = bitcast i32* %a to i8*
- tail call void @_ZdlPv(i8* %0) #5
+ tail call void @_ZdlPv(ptr %a) #5
br label %delete.end
delete.end: ; preds = %delete.notnull, %entry
ret void
}
-declare void @_ZdlPv(i8*) local_unnamed_addr #4
+declare void @_ZdlPv(ptr) local_unnamed_addr #4
-define void @_Z4foo8Pi(i32* %a) local_unnamed_addr #1 {
+define void @_Z4foo8Pi(ptr %a) local_unnamed_addr #1 {
; CHECK: Function Attrs: nounwind uwtable
; CHECK-LABEL: @_Z4foo8Pi(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ISNULL:%.*]] = icmp eq i32* [[A:%.*]], null
+; CHECK-NEXT: [[ISNULL:%.*]] = icmp eq ptr [[A:%.*]], null
; CHECK-NEXT: br i1 [[ISNULL]], label [[DELETE_END:%.*]], label [[DELETE_NOTNULL:%.*]]
; CHECK: delete.notnull:
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[A]] to i8*
-; CHECK-NEXT: tail call void @_ZdaPv(i8* [[TMP0]]) #[[ATTR6]]
+; CHECK-NEXT: tail call void @_ZdaPv(ptr [[A]]) #[[ATTR6]]
; CHECK-NEXT: br label [[DELETE_END]]
; CHECK: delete.end:
; CHECK-NEXT: ret void
;
entry:
- %isnull = icmp eq i32* %a, null
+ %isnull = icmp eq ptr %a, null
br i1 %isnull, label %delete.end, label %delete.notnull
delete.notnull: ; preds = %entry
- %0 = bitcast i32* %a to i8*
- tail call void @_ZdaPv(i8* %0) #5
+ tail call void @_ZdaPv(ptr %a) #5
br label %delete.end
delete.end: ; preds = %delete.notnull, %entry
@@ -157,7 +145,7 @@ delete.end: ; preds = %delete.notnull, %en
declare void @may_free()
-define void @nofree_callsite_attr(i32* %a) {
+define void @nofree_callsite_attr(ptr %a) {
; CHECK: Function Attrs: nofree
; CHECK-LABEL: @nofree_callsite_attr(
; CHECK-NEXT: entry:
@@ -169,7 +157,7 @@ entry:
ret void
}
-declare void @_ZdaPv(i8*) local_unnamed_addr #4
+declare void @_ZdaPv(ptr) local_unnamed_addr #4
attributes #0 = { uwtable }
attributes #1 = { nounwind uwtable }
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll b/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll
index e0c8ae465935..90a6d65a5574 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll
@@ -4,8 +4,8 @@
@a = external global i8, !absolute_symbol !0
; CHECK-NOT: define nonnull
-define i8* @foo() {
- ret i8* @a
+define ptr @foo() {
+ ret ptr @a
}
!0 = !{i64 0, i64 256}
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index ae5245e4735b..a6564fadd171 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -4,166 +4,165 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-declare nonnull i8* @ret_nonnull()
+declare nonnull ptr @ret_nonnull()
; Return a pointer trivially nonnull (call return attribute)
-define i8* @test1() {
-; FNATTR: define nonnull i8* @test1
- %ret = call i8* @ret_nonnull()
- ret i8* %ret
+define ptr @test1() {
+; FNATTR: define nonnull ptr @test1
+ %ret = call ptr @ret_nonnull()
+ ret ptr %ret
}
; Return a pointer trivially nonnull (argument attribute)
-define i8* @test2(i8* nonnull %p) {
-; FNATTR: define nonnull i8* @test2
- ret i8* %p
+define ptr @test2(ptr nonnull %p) {
+; FNATTR: define nonnull ptr @test2
+ ret ptr %p
}
; Given an SCC where one of the functions can not be marked nonnull,
; can we still mark the other one which is trivially nonnull
-define i8* @scc_binder(i1 %c) {
-; FNATTR: define i8* @scc_binder
+define ptr @scc_binder(i1 %c) {
+; FNATTR: define ptr @scc_binder
br i1 %c, label %rec, label %end
rec:
- call i8* @test3(i1 %c)
+ call ptr @test3(i1 %c)
br label %end
end:
- ret i8* null
+ ret ptr null
}
-define i8* @test3(i1 %c) {
-; FNATTR: define nonnull i8* @test3
- call i8* @scc_binder(i1 %c)
- %ret = call i8* @ret_nonnull()
- ret i8* %ret
+define ptr @test3(i1 %c) {
+; FNATTR: define nonnull ptr @test3
+ call ptr @scc_binder(i1 %c)
+ %ret = call ptr @ret_nonnull()
+ ret ptr %ret
}
; Given a mutual recursive set of functions, we can mark them
; nonnull if neither can ever return null. (In this case, they
; just never return period.)
-define i8* @test4_helper() {
-; FNATTR: define noalias nonnull i8* @test4_helper
- %ret = call i8* @test4()
- ret i8* %ret
+define ptr @test4_helper() {
+; FNATTR: define noalias nonnull ptr @test4_helper
+ %ret = call ptr @test4()
+ ret ptr %ret
}
-define i8* @test4() {
-; FNATTR: define noalias nonnull i8* @test4
- %ret = call i8* @test4_helper()
- ret i8* %ret
+define ptr @test4() {
+; FNATTR: define noalias nonnull ptr @test4
+ %ret = call ptr @test4_helper()
+ ret ptr %ret
}
; Given a mutual recursive set of functions which *can* return null
; make sure we haven't marked them as nonnull.
-define i8* @test5_helper(i1 %c) {
-; FNATTR: define noalias i8* @test5_helper
+define ptr @test5_helper(i1 %c) {
+; FNATTR: define noalias ptr @test5_helper
br i1 %c, label %rec, label %end
rec:
- %ret = call i8* @test5(i1 %c)
+ %ret = call ptr @test5(i1 %c)
br label %end
end:
- ret i8* null
+ ret ptr null
}
-define i8* @test5(i1 %c) {
-; FNATTR: define noalias i8* @test5
- %ret = call i8* @test5_helper(i1 %c)
- ret i8* %ret
+define ptr @test5(i1 %c) {
+; FNATTR: define noalias ptr @test5
+ %ret = call ptr @test5_helper(i1 %c)
+ ret ptr %ret
}
; Local analysis, but going through a self recursive phi
-define i8* @test6a() {
+define ptr @test6a() {
entry:
- %ret = call i8* @ret_nonnull()
+ %ret = call ptr @ret_nonnull()
br label %loop
loop:
- %phi = phi i8* [%ret, %entry], [%phi, %loop]
+ %phi = phi ptr [%ret, %entry], [%phi, %loop]
br i1 undef, label %loop, label %exit
exit:
- ret i8* %phi
+ ret ptr %phi
}
-define i8* @test6b(i1 %c) {
+define ptr @test6b(i1 %c) {
entry:
- %ret = call i8* @ret_nonnull()
+ %ret = call ptr @ret_nonnull()
br label %loop
loop:
- %phi = phi i8* [%ret, %entry], [%phi, %loop]
+ %phi = phi ptr [%ret, %entry], [%phi, %loop]
br i1 %c, label %loop, label %exit
exit:
- ret i8* %phi
+ ret ptr %phi
}
-; FNATTR: define i8* @test7
-define i8* @test7(i8* %a) {
- %b = getelementptr inbounds i8, i8* %a, i64 0
- ret i8* %b
+; FNATTR: define ptr @test7
+define ptr @test7(ptr %a) {
+ ret ptr %a
}
-; FNATTR: define nonnull i8* @test8
-define i8* @test8(i8* %a) {
- %b = getelementptr inbounds i8, i8* %a, i64 1
- ret i8* %b
+; FNATTR: define nonnull ptr @test8
+define ptr @test8(ptr %a) {
+ %b = getelementptr inbounds i8, ptr %a, i64 1
+ ret ptr %b
}
-; FNATTR: define i8* @test9
-define i8* @test9(i8* %a, i64 %n) {
- %b = getelementptr inbounds i8, i8* %a, i64 %n
- ret i8* %b
+; FNATTR: define ptr @test9
+define ptr @test9(ptr %a, i64 %n) {
+ %b = getelementptr inbounds i8, ptr %a, i64 %n
+ ret ptr %b
}
declare void @llvm.assume(i1)
-; FNATTR: define i8* @test10
+; FNATTR: define ptr @test10
; FIXME: missing nonnull
-define i8* @test10(i8* %a, i64 %n) {
+define ptr @test10(ptr %a, i64 %n) {
%cmp = icmp ne i64 %n, 0
call void @llvm.assume(i1 %cmp)
- %b = getelementptr inbounds i8, i8* %a, i64 %n
- ret i8* %b
+ %b = getelementptr inbounds i8, ptr %a, i64 %n
+ ret ptr %b
}
; TEST 11
; char* test11(char *p) {
; return p? p: nonnull();
; }
-; FNATTR: define i8* @test11
+; FNATTR: define ptr @test11
; FIXME: missing nonnull
-define i8* @test11(i8*) local_unnamed_addr {
- %2 = icmp eq i8* %0, null
+define ptr @test11(ptr) local_unnamed_addr {
+ %2 = icmp eq ptr %0, null
br i1 %2, label %3, label %5
; <label>:3: ; preds = %1
- %4 = tail call i8* @ret_nonnull()
+ %4 = tail call ptr @ret_nonnull()
br label %5
; <label>:5: ; preds = %3, %1
- %6 = phi i8* [ %4, %3 ], [ %0, %1 ]
- ret i8* %6
+ %6 = phi ptr [ %4, %3 ], [ %0, %1 ]
+ ret ptr %6
}
; TEST 12
; Simple CallSite Test
-declare void @test12_helper(i8*)
-define void @test12(i8* nonnull %a) {
- tail call void @test12_helper(i8* %a)
+declare void @test12_helper(ptr)
+define void @test12(ptr nonnull %a) {
+ tail call void @test12_helper(ptr %a)
ret void
}
; TEST 13
; Simple Argument Tests
-declare i8* @unknown()
+declare ptr @unknown()
define void @test13_helper() {
- %nonnullptr = tail call i8* @ret_nonnull()
- %maybenullptr = tail call i8* @unknown()
- tail call void @test13(i8* %nonnullptr, i8* %nonnullptr, i8* %maybenullptr)
- tail call void @test13(i8* %nonnullptr, i8* %maybenullptr, i8* %nonnullptr)
+ %nonnullptr = tail call ptr @ret_nonnull()
+ %maybenullptr = tail call ptr @unknown()
+ tail call void @test13(ptr %nonnullptr, ptr %nonnullptr, ptr %maybenullptr)
+ tail call void @test13(ptr %nonnullptr, ptr %maybenullptr, ptr %nonnullptr)
ret void
}
-define internal void @test13(i8* %a, i8* %b, i8* %c) {
+define internal void @test13(ptr %a, ptr %b, ptr %c) {
ret void
}
-declare nonnull i8* @nonnull()
+declare nonnull ptr @nonnull()
; TEST 14
; Complex propagation
@@ -171,83 +170,83 @@ declare nonnull i8* @nonnull()
; * Argument
; 1. In f1:bb6, %arg can be marked with nonnull because of the comparison in bb1
-; 2. Because f2 is internal function, f2(i32* %arg) -> @f2(i32* nonnull %arg)
+; 2. Because f2 is internal function, f2(ptr %arg) -> @f2(ptr nonnull %arg)
; 3. In f1:bb4 %tmp5 is nonnull and f3 is internal function.
-; Then, f3(i32* %arg) -> @f3(i32* nonnull %arg)
-; 4. We get nonnull in whole f1 call sites so f1(i32* %arg) -> @f1(i32* nonnull %arg)
+; Then, f3(ptr %arg) -> @f3(ptr nonnull %arg)
+; 4. We get nonnull in whole f1 call sites so f1(ptr %arg) -> @f1(ptr nonnull %arg)
-define internal i32* @f1(i32* %arg) {
-; FIXME: missing nonnull It should be nonnull @f1(i32* nonnull readonly %arg)
+define internal ptr @f1(ptr %arg) {
+; FIXME: missing nonnull It should be nonnull @f1(ptr nonnull readonly %arg)
bb:
- %tmp = icmp eq i32* %arg, null
+ %tmp = icmp eq ptr %arg, null
br i1 %tmp, label %bb9, label %bb1
bb1: ; preds = %bb
- %tmp2 = load i32, i32* %arg, align 4
+ %tmp2 = load i32, ptr %arg, align 4
%tmp3 = icmp eq i32 %tmp2, 0
br i1 %tmp3, label %bb6, label %bb4
bb4: ; preds = %bb1
- %tmp5 = getelementptr inbounds i32, i32* %arg, i64 1
- %tmp5b = tail call i32* @f3(i32* %tmp5)
- %tmp5c = getelementptr inbounds i32, i32* %tmp5b, i64 -1
+ %tmp5 = getelementptr inbounds i32, ptr %arg, i64 1
+ %tmp5b = tail call ptr @f3(ptr %tmp5)
+ %tmp5c = getelementptr inbounds i32, ptr %tmp5b, i64 -1
br label %bb9
bb6: ; preds = %bb1
-; FIXME: missing nonnull. It should be @f2(i32* nonnull %arg)
- %tmp7 = tail call i32* @f2(i32* %arg)
- ret i32* %tmp7
+; FIXME: missing nonnull. It should be @f2(ptr nonnull %arg)
+ %tmp7 = tail call ptr @f2(ptr %arg)
+ ret ptr %tmp7
bb9: ; preds = %bb4, %bb
- %tmp10 = phi i32* [ %tmp5c, %bb4 ], [ inttoptr (i64 4 to i32*), %bb ]
- ret i32* %tmp10
+ %tmp10 = phi ptr [ %tmp5c, %bb4 ], [ inttoptr (i64 4 to ptr), %bb ]
+ ret ptr %tmp10
}
-define internal i32* @f2(i32* %arg) {
-; FIXME: missing nonnull. It should be nonnull @f2(i32* nonnull %arg)
+define internal ptr @f2(ptr %arg) {
+; FIXME: missing nonnull. It should be nonnull @f2(ptr nonnull %arg)
bb:
-; FIXME: missing nonnull. It should be @f1(i32* nonnull readonly %arg)
- %tmp = tail call i32* @f1(i32* %arg)
- ret i32* %tmp
+; FIXME: missing nonnull. It should be @f1(ptr nonnull readonly %arg)
+ %tmp = tail call ptr @f1(ptr %arg)
+ ret ptr %tmp
}
-define dso_local noalias i32* @f3(i32* %arg) {
-; FIXME: missing nonnull. It should be nonnull @f3(i32* nonnull readonly %arg)
+define dso_local noalias ptr @f3(ptr %arg) {
+; FIXME: missing nonnull. It should be nonnull @f3(ptr nonnull readonly %arg)
bb:
-; FIXME: missing nonnull. It should be @f1(i32* nonnull readonly %arg)
- %tmp = call i32* @f1(i32* %arg)
- ret i32* %tmp
+; FIXME: missing nonnull. It should be @f1(ptr nonnull readonly %arg)
+ %tmp = call ptr @f1(ptr %arg)
+ ret ptr %tmp
}
; TEST 15
-define void @f15(i8* %arg) {
+define void @f15(ptr %arg) {
- tail call void @use1(i8* dereferenceable(4) %arg)
+ tail call void @use1(ptr dereferenceable(4) %arg)
ret void
}
declare void @fun0() #1
-declare void @fun1(i8*) #1
-declare void @fun2(i8*, i8*) #1
-declare void @fun3(i8*, i8*, i8*) #1
+declare void @fun1(ptr) #1
+declare void @fun2(ptr, ptr) #1
+declare void @fun3(ptr, ptr, ptr) #1
; TEST 16 simple path test
; if(..)
; fun2(nonnull %a, nonnull %b)
; else
; fun2(nonnull %a, %b)
; We can say that %a is nonnull but %b is not.
-define void @f16(i8* %a, i8 * %b, i8 %c) {
+define void @f16(ptr %a, ptr %b, i8 %c) {
; FIXME: missing nonnull on %a
%cmp = icmp eq i8 %c, 0
br i1 %cmp, label %if.then, label %if.else
if.then:
- tail call void @fun2(i8* nonnull %a, i8* nonnull %b)
+ tail call void @fun2(ptr nonnull %a, ptr nonnull %b)
ret void
if.else:
- tail call void @fun2(i8* nonnull %a, i8* %b)
+ tail call void @fun2(ptr nonnull %a, ptr %b)
ret void
}
; TEST 17 explore child BB test
@@ -257,7 +256,7 @@ if.else:
; ... (willreturn & nounwind)
; fun1(nonnull %a)
; We can say that %a is nonnull
-define void @f17(i8* %a, i8 %c) {
+define void @f17(ptr %a, i8 %c) {
%cmp = icmp eq i8 %c, 0
br i1 %cmp, label %if.then, label %if.else
if.then:
@@ -267,7 +266,7 @@ if.else:
tail call void @fun0()
br label %cont
cont:
- tail call void @fun1(i8* nonnull %a)
+ tail call void @fun1(ptr nonnull %a)
ret void
}
; TEST 18 More complex test
@@ -281,7 +280,7 @@ cont:
; ... (willreturn & nounwind)
; fun1(nonnull %a)
-define void @f18(i8* %a, i8* %b, i8 %c) {
+define void @f18(ptr %a, ptr %b, i8 %c) {
%cmp1 = icmp eq i8 %c, 0
br i1 %cmp1, label %if.then, label %if.else
if.then:
@@ -294,109 +293,109 @@ cont:
%cmp2 = icmp eq i8 %c, 1
br i1 %cmp2, label %cont.then, label %cont.else
cont.then:
- tail call void @fun1(i8* nonnull %b)
+ tail call void @fun1(ptr nonnull %b)
br label %cont2
cont.else:
tail call void @fun0()
br label %cont2
cont2:
- tail call void @fun1(i8* nonnull %a)
+ tail call void @fun1(ptr nonnull %a)
ret void
}
; TEST 19: Loop
-define void @f19(i8* %a, i8* %b, i8 %c) {
+define void @f19(ptr %a, ptr %b, i8 %c) {
; FIXME: missing nonnull on %b
br label %loop.header
loop.header:
%cmp2 = icmp eq i8 %c, 0
br i1 %cmp2, label %loop.body, label %loop.exit
loop.body:
- tail call void @fun1(i8* nonnull %b)
- tail call void @fun1(i8* nonnull %a)
+ tail call void @fun1(ptr nonnull %b)
+ tail call void @fun1(ptr nonnull %a)
br label %loop.header
loop.exit:
- tail call void @fun1(i8* nonnull %b)
+ tail call void @fun1(ptr nonnull %b)
ret void
}
; Test propagation of nonnull callsite args back to caller.
-declare void @use1(i8* %x)
-declare void @use2(i8* %x, i8* %y);
-declare void @use3(i8* %x, i8* %y, i8* %z);
+declare void @use1(ptr %x)
+declare void @use2(ptr %x, ptr %y);
+declare void @use3(ptr %x, ptr %y, ptr %z);
-declare void @use1nonnull(i8* nonnull noundef %x);
-declare void @use1nonnull_without_noundef(i8* nonnull %x);
-declare void @use2nonnull(i8* nonnull noundef %x, i8* nonnull noundef %y);
-declare void @use3nonnull(i8* nonnull noundef %x, i8* nonnull noundef %y, i8* nonnull noundef %z);
+declare void @use1nonnull(ptr nonnull noundef %x);
+declare void @use1nonnull_without_noundef(ptr nonnull %x);
+declare void @use2nonnull(ptr nonnull noundef %x, ptr nonnull noundef %y);
+declare void @use3nonnull(ptr nonnull noundef %x, ptr nonnull noundef %y, ptr nonnull noundef %z);
-declare i8 @use1safecall(i8* %x) nounwind willreturn ; nounwind+willreturn guarantees that execution continues to successor
+declare i8 @use1safecall(ptr %x) nounwind willreturn ; nounwind+willreturn guarantees that execution continues to successor
; Without noundef, nonnull cannot be propagated to the parent
-define void @parent_poison(i8* %a) {
-; FNATTR-LABEL: @parent_poison(i8* %a)
- call void @use1nonnull_without_noundef(i8* %a)
+define void @parent_poison(ptr %a) {
+; FNATTR-LABEL: @parent_poison(ptr %a)
+ call void @use1nonnull_without_noundef(ptr %a)
ret void
}
; Can't extend non-null to parent for any argument because the 2nd call is not guaranteed to execute.
-define void @parent1(i8* %a, i8* %b, i8* %c) {
-; FNATTR-LABEL: @parent1(i8* %a, i8* %b, i8* %c)
-; FNATTR-NEXT: call void @use3(i8* %c, i8* %a, i8* %b)
-; FNATTR-NEXT: call void @use3nonnull(i8* %b, i8* %c, i8* %a)
+define void @parent1(ptr %a, ptr %b, ptr %c) {
+; FNATTR-LABEL: @parent1(ptr %a, ptr %b, ptr %c)
+; FNATTR-NEXT: call void @use3(ptr %c, ptr %a, ptr %b)
+; FNATTR-NEXT: call void @use3nonnull(ptr %b, ptr %c, ptr %a)
; FNATTR-NEXT: ret void
- call void @use3(i8* %c, i8* %a, i8* %b)
- call void @use3nonnull(i8* %b, i8* %c, i8* %a)
+ call void @use3(ptr %c, ptr %a, ptr %b)
+ call void @use3nonnull(ptr %b, ptr %c, ptr %a)
ret void
}
; Extend non-null to parent for all arguments.
-define void @parent2(i8* %a, i8* %b, i8* %c) {
-; FNATTR-LABEL: @parent2(i8* nonnull %a, i8* nonnull %b, i8* nonnull %c)
-; FNATTR-NEXT: call void @use3nonnull(i8* %b, i8* %c, i8* %a)
-; FNATTR-NEXT: call void @use3(i8* %c, i8* %a, i8* %b)
+define void @parent2(ptr %a, ptr %b, ptr %c) {
+; FNATTR-LABEL: @parent2(ptr nonnull %a, ptr nonnull %b, ptr nonnull %c)
+; FNATTR-NEXT: call void @use3nonnull(ptr %b, ptr %c, ptr %a)
+; FNATTR-NEXT: call void @use3(ptr %c, ptr %a, ptr %b)
; FNATTR-NEXT: ret void
- call void @use3nonnull(i8* %b, i8* %c, i8* %a)
- call void @use3(i8* %c, i8* %a, i8* %b)
+ call void @use3nonnull(ptr %b, ptr %c, ptr %a)
+ call void @use3(ptr %c, ptr %a, ptr %b)
ret void
}
; Extend non-null to parent for 1st argument.
-define void @parent3(i8* %a, i8* %b, i8* %c) {
-; FNATTR-LABEL: @parent3(i8* nonnull %a, i8* %b, i8* %c)
-; FNATTR-NEXT: call void @use1nonnull(i8* %a)
-; FNATTR-NEXT: call void @use3(i8* %c, i8* %b, i8* %a)
+define void @parent3(ptr %a, ptr %b, ptr %c) {
+; FNATTR-LABEL: @parent3(ptr nonnull %a, ptr %b, ptr %c)
+; FNATTR-NEXT: call void @use1nonnull(ptr %a)
+; FNATTR-NEXT: call void @use3(ptr %c, ptr %b, ptr %a)
; FNATTR-NEXT: ret void
- call void @use1nonnull(i8* %a)
- call void @use3(i8* %c, i8* %b, i8* %a)
+ call void @use1nonnull(ptr %a)
+ call void @use3(ptr %c, ptr %b, ptr %a)
ret void
}
; Extend non-null to parent for last 2 arguments.
-define void @parent4(i8* %a, i8* %b, i8* %c) {
-; CHECK-LABEL: @parent4(i8* %a, i8* nonnull %b, i8* nonnull %c)
-; CHECK-NEXT: call void @use2nonnull(i8* %c, i8* %b)
-; CHECK-NEXT: call void @use2(i8* %a, i8* %c)
-; CHECK-NEXT: call void @use1(i8* %b)
+define void @parent4(ptr %a, ptr %b, ptr %c) {
+; CHECK-LABEL: @parent4(ptr %a, ptr nonnull %b, ptr nonnull %c)
+; CHECK-NEXT: call void @use2nonnull(ptr %c, ptr %b)
+; CHECK-NEXT: call void @use2(ptr %a, ptr %c)
+; CHECK-NEXT: call void @use1(ptr %b)
; FNATTR: ret void
- call void @use2nonnull(i8* %c, i8* %b)
- call void @use2(i8* %a, i8* %c)
- call void @use1(i8* %b)
+ call void @use2nonnull(ptr %c, ptr %b)
+ call void @use2(ptr %a, ptr %c)
+ call void @use1(ptr %b)
ret void
}
@@ -404,18 +403,18 @@ define void @parent4(i8* %a, i8* %b, i8* %c) {
; It appears benign to extend non-null to the parent in this case, but we can't do that
; because it would incorrectly propagate the wrong information to its callers.
-define void @parent5(i8* %a, i1 %a_is_notnull) {
-; FNATTR: @parent5(i8* %a, i1 %a_is_notnull)
+define void @parent5(ptr %a, i1 %a_is_notnull) {
+; FNATTR: @parent5(ptr %a, i1 %a_is_notnull)
; FNATTR-NEXT: br i1 %a_is_notnull, label %t, label %f
; FNATTR: t:
-; FNATTR-NEXT: call void @use1nonnull(i8* %a)
+; FNATTR-NEXT: call void @use1nonnull(ptr %a)
; FNATTR-NEXT: ret void
; FNATTR: f:
; FNATTR-NEXT: ret void
br i1 %a_is_notnull, label %t, label %f
t:
- call void @use1nonnull(i8* %a)
+ call void @use1nonnull(ptr %a)
ret void
f:
ret void
@@ -424,30 +423,30 @@ f:
; The callsite must execute in order for the attribute to transfer to the parent.
; The volatile load can't trap, so we can guarantee that we'll get to the call.
-define i8 @parent6(i8* %a, i8* %b) {
-; FNATTR-LABEL: @parent6(i8* nonnull %a, i8* %b)
-; FNATTR-NEXT: [[C:%.*]] = load volatile i8, i8* %b
-; FNATTR-NEXT: call void @use1nonnull(i8* %a)
+define i8 @parent6(ptr %a, ptr %b) {
+; FNATTR-LABEL: @parent6(ptr nonnull %a, ptr %b)
+; FNATTR-NEXT: [[C:%.*]] = load volatile i8, ptr %b
+; FNATTR-NEXT: call void @use1nonnull(ptr %a)
; FNATTR-NEXT: ret i8 [[C]]
- %c = load volatile i8, i8* %b
- call void @use1nonnull(i8* %a)
+ %c = load volatile i8, ptr %b
+ call void @use1nonnull(ptr %a)
ret i8 %c
}
; The nonnull callsite is guaranteed to execute, so the argument must be nonnull throughout the parent.
-define i8 @parent7(i8* %a) {
-; FNATTR-LABEL: @parent7(i8* nonnull %a)
-; FNATTR-NEXT: [[RET:%.*]] = call i8 @use1safecall(i8* %a)
-; FNATTR-NEXT: call void @use1nonnull(i8* %a)
+define i8 @parent7(ptr %a) {
+; FNATTR-LABEL: @parent7(ptr nonnull %a)
+; FNATTR-NEXT: [[RET:%.*]] = call i8 @use1safecall(ptr %a)
+; FNATTR-NEXT: call void @use1nonnull(ptr %a)
; FNATTR-NEXT: ret i8 [[RET]]
- %ret = call i8 @use1safecall(i8* %a)
- call void @use1nonnull(i8* %a)
+ %ret = call i8 @use1safecall(ptr %a)
+ call void @use1nonnull(ptr %a)
ret i8 %ret
}
@@ -455,99 +454,99 @@ define i8 @parent7(i8* %a) {
declare i32 @esfp(...)
-define i1 @parent8(i8* %a, i8* %bogus1, i8* %b) personality i8* bitcast (i32 (...)* @esfp to i8*){
-; FNATTR-LABEL: @parent8(i8* nonnull %a, i8* nocapture readnone %bogus1, i8* nonnull %b)
+define i1 @parent8(ptr %a, ptr %bogus1, ptr %b) personality ptr @esfp{
+; FNATTR-LABEL: @parent8(ptr nonnull %a, ptr nocapture readnone %bogus1, ptr nonnull %b)
; FNATTR-NEXT: entry:
-; FNATTR-NEXT: invoke void @use2nonnull(i8* %a, i8* %b)
+; FNATTR-NEXT: invoke void @use2nonnull(ptr %a, ptr %b)
; FNATTR-NEXT: to label %cont unwind label %exc
; FNATTR: cont:
-; FNATTR-NEXT: [[NULL_CHECK:%.*]] = icmp eq i8* %b, null
+; FNATTR-NEXT: [[NULL_CHECK:%.*]] = icmp eq ptr %b, null
; FNATTR-NEXT: ret i1 [[NULL_CHECK]]
; FNATTR: exc:
-; FNATTR-NEXT: [[LP:%.*]] = landingpad { i8*, i32 }
-; FNATTR-NEXT: filter [0 x i8*] zeroinitializer
+; FNATTR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; FNATTR-NEXT: filter [0 x ptr] zeroinitializer
; FNATTR-NEXT: unreachable
entry:
- invoke void @use2nonnull(i8* %a, i8* %b)
+ invoke void @use2nonnull(ptr %a, ptr %b)
to label %cont unwind label %exc
cont:
- %null_check = icmp eq i8* %b, null
+ %null_check = icmp eq ptr %b, null
ret i1 %null_check
exc:
- %lp = landingpad { i8*, i32 }
- filter [0 x i8*] zeroinitializer
+ %lp = landingpad { ptr, i32 }
+ filter [0 x ptr] zeroinitializer
unreachable
}
-; FNATTR: define nonnull i32* @gep1(
-define i32* @gep1(i32* %p) {
- %q = getelementptr inbounds i32, i32* %p, i32 1
- ret i32* %q
+; FNATTR: define nonnull ptr @gep1(
+define ptr @gep1(ptr %p) {
+ %q = getelementptr inbounds i32, ptr %p, i32 1
+ ret ptr %q
}
-define i32* @gep1_no_null_opt(i32* %p) #0 {
+define ptr @gep1_no_null_opt(ptr %p) #0 {
; Should't be able to derive nonnull based on gep.
-; FNATTR: define i32* @gep1_no_null_opt(
- %q = getelementptr inbounds i32, i32* %p, i32 1
- ret i32* %q
+; FNATTR: define ptr @gep1_no_null_opt(
+ %q = getelementptr inbounds i32, ptr %p, i32 1
+ ret ptr %q
}
-; FNATTR: define i32 addrspace(3)* @gep2(
-define i32 addrspace(3)* @gep2(i32 addrspace(3)* %p) {
- %q = getelementptr inbounds i32, i32 addrspace(3)* %p, i32 1
- ret i32 addrspace(3)* %q
+; FNATTR: define ptr addrspace(3) @gep2(
+define ptr addrspace(3) @gep2(ptr addrspace(3) %p) {
+ %q = getelementptr inbounds i32, ptr addrspace(3) %p, i32 1
+ ret ptr addrspace(3) %q
}
-; FNATTR: define i32 addrspace(3)* @as(i32 addrspace(3)* readnone returned dereferenceable(4) %p)
+; FNATTR: define ptr addrspace(3) @as(ptr addrspace(3) readnone returned dereferenceable(4) %p)
; FIXME: We should propagate dereferenceable here but *not* nonnull
-define i32 addrspace(3)* @as(i32 addrspace(3)* dereferenceable(4) %p) {
- ret i32 addrspace(3)* %p
+define ptr addrspace(3) @as(ptr addrspace(3) dereferenceable(4) %p) {
+ ret ptr addrspace(3) %p
}
-; FNATTR: define internal nonnull i32* @g2()
-define internal i32* @g2() {
- ret i32* inttoptr (i64 4 to i32*)
+; FNATTR: define internal nonnull ptr @g2()
+define internal ptr @g2() {
+ ret ptr inttoptr (i64 4 to ptr)
}
-define i32* @g1() {
- %c = call i32* @g2()
- ret i32* %c
+define ptr @g1() {
+ %c = call ptr @g2()
+ ret ptr %c
}
-declare void @use_i32_ptr(i32*) readnone nounwind
-define internal void @called_by_weak(i32* %a) {
- call void @use_i32_ptr(i32* %a)
+declare void @use_i32_ptr(ptr) readnone nounwind
+define internal void @called_by_weak(ptr %a) {
+ call void @use_i32_ptr(ptr %a)
ret void
}
; Check we do not annotate the function interface of this weak function.
-define weak_odr void @weak_caller(i32* nonnull %a) {
- call void @called_by_weak(i32* %a)
+define weak_odr void @weak_caller(ptr nonnull %a) {
+ call void @called_by_weak(ptr %a)
ret void
}
; Expect nonnull
-define internal void @control(i32* dereferenceable(4) %a) {
- call void @use_i32_ptr(i32* %a)
+define internal void @control(ptr dereferenceable(4) %a) {
+ call void @use_i32_ptr(ptr %a)
ret void
}
; Avoid nonnull as we do not touch naked functions
-define internal void @naked(i32* dereferenceable(4) %a) naked {
- call void @use_i32_ptr(i32* %a)
+define internal void @naked(ptr dereferenceable(4) %a) naked {
+ call void @use_i32_ptr(ptr %a)
ret void
}
; Avoid nonnull as we do not touch optnone
-define internal void @optnone(i32* dereferenceable(4) %a) optnone noinline {
- call void @use_i32_ptr(i32* %a)
+define internal void @optnone(ptr dereferenceable(4) %a) optnone noinline {
+ call void @use_i32_ptr(ptr %a)
ret void
}
-define void @make_live(i32* nonnull dereferenceable(8) %a) {
- call void @naked(i32* nonnull dereferenceable(8) align 16 %a)
- call void @control(i32* nonnull dereferenceable(8) align 16 %a)
- call void @optnone(i32* nonnull dereferenceable(8) align 16 %a)
+define void @make_live(ptr nonnull dereferenceable(8) %a) {
+ call void @naked(ptr nonnull dereferenceable(8) align 16 %a)
+ call void @control(ptr nonnull dereferenceable(8) align 16 %a)
+ call void @optnone(ptr nonnull dereferenceable(8) align 16 %a)
ret void
}
@@ -557,20 +556,20 @@ define void @make_live(i32* nonnull dereferenceable(8) %a) {
; }
; return g(nonnull u);
;}
-declare void @h(i32*) willreturn nounwind
-declare i32 @g(i32*) willreturn nounwind
-define i32 @nonnull_exec_ctx_1(i32* %a, i32 %b) {
+declare void @h(ptr) willreturn nounwind
+declare i32 @g(ptr) willreturn nounwind
+define i32 @nonnull_exec_ctx_1(ptr %a, i32 %b) {
; FNATTR-LABEL: define {{[^@]+}}@nonnull_exec_ctx_1
-; FNATTR-SAME: (i32* [[A:%.*]], i32 [[B:%.*]])
+; FNATTR-SAME: (ptr [[A:%.*]], i32 [[B:%.*]])
; FNATTR-NEXT: en:
; FNATTR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B:%.*]], 0
; FNATTR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; FNATTR: ex:
-; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(i32* nonnull [[A:%.*]])
+; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A:%.*]])
; FNATTR-NEXT: ret i32 [[TMP5]]
; FNATTR: hd:
; FNATTR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD]] ], [ 0, [[EN:%.*]] ]
-; FNATTR-NEXT: tail call void @h(i32* [[A]])
+; FNATTR-NEXT: tail call void @h(ptr [[A]])
; FNATTR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
; FNATTR-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], [[B]]
; FNATTR-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
@@ -581,29 +580,29 @@ en:
br i1 %tmp3, label %ex, label %hd
ex:
- %tmp5 = tail call i32 @g(i32* nonnull %a)
+ %tmp5 = tail call i32 @g(ptr nonnull %a)
ret i32 %tmp5
hd:
%tmp7 = phi i32 [ %tmp8, %hd ], [ 0, %en ]
- tail call void @h(i32* %a)
+ tail call void @h(ptr %a)
%tmp8 = add nuw i32 %tmp7, 1
%tmp9 = icmp eq i32 %tmp8, %b
br i1 %tmp9, label %ex, label %hd
}
-define i32 @nonnull_exec_ctx_1b(i32* %a, i32 %b) {
+define i32 @nonnull_exec_ctx_1b(ptr %a, i32 %b) {
; FNATTR-LABEL: define {{[^@]+}}@nonnull_exec_ctx_1b
-; FNATTR-SAME: (i32* [[A:%.*]], i32 [[B:%.*]])
+; FNATTR-SAME: (ptr [[A:%.*]], i32 [[B:%.*]])
; FNATTR-NEXT: en:
; FNATTR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B:%.*]], 0
; FNATTR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; FNATTR: ex:
-; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(i32* nonnull [[A:%.*]])
+; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A:%.*]])
; FNATTR-NEXT: ret i32 [[TMP5]]
; FNATTR: hd:
; FNATTR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD2:%.*]] ], [ 0, [[EN:%.*]] ]
-; FNATTR-NEXT: tail call void @h(i32* [[A]])
+; FNATTR-NEXT: tail call void @h(ptr [[A]])
; FNATTR-NEXT: br label [[HD2]]
; FNATTR: hd2:
; FNATTR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
@@ -616,12 +615,12 @@ en:
br i1 %tmp3, label %ex, label %hd
ex:
- %tmp5 = tail call i32 @g(i32* nonnull %a)
+ %tmp5 = tail call i32 @g(ptr nonnull %a)
ret i32 %tmp5
hd:
%tmp7 = phi i32 [ %tmp8, %hd2 ], [ 0, %en ]
- tail call void @h(i32* %a)
+ tail call void @h(ptr %a)
br label %hd2
hd2:
@@ -630,18 +629,18 @@ hd2:
br i1 %tmp9, label %ex, label %hd
}
-define i32 @nonnull_exec_ctx_2(i32* %a, i32 %b) willreturn nounwind {
+define i32 @nonnull_exec_ctx_2(ptr %a, i32 %b) willreturn nounwind {
; FNATTR-LABEL: define {{[^@]+}}@nonnull_exec_ctx_2
-; FNATTR-SAME: (i32* [[A:%.*]], i32 [[B:%.*]])
+; FNATTR-SAME: (ptr [[A:%.*]], i32 [[B:%.*]])
; FNATTR-NEXT: en:
; FNATTR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B:%.*]], 0
; FNATTR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; FNATTR: ex:
-; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(i32* nonnull [[A:%.*]])
+; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A:%.*]])
; FNATTR-NEXT: ret i32 [[TMP5]]
; FNATTR: hd:
; FNATTR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD]] ], [ 0, [[EN:%.*]] ]
-; FNATTR-NEXT: tail call void @h(i32* [[A]])
+; FNATTR-NEXT: tail call void @h(ptr [[A]])
; FNATTR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
; FNATTR-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], [[B]]
; FNATTR-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
@@ -652,29 +651,29 @@ en:
br i1 %tmp3, label %ex, label %hd
ex:
- %tmp5 = tail call i32 @g(i32* nonnull %a)
+ %tmp5 = tail call i32 @g(ptr nonnull %a)
ret i32 %tmp5
hd:
%tmp7 = phi i32 [ %tmp8, %hd ], [ 0, %en ]
- tail call void @h(i32* %a)
+ tail call void @h(ptr %a)
%tmp8 = add nuw i32 %tmp7, 1
%tmp9 = icmp eq i32 %tmp8, %b
br i1 %tmp9, label %ex, label %hd
}
-define i32 @nonnull_exec_ctx_2b(i32* %a, i32 %b) willreturn nounwind {
+define i32 @nonnull_exec_ctx_2b(ptr %a, i32 %b) willreturn nounwind {
; FNATTR-LABEL: define {{[^@]+}}@nonnull_exec_ctx_2b
-; FNATTR-SAME: (i32* [[A:%.*]], i32 [[B:%.*]])
+; FNATTR-SAME: (ptr [[A:%.*]], i32 [[B:%.*]])
; FNATTR-NEXT: en:
; FNATTR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B:%.*]], 0
; FNATTR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; FNATTR: ex:
-; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(i32* nonnull [[A:%.*]])
+; FNATTR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A:%.*]])
; FNATTR-NEXT: ret i32 [[TMP5]]
; FNATTR: hd:
; FNATTR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD2:%.*]] ], [ 0, [[EN:%.*]] ]
-; FNATTR-NEXT: tail call void @h(i32* [[A]])
+; FNATTR-NEXT: tail call void @h(ptr [[A]])
; FNATTR-NEXT: br label [[HD2]]
; FNATTR: hd2:
; FNATTR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
@@ -687,12 +686,12 @@ en:
br i1 %tmp3, label %ex, label %hd
ex:
- %tmp5 = tail call i32 @g(i32* nonnull %a)
+ %tmp5 = tail call i32 @g(ptr nonnull %a)
ret i32 %tmp5
hd:
%tmp7 = phi i32 [ %tmp8, %hd2 ], [ 0, %en ]
- tail call void @h(i32* %a)
+ tail call void @h(ptr %a)
br label %hd2
hd2:
@@ -702,22 +701,22 @@ hd2:
}
; Original from PR43833
-declare void @sink(i32*)
+declare void @sink(ptr)
; FIXME: the sink argument should be marked nonnull as in @PR43833_simple.
-define void @PR43833(i32* %0, i32 %1) {
+define void @PR43833(ptr %0, i32 %1) {
; FNATTR-LABEL: @PR43833(
; FNATTR-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP1:%.*]], 1
; FNATTR-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP7:%.*]]
; FNATTR: 4:
; FNATTR-NEXT: [[TMP5:%.*]] = zext i32 [[TMP1]] to i64
-; FNATTR-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, i32* [[TMP0:%.*]], i64 [[TMP5]]
+; FNATTR-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, ptr [[TMP0:%.*]], i64 [[TMP5]]
; FNATTR-NEXT: br label [[TMP8:%.*]]
; FNATTR: 7:
; FNATTR-NEXT: ret void
; FNATTR: 8:
; FNATTR-NEXT: [[TMP9:%.*]] = phi i32 [ 1, [[TMP4]] ], [ [[TMP10:%.*]], [[TMP8]] ]
-; FNATTR-NEXT: tail call void @sink(i32* [[TMP6]])
+; FNATTR-NEXT: tail call void @sink(ptr [[TMP6]])
; FNATTR-NEXT: [[TMP10]] = add nuw nsw i32 [[TMP9]], 1
; FNATTR-NEXT: [[TMP11:%.*]] = icmp eq i32 [[TMP10]], [[TMP1]]
; FNATTR-NEXT: br i1 [[TMP11]], label [[TMP7]], label [[TMP8]]
@@ -727,7 +726,7 @@ define void @PR43833(i32* %0, i32 %1) {
4: ; preds = %2
%5 = zext i32 %1 to i64
- %6 = getelementptr inbounds i32, i32* %0, i64 %5
+ %6 = getelementptr inbounds i32, ptr %0, i64 %5
br label %8
7: ; preds = %8, %2
@@ -735,26 +734,26 @@ define void @PR43833(i32* %0, i32 %1) {
8: ; preds = %8, %4
%9 = phi i32 [ 1, %4 ], [ %10, %8 ]
- tail call void @sink(i32* %6)
+ tail call void @sink(ptr %6)
%10 = add nuw nsw i32 %9, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %7, label %8
}
; Adjusted from PR43833
-define void @PR43833_simple(i32* %0, i32 %1) {
+define void @PR43833_simple(ptr %0, i32 %1) {
; FNATTR-LABEL: @PR43833_simple(
; FNATTR-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1:%.*]], 0
; FNATTR-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP7:%.*]]
; FNATTR: 4:
; FNATTR-NEXT: [[TMP5:%.*]] = zext i32 [[TMP1]] to i64
-; FNATTR-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, i32* [[TMP0:%.*]], i64 [[TMP5]]
+; FNATTR-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, ptr [[TMP0:%.*]], i64 [[TMP5]]
; FNATTR-NEXT: br label [[TMP8:%.*]]
; FNATTR: 7:
; FNATTR-NEXT: ret void
; FNATTR: 8:
; FNATTR-NEXT: [[TMP9:%.*]] = phi i32 [ 1, [[TMP4]] ], [ [[TMP10:%.*]], [[TMP8]] ]
-; FNATTR-NEXT: tail call void @sink(i32* [[TMP6]])
+; FNATTR-NEXT: tail call void @sink(ptr [[TMP6]])
; FNATTR-NEXT: [[TMP10]] = add nuw nsw i32 [[TMP9]], 1
; FNATTR-NEXT: [[TMP11:%.*]] = icmp eq i32 [[TMP10]], [[TMP1]]
; FNATTR-NEXT: br i1 [[TMP11]], label [[TMP7]], label [[TMP8]]
@@ -765,7 +764,7 @@ define void @PR43833_simple(i32* %0, i32 %1) {
4: ; preds = %2
%5 = zext i32 %1 to i64
- %6 = getelementptr inbounds i32, i32* %0, i64 %5
+ %6 = getelementptr inbounds i32, ptr %0, i64 %5
br label %8
7: ; preds = %8, %2
@@ -773,7 +772,7 @@ define void @PR43833_simple(i32* %0, i32 %1) {
8: ; preds = %8, %4
%9 = phi i32 [ 1, %4 ], [ %10, %8 ]
- tail call void @sink(i32* %6)
+ tail call void @sink(ptr %6)
%10 = add nuw nsw i32 %9, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %7, label %8
diff --git a/llvm/test/Transforms/FunctionAttrs/noreturn.ll b/llvm/test/Transforms/FunctionAttrs/noreturn.ll
index 00b1743e3d86..ae26eba6fc40 100644
--- a/llvm/test/Transforms/FunctionAttrs/noreturn.ll
+++ b/llvm/test/Transforms/FunctionAttrs/noreturn.ll
@@ -80,10 +80,10 @@ define void @unreachable() {
; CHECK-NOT: Function Attrs: {{.*}}noreturn
; CHECK: @coro
define void @coro() presplitcoroutine {
- call token @llvm.coro.id.retcon.once(i32 0, i32 0, i8* null, i8* bitcast(void() *@coro to i8*), i8* null, i8* null)
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call token @llvm.coro.id.retcon.once(i32 0, i32 0, ptr null, ptr @coro, ptr null, ptr null)
+ call i1 @llvm.coro.end(ptr null, i1 false)
unreachable
}
-declare token @llvm.coro.id.retcon.once(i32 %size, i32 %align, i8* %buffer, i8* %prototype, i8* %alloc, i8* %free)
-declare i1 @llvm.coro.end(i8*, i1)
+declare token @llvm.coro.id.retcon.once(i32 %size, i32 %align, ptr %buffer, ptr %prototype, ptr %alloc, ptr %free)
+declare i1 @llvm.coro.end(ptr, i1)
diff --git a/llvm/test/Transforms/FunctionAttrs/nosync.ll b/llvm/test/Transforms/FunctionAttrs/nosync.ll
index 262334a79d1d..25d517bc8208 100644
--- a/llvm/test/Transforms/FunctionAttrs/nosync.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nosync.ll
@@ -48,40 +48,40 @@ define i32 @test4(i32 %a, i32 %b) {
}
; negative case - explicit sync
-define void @test5(i8* %p) {
+define void @test5(ptr %p) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn
; CHECK-LABEL: @test5(
-; CHECK-NEXT: store atomic i8 0, i8* [[P:%.*]] seq_cst, align 1
+; CHECK-NEXT: store atomic i8 0, ptr [[P:%.*]] seq_cst, align 1
; CHECK-NEXT: ret void
;
- store atomic i8 0, i8* %p seq_cst, align 1
+ store atomic i8 0, ptr %p seq_cst, align 1
ret void
}
; negative case - explicit sync
-define i8 @test6(i8* %p) {
+define i8 @test6(ptr %p) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn
; CHECK-LABEL: @test6(
-; CHECK-NEXT: [[V:%.*]] = load atomic i8, i8* [[P:%.*]] seq_cst, align 1
+; CHECK-NEXT: [[V:%.*]] = load atomic i8, ptr [[P:%.*]] seq_cst, align 1
; CHECK-NEXT: ret i8 [[V]]
;
- %v = load atomic i8, i8* %p seq_cst, align 1
+ %v = load atomic i8, ptr %p seq_cst, align 1
ret i8 %v
}
; negative case - explicit sync
-define void @test7(i8* %p) {
+define void @test7(ptr %p) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn
; CHECK-LABEL: @test7(
-; CHECK-NEXT: [[TMP1:%.*]] = atomicrmw add i8* [[P:%.*]], i8 0 seq_cst, align 1
+; CHECK-NEXT: [[TMP1:%.*]] = atomicrmw add ptr [[P:%.*]], i8 0 seq_cst, align 1
; CHECK-NEXT: ret void
;
- atomicrmw add i8* %p, i8 0 seq_cst, align 1
+ atomicrmw add ptr %p, i8 0 seq_cst, align 1
ret void
}
; negative case - explicit sync
-define void @test8(i8* %p) {
+define void @test8(ptr %p) {
; CHECK: Function Attrs: mustprogress nofree norecurse nounwind willreturn
; CHECK-LABEL: @test8(
; CHECK-NEXT: fence seq_cst
@@ -92,7 +92,7 @@ define void @test8(i8* %p) {
}
; singlethread fences are okay
-define void @test9(i8* %p) {
+define void @test9(ptr %p) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; CHECK-LABEL: @test9(
; CHECK-NEXT: fence syncscope("singlethread") seq_cst
@@ -103,104 +103,104 @@ define void @test9(i8* %p) {
}
; atomic load with monotonic ordering
-define i32 @load_monotonic(i32* nocapture readonly %0) norecurse nounwind uwtable {
+define i32 @load_monotonic(ptr nocapture readonly %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn uwtable
; CHECK-LABEL: @load_monotonic(
-; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, i32* [[TMP0:%.*]] monotonic, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, ptr [[TMP0:%.*]] monotonic, align 4
; CHECK-NEXT: ret i32 [[TMP2]]
;
- %2 = load atomic i32, i32* %0 monotonic, align 4
+ %2 = load atomic i32, ptr %0 monotonic, align 4
ret i32 %2
}
; atomic store with monotonic ordering.
-define void @store_monotonic(i32* nocapture %0) norecurse nounwind uwtable {
+define void @store_monotonic(ptr nocapture %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn uwtable
; CHECK-LABEL: @store_monotonic(
-; CHECK-NEXT: store atomic i32 10, i32* [[TMP0:%.*]] monotonic, align 4
+; CHECK-NEXT: store atomic i32 10, ptr [[TMP0:%.*]] monotonic, align 4
; CHECK-NEXT: ret void
;
- store atomic i32 10, i32* %0 monotonic, align 4
+ store atomic i32 10, ptr %0 monotonic, align 4
ret void
}
; negative, should not deduce nosync
; atomic load with acquire ordering.
-define i32 @load_acquire(i32* nocapture readonly %0) norecurse nounwind uwtable {
+define i32 @load_acquire(ptr nocapture readonly %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn uwtable
; CHECK-LABEL: @load_acquire(
-; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, i32* [[TMP0:%.*]] acquire, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, ptr [[TMP0:%.*]] acquire, align 4
; CHECK-NEXT: ret i32 [[TMP2]]
;
- %2 = load atomic i32, i32* %0 acquire, align 4
+ %2 = load atomic i32, ptr %0 acquire, align 4
ret i32 %2
}
-define i32 @load_unordered(i32* nocapture readonly %0) norecurse nounwind uwtable {
+define i32 @load_unordered(ptr nocapture readonly %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn uwtable
; CHECK-LABEL: @load_unordered(
-; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, i32* [[TMP0:%.*]] unordered, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load atomic i32, ptr [[TMP0:%.*]] unordered, align 4
; CHECK-NEXT: ret i32 [[TMP2]]
;
- %2 = load atomic i32, i32* %0 unordered, align 4
+ %2 = load atomic i32, ptr %0 unordered, align 4
ret i32 %2
}
; atomic store with unordered ordering.
-define void @store_unordered(i32* nocapture %0) norecurse nounwind uwtable {
+define void @store_unordered(ptr nocapture %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn writeonly uwtable
; CHECK-LABEL: @store_unordered(
-; CHECK-NEXT: store atomic i32 10, i32* [[TMP0:%.*]] unordered, align 4
+; CHECK-NEXT: store atomic i32 10, ptr [[TMP0:%.*]] unordered, align 4
; CHECK-NEXT: ret void
;
- store atomic i32 10, i32* %0 unordered, align 4
+ store atomic i32 10, ptr %0 unordered, align 4
ret void
}
; negative, should not deduce nosync
; atomic load with release ordering
-define void @load_release(i32* nocapture %0) norecurse nounwind uwtable {
+define void @load_release(ptr nocapture %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly nofree norecurse nounwind uwtable
; CHECK-LABEL: @load_release(
-; CHECK-NEXT: store atomic volatile i32 10, i32* [[TMP0:%.*]] release, align 4
+; CHECK-NEXT: store atomic volatile i32 10, ptr [[TMP0:%.*]] release, align 4
; CHECK-NEXT: ret void
;
- store atomic volatile i32 10, i32* %0 release, align 4
+ store atomic volatile i32 10, ptr %0 release, align 4
ret void
}
; negative volatile, relaxed atomic
-define void @load_volatile_release(i32* nocapture %0) norecurse nounwind uwtable {
+define void @load_volatile_release(ptr nocapture %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly nofree norecurse nounwind uwtable
; CHECK-LABEL: @load_volatile_release(
-; CHECK-NEXT: store atomic volatile i32 10, i32* [[TMP0:%.*]] release, align 4
+; CHECK-NEXT: store atomic volatile i32 10, ptr [[TMP0:%.*]] release, align 4
; CHECK-NEXT: ret void
;
- store atomic volatile i32 10, i32* %0 release, align 4
+ store atomic volatile i32 10, ptr %0 release, align 4
ret void
}
; volatile store.
-define void @volatile_store(i32* %0) norecurse nounwind uwtable {
+define void @volatile_store(ptr %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly nofree norecurse nounwind uwtable
; CHECK-LABEL: @volatile_store(
-; CHECK-NEXT: store volatile i32 14, i32* [[TMP0:%.*]], align 4
+; CHECK-NEXT: store volatile i32 14, ptr [[TMP0:%.*]], align 4
; CHECK-NEXT: ret void
;
- store volatile i32 14, i32* %0, align 4
+ store volatile i32 14, ptr %0, align 4
ret void
}
; negative, should not deduce nosync
; volatile load.
-define i32 @volatile_load(i32* %0) norecurse nounwind uwtable {
+define i32 @volatile_load(ptr %0) norecurse nounwind uwtable {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn uwtable
; CHECK-LABEL: @volatile_load(
-; CHECK-NEXT: [[TMP2:%.*]] = load volatile i32, i32* [[TMP0:%.*]], align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load volatile i32, ptr [[TMP0:%.*]], align 4
; CHECK-NEXT: ret i32 [[TMP2]]
;
- %2 = load volatile i32, i32* %0, align 4
+ %2 = load volatile i32, ptr %0, align 4
ret i32 %2
}
@@ -232,28 +232,28 @@ define void @call_might_sync() nounwind uwtable noinline {
ret void
}
-declare void @llvm.memcpy(i8* %dest, i8* %src, i32 %len, i1 %isvolatile)
-declare void @llvm.memset(i8* %dest, i8 %val, i32 %len, i1 %isvolatile)
+declare void @llvm.memcpy(ptr %dest, ptr %src, i32 %len, i1 %isvolatile)
+declare void @llvm.memset(ptr %dest, i8 %val, i32 %len, i1 %isvolatile)
; negative, checking volatile intrinsics.
-define i32 @memcpy_volatile(i8* %ptr1, i8* %ptr2) {
+define i32 @memcpy_volatile(ptr %ptr1, ptr %ptr2) {
; CHECK: Function Attrs: argmemonly mustprogress nofree nounwind willreturn
; CHECK-LABEL: @memcpy_volatile(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1:%.*]], i8* [[PTR2:%.*]], i32 8, i1 true)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1:%.*]], ptr [[PTR2:%.*]], i32 8, i1 true)
; CHECK-NEXT: ret i32 4
;
- call void @llvm.memcpy(i8* %ptr1, i8* %ptr2, i32 8, i1 1)
+ call void @llvm.memcpy(ptr %ptr1, ptr %ptr2, i32 8, i1 1)
ret i32 4
}
; positive, non-volatile intrinsic.
-define i32 @memset_non_volatile(i8* %ptr1, i8 %val) {
+define i32 @memset_non_volatile(ptr %ptr1, i8 %val) {
; CHECK: Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn writeonly
; CHECK-LABEL: @memset_non_volatile(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* [[PTR1:%.*]], i8 [[VAL:%.*]], i32 8, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr [[PTR1:%.*]], i8 [[VAL:%.*]], i32 8, i1 false)
; CHECK-NEXT: ret i32 4
;
- call void @llvm.memset(i8* %ptr1, i8 %val, i32 8, i1 0)
+ call void @llvm.memset(ptr %ptr1, i8 %val, i32 8, i1 0)
ret i32 4
}
@@ -281,18 +281,18 @@ define void @convergent_readnone(){
}
; CHECK: Function Attrs: nounwind
-; CHECK-NEXT: declare void @llvm.x86.sse2.clflush(i8*)
-declare void @llvm.x86.sse2.clflush(i8*)
+; CHECK-NEXT: declare void @llvm.x86.sse2.clflush(ptr)
+declare void @llvm.x86.sse2.clflush(ptr)
@a = common global i32 0, align 4
; negative. Synchronizing intrinsic
define void @i_totally_sync() {
; CHECK: Function Attrs: nounwind
; CHECK-LABEL: @i_totally_sync(
-; CHECK-NEXT: tail call void @llvm.x86.sse2.clflush(i8* bitcast (i32* @a to i8*))
+; CHECK-NEXT: tail call void @llvm.x86.sse2.clflush(ptr @a)
; CHECK-NEXT: ret void
;
- tail call void @llvm.x86.sse2.clflush(i8* bitcast (i32* @a to i8*))
+ tail call void @llvm.x86.sse2.clflush(ptr @a)
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/nounwind.ll b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
index f03bf0511039..0b357c954bd9 100644
--- a/llvm/test/Transforms/FunctionAttrs/nounwind.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
@@ -66,7 +66,7 @@ declare void @__cxa_rethrow()
; }
; CHECK: define i32 @catch_thing()
-define i32 @catch_thing() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define i32 @catch_thing() personality ptr @__gxx_personality_v0 {
invoke void @__cxa_rethrow() #1
to label %1 unwind label %2
@@ -74,10 +74,10 @@ define i32 @catch_thing() personality i8* bitcast (i32 (...)* @__gxx_personality
unreachable
2: ; preds = %0
- %3 = landingpad { i8*, i32 }
- catch i8* null
- %4 = extractvalue { i8*, i32 } %3, 0
- %5 = tail call i8* @__cxa_begin_catch(i8* %4) #2
+ %3 = landingpad { ptr, i32 }
+ catch ptr null
+ %4 = extractvalue { ptr, i32 } %3, 0
+ %5 = tail call ptr @__cxa_begin_catch(ptr %4) #2
tail call void @__cxa_end_catch()
ret i32 -1
}
@@ -90,6 +90,6 @@ define i32 @catch_thing_user() {
declare i32 @__gxx_personality_v0(...)
-declare i8* @__cxa_begin_catch(i8*)
+declare ptr @__cxa_begin_catch(ptr)
declare void @__cxa_end_catch()
diff --git a/llvm/test/Transforms/FunctionAttrs/optnone-simple.ll b/llvm/test/Transforms/FunctionAttrs/optnone-simple.ll
index beaa588da503..297436b0b80f 100644
--- a/llvm/test/Transforms/FunctionAttrs/optnone-simple.ll
+++ b/llvm/test/Transforms/FunctionAttrs/optnone-simple.ll
@@ -13,10 +13,10 @@ define i32 @iadd_optimize(i32 %a, i32 %b) #0 {
entry:
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
- store i32 %a, i32* %a.addr, align 4
- store i32 %b, i32* %b.addr, align 4
- %0 = load i32, i32* %a.addr, align 4
- %1 = load i32, i32* %b.addr, align 4
+ store i32 %a, ptr %a.addr, align 4
+ store i32 %b, ptr %b.addr, align 4
+ %0 = load i32, ptr %a.addr, align 4
+ %1 = load i32, ptr %b.addr, align 4
%add = add nsw i32 %0, %1
ret i32 %add
}
@@ -31,10 +31,10 @@ define i32 @iadd_optnone(i32 %a, i32 %b) #1 {
entry:
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
- store i32 %a, i32* %a.addr, align 4
- store i32 %b, i32* %b.addr, align 4
- %0 = load i32, i32* %a.addr, align 4
- %1 = load i32, i32* %b.addr, align 4
+ store i32 %a, ptr %a.addr, align 4
+ store i32 %b, ptr %b.addr, align 4
+ %0 = load i32, ptr %a.addr, align 4
+ %1 = load i32, ptr %b.addr, align 4
%add = add nsw i32 %0, %1
ret i32 %add
}
@@ -55,10 +55,10 @@ define float @fsub_optimize(float %a, float %b) #0 {
entry:
%a.addr = alloca float, align 4
%b.addr = alloca float, align 4
- store float %a, float* %a.addr, align 4
- store float %b, float* %b.addr, align 4
- %0 = load float, float* %a.addr, align 4
- %1 = load float, float* %b.addr, align 4
+ store float %a, ptr %a.addr, align 4
+ store float %b, ptr %b.addr, align 4
+ %0 = load float, ptr %a.addr, align 4
+ %1 = load float, ptr %b.addr, align 4
%sub = fsub float %0, %1
ret float %sub
}
@@ -73,10 +73,10 @@ define float @fsub_optnone(float %a, float %b) #1 {
entry:
%a.addr = alloca float, align 4
%b.addr = alloca float, align 4
- store float %a, float* %a.addr, align 4
- store float %b, float* %b.addr, align 4
- %0 = load float, float* %a.addr, align 4
- %1 = load float, float* %b.addr, align 4
+ store float %a, ptr %a.addr, align 4
+ store float %b, ptr %b.addr, align 4
+ %0 = load float, ptr %a.addr, align 4
+ %1 = load float, ptr %b.addr, align 4
%sub = fsub float %0, %1
ret float %sub
}
@@ -98,10 +98,10 @@ define <4 x float> @vmul_optimize(<4 x float> %a, <4 x float> %b) #0 {
entry:
%a.addr = alloca <4 x float>, align 16
%b.addr = alloca <4 x float>, align 16
- store <4 x float> %a, <4 x float>* %a.addr, align 16
- store <4 x float> %b, <4 x float>* %b.addr, align 16
- %0 = load <4 x float>, <4 x float>* %a.addr, align 16
- %1 = load <4 x float>, <4 x float>* %b.addr, align 16
+ store <4 x float> %a, ptr %a.addr, align 16
+ store <4 x float> %b, ptr %b.addr, align 16
+ %0 = load <4 x float>, ptr %a.addr, align 16
+ %1 = load <4 x float>, ptr %b.addr, align 16
%mul = fmul <4 x float> %0, %1
ret <4 x float> %mul
}
@@ -116,10 +116,10 @@ define <4 x float> @vmul_optnone(<4 x float> %a, <4 x float> %b) #1 {
entry:
%a.addr = alloca <4 x float>, align 16
%b.addr = alloca <4 x float>, align 16
- store <4 x float> %a, <4 x float>* %a.addr, align 16
- store <4 x float> %b, <4 x float>* %b.addr, align 16
- %0 = load <4 x float>, <4 x float>* %a.addr, align 16
- %1 = load <4 x float>, <4 x float>* %b.addr, align 16
+ store <4 x float> %a, ptr %a.addr, align 16
+ store <4 x float> %b, ptr %b.addr, align 16
+ %0 = load <4 x float>, ptr %a.addr, align 16
+ %1 = load <4 x float>, ptr %b.addr, align 16
%mul = fmul <4 x float> %0, %1
ret <4 x float> %mul
}
diff --git a/llvm/test/Transforms/FunctionAttrs/optnone.ll b/llvm/test/Transforms/FunctionAttrs/optnone.ll
index 6d8a1d58f148..260d53b2bfed 100644
--- a/llvm/test/Transforms/FunctionAttrs/optnone.ll
+++ b/llvm/test/Transforms/FunctionAttrs/optnone.ll
@@ -3,21 +3,21 @@
@x = global i32 0
-define void @test_opt(i8* %p) {
+define void @test_opt(ptr %p) {
; CHECK-LABEL: @test_opt
-; CHECK: (i8* nocapture readnone %p) #0 {
+; CHECK: (ptr nocapture readnone %p) #0 {
ret void
}
-define void @test_optnone(i8* %p) noinline optnone {
+define void @test_optnone(ptr %p) noinline optnone {
; CHECK-LABEL: @test_optnone
-; CHECK: (i8* %p) #1 {
+; CHECK: (ptr %p) #1 {
ret void
}
-declare i8 @strlen(i8*) noinline optnone
+declare i8 @strlen(ptr) noinline optnone
; CHECK-LABEL: @strlen
-; CHECK: (i8*) #1
+; CHECK: (ptr) #1
; CHECK-LABEL: attributes #0
; CHECK: = { mustprogress nofree norecurse nosync nounwind readnone willreturn }
diff --git a/llvm/test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll b/llvm/test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll
index cbf8543bf574..5b7be1f2a45f 100644
--- a/llvm/test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll
+++ b/llvm/test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll
@@ -4,40 +4,40 @@
; This checks for a previously existing iterator wraparound bug in
; FunctionAttrs, and in the process covers corner cases with varargs.
-declare void @llvm.va_start(i8*)
-declare void @llvm.va_end(i8*)
+declare void @llvm.va_start(ptr)
+declare void @llvm.va_end(ptr)
-define void @va_func(i32* readonly %b, ...) readonly nounwind {
-; CHECK-LABEL: define void @va_func(i32* nocapture readonly %b, ...)
+define void @va_func(ptr readonly %b, ...) readonly nounwind {
+; CHECK-LABEL: define void @va_func(ptr nocapture readonly %b, ...)
entry:
%valist = alloca i8
- call void @llvm.va_start(i8* %valist)
- call void @llvm.va_end(i8* %valist)
- %x = call i32 @caller(i32* %b)
+ call void @llvm.va_start(ptr %valist)
+ call void @llvm.va_end(ptr %valist)
+ %x = call i32 @caller(ptr %b)
ret void
}
-define i32 @caller(i32* %x) {
-; CHECK-LABEL: define i32 @caller(i32* nocapture readonly %x)
+define i32 @caller(ptr %x) {
+; CHECK-LABEL: define i32 @caller(ptr nocapture readonly %x)
entry:
- call void(i32*,...) @va_func(i32* null, i32 0, i32 0, i32 0, i32* %x)
+ call void(ptr,...) @va_func(ptr null, i32 0, i32 0, i32 0, ptr %x)
ret i32 42
}
-define void @va_func2(i32* readonly %b, ...) {
-; CHECK-LABEL: define void @va_func2(i32* nocapture readonly %b, ...)
+define void @va_func2(ptr readonly %b, ...) {
+; CHECK-LABEL: define void @va_func2(ptr nocapture readonly %b, ...)
entry:
%valist = alloca i8
- call void @llvm.va_start(i8* %valist)
- call void @llvm.va_end(i8* %valist)
- %x = call i32 @caller(i32* %b)
+ call void @llvm.va_start(ptr %valist)
+ call void @llvm.va_end(ptr %valist)
+ %x = call i32 @caller(ptr %b)
ret void
}
-define i32 @caller2(i32* %x, i32* %y) {
-; CHECK-LABEL: define i32 @caller2(i32* nocapture readonly %x, i32* %y)
+define i32 @caller2(ptr %x, ptr %y) {
+; CHECK-LABEL: define i32 @caller2(ptr nocapture readonly %x, ptr %y)
entry:
- call void(i32*,...) @va_func2(i32* %x, i32 0, i32 0, i32 0, i32* %y)
+ call void(ptr,...) @va_func2(ptr %x, i32 0, i32 0, i32 0, ptr %y)
ret i32 42
}
diff --git a/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll b/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
index 578fc417ab02..788570c84ce6 100644
--- a/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
+++ b/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
@@ -5,14 +5,14 @@
define void @foo() {
; CHECK-LABEL: define void @foo() #0 {
- store i32 1, i32* @i
+ store i32 1, ptr @i
call void @bar()
ret void
}
define void @bar() {
; CHECK-LABEL: define void @bar() #0 {
- %i = load i32, i32* @i
+ %i = load i32, ptr @i
call void @foo()
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/readattrs.ll b/llvm/test/Transforms/FunctionAttrs/readattrs.ll
index 63c27831fe00..f1f1c4cc2ea8 100644
--- a/llvm/test/Transforms/FunctionAttrs/readattrs.ll
+++ b/llvm/test/Transforms/FunctionAttrs/readattrs.ll
@@ -3,287 +3,287 @@
@x = global i32 0
-declare void @test1_1(i8* %x1_1, i8* nocapture readonly %y1_1, ...)
+declare void @test1_1(ptr %x1_1, ptr nocapture readonly %y1_1, ...)
-define void @test1_2(i8* %x1_2, i8* %y1_2, i8* %z1_2) {
+define void @test1_2(ptr %x1_2, ptr %y1_2, ptr %z1_2) {
; CHECK-LABEL: define {{[^@]+}}@test1_2
-; CHECK-SAME: (i8* [[X1_2:%.*]], i8* nocapture readonly [[Y1_2:%.*]], i8* [[Z1_2:%.*]]) {
-; CHECK-NEXT: call void (i8*, i8*, ...) @test1_1(i8* [[X1_2]], i8* [[Y1_2]], i8* [[Z1_2]])
-; CHECK-NEXT: store i32 0, i32* @x, align 4
+; CHECK-SAME: (ptr [[X1_2:%.*]], ptr nocapture readonly [[Y1_2:%.*]], ptr [[Z1_2:%.*]]) {
+; CHECK-NEXT: call void (ptr, ptr, ...) @test1_1(ptr [[X1_2]], ptr [[Y1_2]], ptr [[Z1_2]])
+; CHECK-NEXT: store i32 0, ptr @x, align 4
; CHECK-NEXT: ret void
;
- call void (i8*, i8*, ...) @test1_1(i8* %x1_2, i8* %y1_2, i8* %z1_2)
- store i32 0, i32* @x
+ call void (ptr, ptr, ...) @test1_1(ptr %x1_2, ptr %y1_2, ptr %z1_2)
+ store i32 0, ptr @x
ret void
}
-define i8* @test2(i8* %p) {
+define ptr @test2(ptr %p) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn writeonly
; CHECK-LABEL: define {{[^@]+}}@test2
-; CHECK-SAME: (i8* readnone returned [[P:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT: store i32 0, i32* @x, align 4
-; CHECK-NEXT: ret i8* [[P]]
+; CHECK-SAME: (ptr readnone returned [[P:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: store i32 0, ptr @x, align 4
+; CHECK-NEXT: ret ptr [[P]]
;
- store i32 0, i32* @x
- ret i8* %p
+ store i32 0, ptr @x
+ ret ptr %p
}
-define i1 @test3(i8* %p, i8* %q) {
+define i1 @test3(ptr %p, ptr %q) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
; CHECK-LABEL: define {{[^@]+}}@test3
-; CHECK-SAME: (i8* readnone [[P:%.*]], i8* readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] {
-; CHECK-NEXT: [[A:%.*]] = icmp ult i8* [[P]], [[Q]]
+; CHECK-SAME: (ptr readnone [[P:%.*]], ptr readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: [[A:%.*]] = icmp ult ptr [[P]], [[Q]]
; CHECK-NEXT: ret i1 [[A]]
;
- %A = icmp ult i8* %p, %q
+ %A = icmp ult ptr %p, %q
ret i1 %A
}
-declare void @test4_1(i8* nocapture) readonly
+declare void @test4_1(ptr nocapture) readonly
-define void @test4_2(i8* %p) {
+define void @test4_2(ptr %p) {
; CHECK: Function Attrs: nofree readonly
; CHECK-LABEL: define {{[^@]+}}@test4_2
-; CHECK-SAME: (i8* nocapture readonly [[P:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT: call void @test4_1(i8* [[P]])
+; CHECK-SAME: (ptr nocapture readonly [[P:%.*]]) #[[ATTR3:[0-9]+]] {
+; CHECK-NEXT: call void @test4_1(ptr [[P]])
; CHECK-NEXT: ret void
;
- call void @test4_1(i8* %p)
+ call void @test4_1(ptr %p)
ret void
}
; Missed optz'n: we could make %q readnone, but don't break test6!
-define void @test5(i8** %p, i8* %q) {
+define void @test5(ptr %p, ptr %q) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn writeonly
; CHECK-LABEL: define {{[^@]+}}@test5
-; CHECK-SAME: (i8** nocapture writeonly [[P:%.*]], i8* [[Q:%.*]]) #[[ATTR4:[0-9]+]] {
-; CHECK-NEXT: store i8* [[Q]], i8** [[P]], align 8
+; CHECK-SAME: (ptr nocapture writeonly [[P:%.*]], ptr [[Q:%.*]]) #[[ATTR4:[0-9]+]] {
+; CHECK-NEXT: store ptr [[Q]], ptr [[P]], align 8
; CHECK-NEXT: ret void
;
- store i8* %q, i8** %p
+ store ptr %q, ptr %p
ret void
}
declare void @test6_1()
; This is not a missed optz'n.
-define void @test6_2(i8** %p, i8* %q) {
+define void @test6_2(ptr %p, ptr %q) {
; CHECK-LABEL: define {{[^@]+}}@test6_2
-; CHECK-SAME: (i8** nocapture writeonly [[P:%.*]], i8* [[Q:%.*]]) {
-; CHECK-NEXT: store i8* [[Q]], i8** [[P]], align 8
+; CHECK-SAME: (ptr nocapture writeonly [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: store ptr [[Q]], ptr [[P]], align 8
; CHECK-NEXT: call void @test6_1()
; CHECK-NEXT: ret void
;
- store i8* %q, i8** %p
+ store ptr %q, ptr %p
call void @test6_1()
ret void
}
; inalloca parameters are always considered written
-define void @test7_1(i32* inalloca(i32) %a) {
+define void @test7_1(ptr inalloca(i32) %a) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@test7_1
-; CHECK-SAME: (i32* nocapture inalloca(i32) [[A:%.*]]) #[[ATTR5:[0-9]+]] {
+; CHECK-SAME: (ptr nocapture inalloca(i32) [[A:%.*]]) #[[ATTR5:[0-9]+]] {
; CHECK-NEXT: ret void
;
ret void
}
; preallocated parameters are always considered written
-define void @test7_2(i32* preallocated(i32) %a) {
+define void @test7_2(ptr preallocated(i32) %a) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@test7_2
-; CHECK-SAME: (i32* nocapture preallocated(i32) [[A:%.*]]) #[[ATTR5]] {
+; CHECK-SAME: (ptr nocapture preallocated(i32) [[A:%.*]]) #[[ATTR5]] {
; CHECK-NEXT: ret void
;
ret void
}
-define i32* @test8_1(i32* %p) {
+define ptr @test8_1(ptr %p) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
; CHECK-LABEL: define {{[^@]+}}@test8_1
-; CHECK-SAME: (i32* readnone returned [[P:%.*]]) #[[ATTR1]] {
+; CHECK-SAME: (ptr readnone returned [[P:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: ret i32* [[P]]
+; CHECK-NEXT: ret ptr [[P]]
;
entry:
- ret i32* %p
+ ret ptr %p
}
-define void @test8_2(i32* %p) {
+define void @test8_2(ptr %p) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn writeonly
; CHECK-LABEL: define {{[^@]+}}@test8_2
-; CHECK-SAME: (i32* writeonly [[P:%.*]]) #[[ATTR4]] {
+; CHECK-SAME: (ptr writeonly [[P:%.*]]) #[[ATTR4]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i32* @test8_1(i32* [[P]])
-; CHECK-NEXT: store i32 10, i32* [[CALL]], align 4
+; CHECK-NEXT: [[CALL:%.*]] = call ptr @test8_1(ptr [[P]])
+; CHECK-NEXT: store i32 10, ptr [[CALL]], align 4
; CHECK-NEXT: ret void
;
entry:
- %call = call i32* @test8_1(i32* %p)
- store i32 10, i32* %call, align 4
+ %call = call ptr @test8_1(ptr %p)
+ store i32 10, ptr %call, align 4
ret void
}
-declare void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>%val, <4 x i32*>, i32, <4 x i1>)
+declare void @llvm.masked.scatter.v4i32.v4p0(<4 x i32>%val, <4 x ptr>, i32, <4 x i1>)
-define void @test9(<4 x i32*> %ptrs, <4 x i32>%val) {
+define void @test9(<4 x ptr> %ptrs, <4 x i32>%val) {
; CHECK: Function Attrs: mustprogress nofree nosync nounwind willreturn writeonly
; CHECK-LABEL: define {{[^@]+}}@test9
-; CHECK-SAME: (<4 x i32*> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR7:[0-9]+]] {
-; CHECK-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL]], <4 x i32*> [[PTRS]], i32 4, <4 x i1> <i1 true, i1 false, i1 true, i1 false>)
+; CHECK-SAME: (<4 x ptr> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR7:[0-9]+]] {
+; CHECK-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> [[PTRS]], i32 4, <4 x i1> <i1 true, i1 false, i1 true, i1 false>)
; CHECK-NEXT: ret void
;
- call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>%val, <4 x i32*> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>)
+ call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32>%val, <4 x ptr> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>)
ret void
}
-declare <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*>, i32, <4 x i1>, <4 x i32>)
-define <4 x i32> @test10(<4 x i32*> %ptrs) {
+declare <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr>, i32, <4 x i1>, <4 x i32>)
+define <4 x i32> @test10(<4 x ptr> %ptrs) {
; CHECK: Function Attrs: mustprogress nofree nosync nounwind readonly willreturn
; CHECK-LABEL: define {{[^@]+}}@test10
-; CHECK-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] {
-; CHECK-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[PTRS]], i32 4, <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef)
+; CHECK-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] {
+; CHECK-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> [[PTRS]], i32 4, <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef)
; CHECK-NEXT: ret <4 x i32> [[RES]]
;
- %res = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>, <4 x i32>undef)
+ %res = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>, <4 x i32>undef)
ret <4 x i32> %res
}
-declare <4 x i32> @test11_1(<4 x i32*>) argmemonly nounwind readonly
-define <4 x i32> @test11_2(<4 x i32*> %ptrs) {
+declare <4 x i32> @test11_1(<4 x ptr>) argmemonly nounwind readonly
+define <4 x i32> @test11_2(<4 x ptr> %ptrs) {
; CHECK: Function Attrs: argmemonly nofree nounwind readonly
; CHECK-LABEL: define {{[^@]+}}@test11_2
-; CHECK-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR11:[0-9]+]] {
-; CHECK-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x i32*> [[PTRS]])
+; CHECK-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR11:[0-9]+]] {
+; CHECK-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]])
; CHECK-NEXT: ret <4 x i32> [[RES]]
;
- %res = call <4 x i32> @test11_1(<4 x i32*> %ptrs)
+ %res = call <4 x i32> @test11_1(<4 x ptr> %ptrs)
ret <4 x i32> %res
}
-declare <4 x i32> @test12_1(<4 x i32*>) argmemonly nounwind
-define <4 x i32> @test12_2(<4 x i32*> %ptrs) {
+declare <4 x i32> @test12_1(<4 x ptr>) argmemonly nounwind
+define <4 x i32> @test12_2(<4 x ptr> %ptrs) {
; CHECK: Function Attrs: argmemonly nounwind
; CHECK-LABEL: define {{[^@]+}}@test12_2
-; CHECK-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR12:[0-9]+]] {
-; CHECK-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x i32*> [[PTRS]])
+; CHECK-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR12:[0-9]+]] {
+; CHECK-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]])
; CHECK-NEXT: ret <4 x i32> [[RES]]
;
- %res = call <4 x i32> @test12_1(<4 x i32*> %ptrs)
+ %res = call <4 x i32> @test12_1(<4 x ptr> %ptrs)
ret <4 x i32> %res
}
-define i32 @volatile_load(i32* %p) {
+define i32 @volatile_load(ptr %p) {
; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@volatile_load
-; CHECK-SAME: (i32* [[P:%.*]]) #[[ATTR13:[0-9]+]] {
-; CHECK-NEXT: [[LOAD:%.*]] = load volatile i32, i32* [[P]], align 4
+; CHECK-SAME: (ptr [[P:%.*]]) #[[ATTR13:[0-9]+]] {
+; CHECK-NEXT: [[LOAD:%.*]] = load volatile i32, ptr [[P]], align 4
; CHECK-NEXT: ret i32 [[LOAD]]
;
- %load = load volatile i32, i32* %p
+ %load = load volatile i32, ptr %p
ret i32 %load
}
-declare void @escape_readnone_ptr(i8** %addr, i8* readnone %ptr)
-declare void @escape_readonly_ptr(i8** %addr, i8* readonly %ptr)
+declare void @escape_readnone_ptr(ptr %addr, ptr readnone %ptr)
+declare void @escape_readonly_ptr(ptr %addr, ptr readonly %ptr)
; The argument pointer %escaped_then_written cannot be marked readnone/only even
; though the only direct use, in @escape_readnone_ptr/@escape_readonly_ptr,
; is marked as readnone/only. However, the functions can write the pointer into
; %addr, causing the store to write to %escaped_then_written.
-define void @unsound_readnone(i8* %ignored, i8* %escaped_then_written) {
+define void @unsound_readnone(ptr %ignored, ptr %escaped_then_written) {
; CHECK-LABEL: define {{[^@]+}}@unsound_readnone
-; CHECK-SAME: (i8* nocapture readnone [[IGNORED:%.*]], i8* [[ESCAPED_THEN_WRITTEN:%.*]]) {
-; CHECK-NEXT: [[ADDR:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: call void @escape_readnone_ptr(i8** [[ADDR]], i8* [[ESCAPED_THEN_WRITTEN]])
-; CHECK-NEXT: [[ADDR_LD:%.*]] = load i8*, i8** [[ADDR]], align 8
-; CHECK-NEXT: store i8 0, i8* [[ADDR_LD]], align 1
+; CHECK-SAME: (ptr nocapture readnone [[IGNORED:%.*]], ptr [[ESCAPED_THEN_WRITTEN:%.*]]) {
+; CHECK-NEXT: [[ADDR:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: call void @escape_readnone_ptr(ptr [[ADDR]], ptr [[ESCAPED_THEN_WRITTEN]])
+; CHECK-NEXT: [[ADDR_LD:%.*]] = load ptr, ptr [[ADDR]], align 8
+; CHECK-NEXT: store i8 0, ptr [[ADDR_LD]], align 1
; CHECK-NEXT: ret void
;
- %addr = alloca i8*
- call void @escape_readnone_ptr(i8** %addr, i8* %escaped_then_written)
- %addr.ld = load i8*, i8** %addr
- store i8 0, i8* %addr.ld
+ %addr = alloca ptr
+ call void @escape_readnone_ptr(ptr %addr, ptr %escaped_then_written)
+ %addr.ld = load ptr, ptr %addr
+ store i8 0, ptr %addr.ld
ret void
}
-define void @unsound_readonly(i8* %ignored, i8* %escaped_then_written) {
+define void @unsound_readonly(ptr %ignored, ptr %escaped_then_written) {
; CHECK-LABEL: define {{[^@]+}}@unsound_readonly
-; CHECK-SAME: (i8* nocapture readnone [[IGNORED:%.*]], i8* [[ESCAPED_THEN_WRITTEN:%.*]]) {
-; CHECK-NEXT: [[ADDR:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: call void @escape_readonly_ptr(i8** [[ADDR]], i8* [[ESCAPED_THEN_WRITTEN]])
-; CHECK-NEXT: [[ADDR_LD:%.*]] = load i8*, i8** [[ADDR]], align 8
-; CHECK-NEXT: store i8 0, i8* [[ADDR_LD]], align 1
+; CHECK-SAME: (ptr nocapture readnone [[IGNORED:%.*]], ptr [[ESCAPED_THEN_WRITTEN:%.*]]) {
+; CHECK-NEXT: [[ADDR:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: call void @escape_readonly_ptr(ptr [[ADDR]], ptr [[ESCAPED_THEN_WRITTEN]])
+; CHECK-NEXT: [[ADDR_LD:%.*]] = load ptr, ptr [[ADDR]], align 8
+; CHECK-NEXT: store i8 0, ptr [[ADDR_LD]], align 1
; CHECK-NEXT: ret void
;
- %addr = alloca i8*
- call void @escape_readonly_ptr(i8** %addr, i8* %escaped_then_written)
- %addr.ld = load i8*, i8** %addr
- store i8 0, i8* %addr.ld
+ %addr = alloca ptr
+ call void @escape_readonly_ptr(ptr %addr, ptr %escaped_then_written)
+ %addr.ld = load ptr, ptr %addr
+ store i8 0, ptr %addr.ld
ret void
}
-define void @fptr_test1a(i8* %p, void (i8*)* %f) {
+define void @fptr_test1a(ptr %p, ptr %f) {
; CHECK-LABEL: define {{[^@]+}}@fptr_test1a
-; CHECK-SAME: (i8* nocapture readnone [[P:%.*]], void (i8*)* nocapture readonly [[F:%.*]]) {
-; CHECK-NEXT: call void [[F]](i8* nocapture readnone [[P]])
+; CHECK-SAME: (ptr nocapture readnone [[P:%.*]], ptr nocapture readonly [[F:%.*]]) {
+; CHECK-NEXT: call void [[F]](ptr nocapture readnone [[P]])
; CHECK-NEXT: ret void
;
- call void %f(i8* nocapture readnone %p)
+ call void %f(ptr nocapture readnone %p)
ret void
}
; Can't infer readnone here because call might capture %p
-define void @fptr_test1b(i8* %p, void (i8*)* %f) {
+define void @fptr_test1b(ptr %p, ptr %f) {
; CHECK-LABEL: define {{[^@]+}}@fptr_test1b
-; CHECK-SAME: (i8* [[P:%.*]], void (i8*)* nocapture readonly [[F:%.*]]) {
-; CHECK-NEXT: call void [[F]](i8* readnone [[P]])
+; CHECK-SAME: (ptr [[P:%.*]], ptr nocapture readonly [[F:%.*]]) {
+; CHECK-NEXT: call void [[F]](ptr readnone [[P]])
; CHECK-NEXT: ret void
;
- call void %f(i8* readnone %p)
+ call void %f(ptr readnone %p)
ret void
}
-define void @fptr_test1c(i8* %p, void (i8*)* %f) {
+define void @fptr_test1c(ptr %p, ptr %f) {
; CHECK: Function Attrs: nofree readonly
; CHECK-LABEL: define {{[^@]+}}@fptr_test1c
-; CHECK-SAME: (i8* readnone [[P:%.*]], void (i8*)* nocapture readonly [[F:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT: call void [[F]](i8* readnone [[P]]) #[[ATTR2:[0-9]+]]
+; CHECK-SAME: (ptr readnone [[P:%.*]], ptr nocapture readonly [[F:%.*]]) #[[ATTR3]] {
+; CHECK-NEXT: call void [[F]](ptr readnone [[P]]) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: ret void
;
- call void %f(i8* readnone %p) readonly
+ call void %f(ptr readnone %p) readonly
ret void
}
-define void @fptr_test2a(i8* %p, void (i8*)* %f) {
+define void @fptr_test2a(ptr %p, ptr %f) {
; CHECK-LABEL: define {{[^@]+}}@fptr_test2a
-; CHECK-SAME: (i8* nocapture readonly [[P:%.*]], void (i8*)* nocapture readonly [[F:%.*]]) {
-; CHECK-NEXT: call void [[F]](i8* nocapture readonly [[P]])
+; CHECK-SAME: (ptr nocapture readonly [[P:%.*]], ptr nocapture readonly [[F:%.*]]) {
+; CHECK-NEXT: call void [[F]](ptr nocapture readonly [[P]])
; CHECK-NEXT: ret void
;
- call void %f(i8* nocapture readonly %p)
+ call void %f(ptr nocapture readonly %p)
ret void
}
-define void @fptr_test2b(i8* %p, void (i8*)* %f) {
+define void @fptr_test2b(ptr %p, ptr %f) {
; Can't infer readonly here because call might capture %p
; CHECK-LABEL: define {{[^@]+}}@fptr_test2b
-; CHECK-SAME: (i8* [[P:%.*]], void (i8*)* nocapture readonly [[F:%.*]]) {
-; CHECK-NEXT: call void [[F]](i8* readonly [[P]])
+; CHECK-SAME: (ptr [[P:%.*]], ptr nocapture readonly [[F:%.*]]) {
+; CHECK-NEXT: call void [[F]](ptr readonly [[P]])
; CHECK-NEXT: ret void
;
- call void %f(i8* readonly %p)
+ call void %f(ptr readonly %p)
ret void
}
-define void @fptr_test2c(i8* %p, void (i8*)* %f) {
+define void @fptr_test2c(ptr %p, ptr %f) {
; CHECK: Function Attrs: nofree readonly
; CHECK-LABEL: define {{[^@]+}}@fptr_test2c
-; CHECK-SAME: (i8* readonly [[P:%.*]], void (i8*)* nocapture readonly [[F:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT: call void [[F]](i8* readonly [[P]]) #[[ATTR2]]
+; CHECK-SAME: (ptr readonly [[P:%.*]], ptr nocapture readonly [[F:%.*]]) #[[ATTR3]] {
+; CHECK-NEXT: call void [[F]](ptr readonly [[P]]) #[[ATTR2]]
; CHECK-NEXT: ret void
;
- call void %f(i8* readonly %p) readonly
+ call void %f(ptr readonly %p) readonly
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/readnone.ll b/llvm/test/Transforms/FunctionAttrs/readnone.ll
index aa074b3da11f..c5bd5b948825 100644
--- a/llvm/test/Transforms/FunctionAttrs/readnone.ll
+++ b/llvm/test/Transforms/FunctionAttrs/readnone.ll
@@ -1,14 +1,14 @@
; RUN: opt < %s -function-attrs -S | FileCheck %s
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
-; CHECK: define void @bar(i8* nocapture readnone %0)
-define void @bar(i8* readonly %0) {
- call void @foo(i8* %0)
+; CHECK: define void @bar(ptr nocapture readnone %0)
+define void @bar(ptr readonly %0) {
+ call void @foo(ptr %0)
ret void
}
-; CHECK: define void @foo(i8* nocapture readnone %0)
-define void @foo(i8* readonly %0) {
- call void @bar(i8* %0)
+; CHECK: define void @foo(ptr nocapture readnone %0)
+define void @foo(ptr readonly %0) {
+ call void @bar(ptr %0)
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/stats.ll b/llvm/test/Transforms/FunctionAttrs/stats.ll
index 2c26f7e7db05..2f36939846d2 100644
--- a/llvm/test/Transforms/FunctionAttrs/stats.ll
+++ b/llvm/test/Transforms/FunctionAttrs/stats.ll
@@ -4,15 +4,15 @@
@g = global i32 20
-define i32 @test_only_read_arg(i32* %ptr) {
+define i32 @test_only_read_arg(ptr %ptr) {
entry:
- %l = load i32, i32* %ptr
+ %l = load i32, ptr %ptr
ret i32 %l
}
define void @test_write_global() {
entry:
- store i32 0, i32* @g
+ store i32 0, ptr @g
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll b/llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
index b1e20cfd9059..304c415951c6 100644
--- a/llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
+++ b/llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
@@ -2,42 +2,42 @@
declare void @decl_readonly() readonly
declare void @decl_readnone() readnone
-declare void @decl_argmemonly(i32*) argmemonly
+declare void @decl_argmemonly(ptr) argmemonly
declare void @decl_unknown()
-define void @test_fn_mustprogress(i32* %ptr) mustprogress {
+define void @test_fn_mustprogress(ptr %ptr) mustprogress {
; CHECK: Function Attrs: mustprogress
; CHECK-LABEL: @test_fn_mustprogress(
; CHECK-NOT: call void @decl_readonly() #
; CHECK-NOT: call void @decl_readnone() #
; CHECK-NOT: call void @decl_unknown() #
-; CHECK-NOT: call void @decl_argmemonly(i32* [[PTR:%.*]]) #
+; CHECK-NOT: call void @decl_argmemonly(ptr [[PTR:%.*]]) #
; CHECK: ret void
;
call void @decl_readonly()
call void @decl_readnone()
call void @decl_unknown()
- call void @decl_argmemonly(i32* %ptr)
+ call void @decl_argmemonly(ptr %ptr)
ret void
}
-define void @test_fn_willreturn(i32* %ptr) willreturn {
+define void @test_fn_willreturn(ptr %ptr) willreturn {
; CHECK: Function Attrs: mustprogress willreturn
; CHECK-LABEL: @test_fn_willreturn(
; CHECK-NOT: call void @decl_readonly() #
; CHECK-NOT: call void @decl_readnone() #
; CHECK-NOT: call void @decl_unknown() #
-; CHECK-NOT: call void @decl_argmemonly(i32* [[PTR:%.*]]) #
+; CHECK-NOT: call void @decl_argmemonly(ptr [[PTR:%.*]]) #
; CHECK: ret void
;
call void @decl_readonly()
call void @decl_readnone()
call void @decl_unknown()
- call void @decl_argmemonly(i32* %ptr)
+ call void @decl_argmemonly(ptr %ptr)
ret void
}
-define void @test_fn_mustprogress_readonly_calls(i32* %ptr) mustprogress {
+define void @test_fn_mustprogress_readonly_calls(ptr %ptr) mustprogress {
; CHECK: Function Attrs: mustprogress nofree readonly willreturn
; CHECK-LABEL: @test_fn_mustprogress_readonly_calls(
; CHECK-NOT: call void @decl_readonly() #
@@ -49,16 +49,16 @@ define void @test_fn_mustprogress_readonly_calls(i32* %ptr) mustprogress {
ret void
}
-define void @test_fn_mustprogress_readonly_calls_but_stores(i32* %ptr) mustprogress {
+define void @test_fn_mustprogress_readonly_calls_but_stores(ptr %ptr) mustprogress {
; CHECK: Function Attrs: mustprogress nofree
; CHECK-LABEL: @test_fn_mustprogress_readonly_calls_but_stores(
; CHECK-NOT: call void @decl_readonly() #
; CHECK-NOT: call void @decl_readnone() #
-; CHECK: store i32 0, i32* [[PTR:%.*]], align 4
+; CHECK: store i32 0, ptr [[PTR:%.*]], align 4
; CHECK-NEXT: ret void
;
call void @decl_readonly()
call void @decl_readnone()
- store i32 0, i32* %ptr
+ store i32 0, ptr %ptr
ret void
}
diff --git a/llvm/test/Transforms/FunctionAttrs/willreturn.ll b/llvm/test/Transforms/FunctionAttrs/willreturn.ll
index 0465311926ac..f45f59f82e46 100644
--- a/llvm/test/Transforms/FunctionAttrs/willreturn.ll
+++ b/llvm/test/Transforms/FunctionAttrs/willreturn.ll
@@ -11,7 +11,7 @@ while.body:
br label %while.body
}
-define i32 @mustprogress_load(i32* %ptr) mustprogress {
+define i32 @mustprogress_load(ptr %ptr) mustprogress {
; CHECK: Function Attrs: {{.*}} readonly willreturn
; CHECK-NEXT: define i32 @mustprogress_load(
;
@@ -19,11 +19,11 @@ entry:
br label %while.body
while.body:
- %r = load i32, i32* %ptr
+ %r = load i32, ptr %ptr
br label %while.body
}
-define void @mustprogress_store(i32* %ptr) mustprogress {
+define void @mustprogress_store(ptr %ptr) mustprogress {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define void @mustprogress_store(
;
@@ -31,7 +31,7 @@ entry:
br label %while.body
while.body:
- store i32 0, i32* %ptr
+ store i32 0, ptr %ptr
br label %while.body
}
@@ -45,18 +45,18 @@ define void @mustprogress_call_unknown_fn() mustprogress {
ret void
}
-define i32 @mustprogress_call_known_functions(i32* %ptr) mustprogress {
+define i32 @mustprogress_call_known_functions(ptr %ptr) mustprogress {
; CHECK: Function Attrs: {{.*}} readonly willreturn
; CHECK-NEXT: define i32 @mustprogress_call_known_functions(
;
call void @mustprogress_readnone()
- %r = call i32 @mustprogress_load(i32* %ptr)
+ %r = call i32 @mustprogress_load(ptr %ptr)
ret i32 %r
}
declare i32 @__gxx_personality_v0(...)
-define i64 @mustprogress_mayunwind() mustprogress personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define i64 @mustprogress_mayunwind() mustprogress personality ptr @__gxx_personality_v0 {
; CHECK: Function Attrs: {{.*}} readnone willreturn
; CHECK-NEXT: define i64 @mustprogress_mayunwind(
;
@@ -66,25 +66,25 @@ A:
ret i64 10
B:
- %val = landingpad { i8*, i32 }
- catch i8* null
+ %val = landingpad { ptr, i32 }
+ catch ptr null
ret i64 0
}
; Function without loops or non-willreturn calls will return.
-define void @willreturn_no_loop(i1 %c, i32* %p) {
+define void @willreturn_no_loop(i1 %c, ptr %p) {
; CHECK: Function Attrs: mustprogress willreturn
; CHECK-NEXT: define void @willreturn_no_loop(
;
br i1 %c, label %if, label %else
if:
- load atomic i32, i32* %p seq_cst, align 4
+ load atomic i32, ptr %p seq_cst, align 4
call void @fn_willreturn()
br label %end
else:
- store atomic i32 0, i32* %p seq_cst, align 4
+ store atomic i32 0, ptr %p seq_cst, align 4
br label %end
end:
@@ -92,7 +92,7 @@ end:
}
; Calls a function that is not guaranteed to return, not willreturn.
-define void @willreturn_non_returning_function(i1 %c, i32* %p) {
+define void @willreturn_non_returning_function(i1 %c, ptr %p) {
; CHECK-NOT: Function Attrs: {{.*}}willreturn
; CHECK: define void @willreturn_non_returning_function(
;
diff --git a/llvm/test/Transforms/FunctionAttrs/writeonly.ll b/llvm/test/Transforms/FunctionAttrs/writeonly.ll
index e3aa04d4de2c..ea9007758ef0 100644
--- a/llvm/test/Transforms/FunctionAttrs/writeonly.ll
+++ b/llvm/test/Transforms/FunctionAttrs/writeonly.ll
@@ -1,126 +1,125 @@
; RUN: opt < %s -function-attrs -S | FileCheck %s
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
-; CHECK: define void @nouses-argworn-funrn(i32* nocapture readnone %.aaa) #0 {
-define void @nouses-argworn-funrn(i32* writeonly %.aaa) {
+; CHECK: define void @nouses-argworn-funrn(ptr nocapture readnone %.aaa) #0 {
+define void @nouses-argworn-funrn(ptr writeonly %.aaa) {
nouses-argworn-funrn_entry:
ret void
}
-; CHECK: define void @nouses-argworn-funro(i32* nocapture readnone %.aaa, i32* nocapture readonly %.bbb) #1 {
-define void @nouses-argworn-funro(i32* writeonly %.aaa, i32* %.bbb) {
+; CHECK: define void @nouses-argworn-funro(ptr nocapture readnone %.aaa, ptr nocapture readonly %.bbb) #1 {
+define void @nouses-argworn-funro(ptr writeonly %.aaa, ptr %.bbb) {
nouses-argworn-funro_entry:
- %val = load i32 , i32* %.bbb
+ %val = load i32 , ptr %.bbb
ret void
}
-%_type_of_d-ccc = type <{ i8*, i8, i8, i8, i8 }>
+%_type_of_d-ccc = type <{ ptr, i8, i8, i8, i8 }>
- at d-ccc = internal global %_type_of_d-ccc <{ i8* null, i8 1, i8 13, i8 0, i8 -127 }>, align 8
+ at d-ccc = internal global %_type_of_d-ccc <{ ptr null, i8 1, i8 13, i8 0, i8 -127 }>, align 8
-; CHECK: define void @nouses-argworn-funwo(i32* nocapture readnone %.aaa) #2 {
-define void @nouses-argworn-funwo(i32* writeonly %.aaa) {
+; CHECK: define void @nouses-argworn-funwo(ptr nocapture readnone %.aaa) #2 {
+define void @nouses-argworn-funwo(ptr writeonly %.aaa) {
nouses-argworn-funwo_entry:
- store i8 0, i8* getelementptr inbounds (%_type_of_d-ccc, %_type_of_d-ccc* @d-ccc, i32 0, i32 3)
+ store i8 0, ptr getelementptr inbounds (%_type_of_d-ccc, ptr @d-ccc, i32 0, i32 3)
ret void
}
-; CHECK: define void @test_store(i8* nocapture writeonly %p)
-define void @test_store(i8* %p) {
- store i8 0, i8* %p
+; CHECK: define void @test_store(ptr nocapture writeonly %p)
+define void @test_store(ptr %p) {
+ store i8 0, ptr %p
ret void
}
- at G = external global i8*
-; CHECK: define i8 @test_store_capture(i8* %p)
-define i8 @test_store_capture(i8* %p) {
- store i8* %p, i8** @G
- %p2 = load i8*, i8** @G
- %v = load i8, i8* %p2
+ at G = external global ptr
+; CHECK: define i8 @test_store_capture(ptr %p)
+define i8 @test_store_capture(ptr %p) {
+ store ptr %p, ptr @G
+ %p2 = load ptr, ptr @G
+ %v = load i8, ptr %p2
ret i8 %v
}
-; CHECK: define void @test_addressing(i8* nocapture writeonly %p)
-define void @test_addressing(i8* %p) {
- %gep = getelementptr i8, i8* %p, i64 8
- %bitcast = bitcast i8* %gep to i32*
- store i32 0, i32* %bitcast
+; CHECK: define void @test_addressing(ptr nocapture writeonly %p)
+define void @test_addressing(ptr %p) {
+ %gep = getelementptr i8, ptr %p, i64 8
+ store i32 0, ptr %gep
ret void
}
-; CHECK: define void @test_readwrite(i8* nocapture %p)
-define void @test_readwrite(i8* %p) {
- %v = load i8, i8* %p
- store i8 %v, i8* %p
+; CHECK: define void @test_readwrite(ptr nocapture %p)
+define void @test_readwrite(ptr %p) {
+ %v = load i8, ptr %p
+ store i8 %v, ptr %p
ret void
}
-; CHECK: define void @test_volatile(i8* %p)
-define void @test_volatile(i8* %p) {
- store volatile i8 0, i8* %p
+; CHECK: define void @test_volatile(ptr %p)
+define void @test_volatile(ptr %p) {
+ store volatile i8 0, ptr %p
ret void
}
-; CHECK: define void @test_atomicrmw(i8* nocapture %p)
-define void @test_atomicrmw(i8* %p) {
- atomicrmw add i8* %p, i8 0 seq_cst
+; CHECK: define void @test_atomicrmw(ptr nocapture %p)
+define void @test_atomicrmw(ptr %p) {
+ atomicrmw add ptr %p, i8 0 seq_cst
ret void
}
-declare void @direct1_callee(i8* %p)
+declare void @direct1_callee(ptr %p)
-; CHECK: define void @direct1(i8* %p)
-define void @direct1(i8* %p) {
- call void @direct1_callee(i8* %p)
+; CHECK: define void @direct1(ptr %p)
+define void @direct1(ptr %p) {
+ call void @direct1_callee(ptr %p)
ret void
}
-declare void @direct2_callee(i8* %p) writeonly
+declare void @direct2_callee(ptr %p) writeonly
; writeonly w/o nocapture is not enough
-; CHECK: define void @direct2(i8* %p)
-define void @direct2(i8* %p) {
- call void @direct2_callee(i8* %p)
+; CHECK: define void @direct2(ptr %p)
+define void @direct2(ptr %p) {
+ call void @direct2_callee(ptr %p)
; read back from global, read through pointer...
ret void
}
-; CHECK: define void @direct2b(i8* nocapture writeonly %p)
-define void @direct2b(i8* %p) {
- call void @direct2_callee(i8* nocapture %p)
+; CHECK: define void @direct2b(ptr nocapture writeonly %p)
+define void @direct2b(ptr %p) {
+ call void @direct2_callee(ptr nocapture %p)
ret void
}
-declare void @direct3_callee(i8* nocapture writeonly %p)
+declare void @direct3_callee(ptr nocapture writeonly %p)
-; CHECK: define void @direct3(i8* nocapture writeonly %p)
-define void @direct3(i8* %p) {
- call void @direct3_callee(i8* %p)
+; CHECK: define void @direct3(ptr nocapture writeonly %p)
+define void @direct3(ptr %p) {
+ call void @direct3_callee(ptr %p)
ret void
}
-; CHECK: define void @direct3b(i8* %p)
-define void @direct3b(i8* %p) {
- call void @direct3_callee(i8* %p) ["may-read-and-capture"(i8* %p)]
+; CHECK: define void @direct3b(ptr %p)
+define void @direct3b(ptr %p) {
+ call void @direct3_callee(ptr %p) ["may-read-and-capture"(ptr %p)]
ret void
}
-; CHECK: define void @fptr_test1(i8* %p, void (i8*)* nocapture readonly %f)
-define void @fptr_test1(i8* %p, void (i8*)* %f) {
- call void %f(i8* %p)
+; CHECK: define void @fptr_test1(ptr %p, ptr nocapture readonly %f)
+define void @fptr_test1(ptr %p, ptr %f) {
+ call void %f(ptr %p)
ret void
}
-; CHECK: define void @fptr_test2(i8* nocapture writeonly %p, void (i8*)* nocapture readonly %f)
-define void @fptr_test2(i8* %p, void (i8*)* %f) {
- call void %f(i8* nocapture writeonly %p)
+; CHECK: define void @fptr_test2(ptr nocapture writeonly %p, ptr nocapture readonly %f)
+define void @fptr_test2(ptr %p, ptr %f) {
+ call void %f(ptr nocapture writeonly %p)
ret void
}
-; CHECK: define void @fptr_test3(i8* nocapture writeonly %p, void (i8*)* nocapture readonly %f)
-define void @fptr_test3(i8* %p, void (i8*)* %f) {
- call void %f(i8* nocapture %p) writeonly
+; CHECK: define void @fptr_test3(ptr nocapture writeonly %p, ptr nocapture readonly %f)
+define void @fptr_test3(ptr %p, ptr %f) {
+ call void %f(ptr nocapture %p) writeonly
ret void
}
More information about the llvm-commits
mailing list