[llvm] e472cf7 - LowerConstantIntrinsics: Convert tests to opaque pointers
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 06:08:41 PST 2022
Author: Matt Arsenault
Date: 2022-11-28T09:08:31-05:00
New Revision: e472cf7f1048e164a8a21d396a761e23511d4994
URL: https://github.com/llvm/llvm-project/commit/e472cf7f1048e164a8a21d396a761e23511d4994
DIFF: https://github.com/llvm/llvm-project/commit/e472cf7f1048e164a8a21d396a761e23511d4994.diff
LOG: LowerConstantIntrinsics: Convert tests to opaque pointers
Added:
Modified:
llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-load.ll
llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll
llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-posix-memalign.ll
llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll
llvm/test/Transforms/LowerConstantIntrinsics/crash-on-large-allocas.ll
llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll
llvm/test/Transforms/LowerConstantIntrinsics/stale-worklist-phi.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-load.ll b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-load.ll
index dc3738cdada3e..cde431221cd06 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-load.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-load.ll
@@ -4,7 +4,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg)
+declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg)
define dso_local i64 @check_store_load(i1 %cond) local_unnamed_addr {
@@ -13,33 +13,31 @@ define dso_local i64 @check_store_load(i1 %cond) local_unnamed_addr {
; CHECK-NEXT: [[PTR01:%.*]] = alloca [10 x i8], align 1
; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: [[PTR01_SUB:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[PTR01]], i64 0, i64 0
; CHECK-NEXT: br label [[RETURN:%.*]]
; CHECK: if.end:
; CHECK-NEXT: [[PTR12:%.*]] = alloca [12 x i8], align 1
-; CHECK-NEXT: [[PTR12_SUB:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[PTR12]], i64 0, i64 0
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
-; CHECK-NEXT: [[STOREMERGE:%.*]] = phi i8* [ [[PTR12_SUB]], [[IF_END]] ], [ [[PTR01_SUB]], [[IF_THEN]] ]
+; CHECK-NEXT: [[STOREMERGE:%.*]] = phi ptr [ [[PTR12]], [[IF_END]] ], [ [[PTR01]], [[IF_THEN]] ]
; CHECK-NEXT: ret i64 12
;
entry:
- %holder = alloca i8*
+ %holder = alloca ptr
%ptr0 = alloca i8, i64 10
br i1 %cond, label %if.then, label %if.end
if.then:
- store i8* %ptr0, i8** %holder
+ store ptr %ptr0, ptr %holder
br label %return
if.end:
%ptr1 = alloca i8, i64 12
- store i8* %ptr1, i8** %holder
+ store ptr %ptr1, ptr %holder
br label %return
return:
- %held = load i8*, i8** %holder
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %held, i1 false, i1 true, i1 false)
+ %held = load ptr, ptr %holder
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %held, i1 false, i1 true, i1 false)
ret i64 %objsize
}
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll
index 31a4a6156fe02..8376af4884faf 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll
@@ -5,8 +5,8 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr allocsize(0)
-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg)
+declare dso_local noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr allocsize(0)
+declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg)
@buffer = dso_local global [4 x i8] zeroinitializer, align 1
@@ -16,10 +16,10 @@ define dso_local i64 @pick_max(i32 noundef %n) local_unnamed_addr {
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[N:%.*]], 0
; CHECK-NEXT: br i1 [[COND]], label [[IF_ELSE:%.*]], label [[IF_END:%.*]]
; CHECK: if.else:
-; CHECK-NEXT: [[MALLOCED:%.*]] = call noalias dereferenceable_or_null(8) i8* @malloc(i64 noundef 8)
+; CHECK-NEXT: [[MALLOCED:%.*]] = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8)
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
-; CHECK-NEXT: [[P:%.*]] = phi i8* [ [[MALLOCED]], [[IF_ELSE]] ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @buffer, i64 0, i64 0), [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[P:%.*]] = phi ptr [ [[MALLOCED]], [[IF_ELSE]] ], [ @buffer, [[ENTRY:%.*]] ]
; CHECK-NEXT: ret i64 8
;
entry:
@@ -27,12 +27,12 @@ entry:
br i1 %cond, label %if.else, label %if.end
if.else:
- %malloced = call noalias dereferenceable_or_null(8) i8* @malloc(i64 noundef 8)
+ %malloced = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8)
br label %if.end
if.end:
- %p = phi i8* [ %malloced, %if.else ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @buffer, i64 0, i64 0), %entry ]
- %size = call i64 @llvm.objectsize.i64.p0i8(i8* %p, i1 false, i1 true, i1 false)
+ %p = phi ptr [ %malloced, %if.else ], [ @buffer, %entry ]
+ %size = call i64 @llvm.objectsize.i64.p0(ptr %p, i1 false, i1 true, i1 false)
ret i64 %size
}
@@ -42,10 +42,10 @@ define dso_local i64 @pick_min(i32 noundef %n) local_unnamed_addr {
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[N:%.*]], 0
; CHECK-NEXT: br i1 [[COND]], label [[IF_ELSE:%.*]], label [[IF_END:%.*]]
; CHECK: if.else:
-; CHECK-NEXT: [[MALLOCED:%.*]] = call noalias dereferenceable_or_null(8) i8* @malloc(i64 noundef 8)
+; CHECK-NEXT: [[MALLOCED:%.*]] = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8)
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
-; CHECK-NEXT: [[P:%.*]] = phi i8* [ [[MALLOCED]], [[IF_ELSE]] ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @buffer, i64 0, i64 0), [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[P:%.*]] = phi ptr [ [[MALLOCED]], [[IF_ELSE]] ], [ @buffer, [[ENTRY:%.*]] ]
; CHECK-NEXT: ret i64 4
;
entry:
@@ -53,11 +53,11 @@ entry:
br i1 %cond, label %if.else, label %if.end
if.else:
- %malloced = call noalias dereferenceable_or_null(8) i8* @malloc(i64 noundef 8)
+ %malloced = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8)
br label %if.end
if.end:
- %p = phi i8* [ %malloced, %if.else ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @buffer, i64 0, i64 0), %entry ]
- %size = call i64 @llvm.objectsize.i64.p0i8(i8* %p, i1 true, i1 true, i1 false)
+ %p = phi ptr [ %malloced, %if.else ], [ @buffer, %entry ]
+ %size = call i64 @llvm.objectsize.i64.p0(ptr %p, i1 true, i1 true, i1 false)
ret i64 %size
}
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-posix-memalign.ll b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-posix-memalign.ll
index 365c3b66558f5..5e71dedc3572d 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-posix-memalign.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-posix-memalign.ll
@@ -4,15 +4,15 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare dso_local i32 @posix_memalign(i8** noundef, i64 noundef, i64 noundef)
-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg)
+declare dso_local i32 @posix_memalign(ptr noundef, i64 noundef, i64 noundef)
+declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg)
; Check posix_memalign call with proper handlig of return value
define dso_local i64 @check_posix_memalign(i32 noundef %n) local_unnamed_addr {
; CHECK-LABEL: @check_posix_memalign(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OBJ:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[OBJ:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CALL]], 0
; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[EXIT:%.*]]
; CHECK: cond.false:
@@ -22,14 +22,14 @@ define dso_local i64 @check_posix_memalign(i32 noundef %n) local_unnamed_addr {
; CHECK-NEXT: ret i64 [[COND]]
;
entry:
- %obj = alloca i8*
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
+ %obj = alloca ptr
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
%tobool = icmp ne i32 %call, 0
br i1 %tobool, label %exit, label %cond.false
cond.false:
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
br label %exit
exit:
@@ -43,9 +43,9 @@ exit:
define dso_local i64 @check_posix_memalign_null() {
; CHECK-LABEL: @check_posix_memalign_null(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OBJ:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: store i8* null, i8** [[OBJ]], align 8
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[OBJ:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: store ptr null, ptr [[OBJ]], align 8
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CALL]], 0
; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[EXIT:%.*]]
; CHECK: cond.false:
@@ -55,15 +55,15 @@ define dso_local i64 @check_posix_memalign_null() {
; CHECK-NEXT: ret i64 [[COND]]
;
entry:
- %obj = alloca i8*
- store i8* null, i8** %obj
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
+ %obj = alloca ptr
+ store ptr null, ptr %obj
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
%tobool = icmp ne i32 %call, 0
br i1 %tobool, label %exit, label %cond.false
cond.false:
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
br label %exit
exit:
@@ -72,10 +72,10 @@ exit:
}
; Using argument storage instead of local storage for the allocated pointer.
-define dso_local i64 @check_posix_memalign_arg(i8** noalias noundef %obj) {
+define dso_local i64 @check_posix_memalign_arg(ptr noalias noundef %obj) {
; CHECK-LABEL: @check_posix_memalign_arg(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef [[OBJ:%.*]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef [[OBJ:%.*]], i64 noundef 8, i64 noundef 10)
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CALL]], 0
; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[EXIT:%.*]]
; CHECK: cond.false:
@@ -85,13 +85,13 @@ define dso_local i64 @check_posix_memalign_arg(i8** noalias noundef %obj) {
; CHECK-NEXT: ret i64 [[COND]]
;
entry:
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
%tobool = icmp ne i32 %call, 0
br i1 %tobool, label %exit, label %cond.false
cond.false:
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
br label %exit
exit:
@@ -104,16 +104,16 @@ exit:
define dso_local i64 @check_posix_memalign_unchecked() {
; CHECK-LABEL: @check_posix_memalign_unchecked(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OBJ:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
-; CHECK-NEXT: [[VAL:%.*]] = load i8*, i8** [[OBJ]], align 8
+; CHECK-NEXT: [[OBJ:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[VAL:%.*]] = load ptr, ptr [[OBJ]], align 8
; CHECK-NEXT: ret i64 -1
;
entry:
- %obj = alloca i8*
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %obj = alloca ptr
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
ret i64 %objsize
}
@@ -121,28 +121,28 @@ entry:
define dso_local i64 @check_posix_memalign_inverted_cond() {
; CHECK-LABEL: @check_posix_memalign_inverted_cond(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OBJ:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: store i8* null, i8** [[OBJ]], align 8
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[OBJ:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: store ptr null, ptr [[OBJ]], align 8
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[CALL]], 0
; CHECK-NEXT: br i1 [[TOBOOL]], label [[EXIT:%.*]], label [[COND_FALSE:%.*]]
; CHECK: cond.false:
-; CHECK-NEXT: [[VAL:%.*]] = load i8*, i8** [[OBJ]], align 8
+; CHECK-NEXT: [[VAL:%.*]] = load ptr, ptr [[OBJ]], align 8
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: [[COND:%.*]] = phi i64 [ -2, [[ENTRY:%.*]] ], [ -1, [[COND_FALSE]] ]
; CHECK-NEXT: ret i64 [[COND]]
;
entry:
- %obj = alloca i8*
- store i8* null, i8** %obj
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
+ %obj = alloca ptr
+ store ptr null, ptr %obj
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
%tobool = icmp eq i32 %call, 0
br i1 %tobool, label %exit, label %cond.false
cond.false:
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
br label %exit
exit:
@@ -154,26 +154,26 @@ exit:
define dso_local i64 @check_posix_memalign_runtime_cond(i32 noundef %n) local_unnamed_addr {
; CHECK-LABEL: @check_posix_memalign_runtime_cond(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OBJ:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[OBJ:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CALL]], [[N:%.*]]
; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[EXIT:%.*]]
; CHECK: cond.false:
-; CHECK-NEXT: [[VAL:%.*]] = load i8*, i8** [[OBJ]], align 8
+; CHECK-NEXT: [[VAL:%.*]] = load ptr, ptr [[OBJ]], align 8
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: [[COND:%.*]] = phi i64 [ -2, [[ENTRY:%.*]] ], [ -1, [[COND_FALSE]] ]
; CHECK-NEXT: ret i64 [[COND]]
;
entry:
- %obj = alloca i8*
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
+ %obj = alloca ptr
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
%tobool = icmp ne i32 %call, %n
br i1 %tobool, label %exit, label %cond.false
cond.false:
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
br label %exit
exit:
@@ -186,8 +186,8 @@ exit:
define dso_local i64 @check_posix_memalign_diamond() local_unnamed_addr {
; CHECK-LABEL: @check_posix_memalign_diamond(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OBJ:%.*]] = alloca i8*, align 8
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(i8** noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
+; CHECK-NEXT: [[OBJ:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @posix_memalign(ptr noundef nonnull [[OBJ]], i64 noundef 8, i64 noundef 10)
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CALL]], 0
; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[COND_TRUE:%.*]]
; CHECK: cond.true:
@@ -199,8 +199,8 @@ define dso_local i64 @check_posix_memalign_diamond() local_unnamed_addr {
; CHECK-NEXT: ret i64 [[COND]]
;
entry:
- %obj = alloca i8*
- %call = call i32 @posix_memalign(i8** noundef %obj, i64 noundef 8, i64 noundef 10)
+ %obj = alloca ptr
+ %call = call i32 @posix_memalign(ptr noundef %obj, i64 noundef 8, i64 noundef 10)
%tobool = icmp ne i32 %call, 0
br i1 %tobool, label %cond.true, label %cond.false
@@ -208,8 +208,8 @@ cond.true:
br label %exit
cond.false:
- %val = load i8*, i8** %obj
- %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %val, i1 false, i1 true, i1 false)
+ %val = load ptr, ptr %obj
+ %objsize = call i64 @llvm.objectsize.i64.p0(ptr %val, i1 false, i1 true, i1 false)
br label %exit
exit:
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll b/llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll
index e19dce1b55433..e5baeb1092df8 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll
@@ -17,9 +17,9 @@ declare i1 @llvm.is.constant.v2i64(<2 x i64> %a) nounwind readnone
declare i1 @llvm.is.constant.f32(float %a) nounwind readnone
declare i1 @llvm.is.constant.sl_i32i32s({i32, i32} %a) nounwind readnone
declare i1 @llvm.is.constant.a2i64([2 x i64] %a) nounwind readnone
-declare i1 @llvm.is.constant.p0i64(i64* %a) nounwind readnone
+declare i1 @llvm.is.constant.p0(ptr %a) nounwind readnone
-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) nounwind readnone
+declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) nounwind readnone
declare i32 @subfun_1()
declare i32 @subfun_2()
@@ -40,12 +40,12 @@ False:
;; llvm.objectsize is another tricky case which gets folded to -1 very
;; late in the game. We'd like to ensure that llvm.is.constant of
;; llvm.objectsize is true.
-define i1 @test_objectsize(i8* %obj) nounwind {
+define i1 @test_objectsize(ptr %obj) nounwind {
;; CHECK-LABEL: test_objectsize
;; CHECK-NOT: llvm.objectsize
;; CHECK-NOT: llvm.is.constant
;; CHECK: ret i1 true
- %os = call i64 @llvm.objectsize.i64.p0i8(i8* %obj, i1 false, i1 false, i1 false)
+ %os = call i64 @llvm.objectsize.i64.p0(ptr %obj, i1 false, i1 false, i1 false)
%os1 = add i64 %os, 1
%v = call i1 @llvm.is.constant.i64(i64 %os1)
ret i1 %v
@@ -57,13 +57,13 @@ declare dso_local i32 @test_phi_b(...)
; Function Attrs: nounwind uwtable
define dso_local i32 @test_phi() {
entry:
- %0 = load i32, i32* @test_phi_a, align 4
+ %0 = load i32, ptr @test_phi_a, align 4
%1 = tail call i1 @llvm.is.constant.i32(i32 %0)
br i1 %1, label %cond.end, label %cond.false
cond.false: ; preds = %entry
- %call = tail call i32 bitcast (i32 (...)* @test_phi_b to i32 ()*)() #3
- %.pre = load i32, i32* @test_phi_a, align 4
+ %call = tail call i32 @test_phi_b() #3
+ %.pre = load i32, ptr @test_phi_a, align 4
br label %cond.end
cond.end: ; preds = %entry, %cond.false
@@ -73,14 +73,14 @@ cond.end: ; preds = %entry, %cond.false
br i1 %cmp, label %cond.true1, label %cond.end4
cond.true1: ; preds = %cond.end
- %call2 = tail call i32 bitcast (i32 (...)* @test_phi_b to i32 ()*)() #3
+ %call2 = tail call i32 @test_phi_b() #3
br label %cond.end4
cond.end4: ; preds = %cond.end, %cond.true1
ret i32 undef
}
-define i1 @test_various_types(i256 %int, float %float, <2 x i64> %vec, {i32, i32} %struct, [2 x i64] %arr, i64* %ptr) #0 {
+define i1 @test_various_types(i256 %int, float %float, <2 x i64> %vec, {i32, i32} %struct, [2 x i64] %arr, ptr %ptr) #0 {
; CHECK-LABEL: @test_various_types(
; CHECK-NOT: llvm.is.constant
%v1 = call i1 @llvm.is.constant.i256(i256 %int)
@@ -88,14 +88,14 @@ define i1 @test_various_types(i256 %int, float %float, <2 x i64> %vec, {i32, i32
%v3 = call i1 @llvm.is.constant.v2i64(<2 x i64> %vec)
%v4 = call i1 @llvm.is.constant.sl_i32i32s({i32, i32} %struct)
%v5 = call i1 @llvm.is.constant.a2i64([2 x i64] %arr)
- %v6 = call i1 @llvm.is.constant.p0i64(i64* %ptr)
+ %v6 = call i1 @llvm.is.constant.p0(ptr %ptr)
%c1 = call i1 @llvm.is.constant.i256(i256 -1)
%c2 = call i1 @llvm.is.constant.f32(float 17.0)
%c3 = call i1 @llvm.is.constant.v2i64(<2 x i64> <i64 -1, i64 44>)
%c4 = call i1 @llvm.is.constant.sl_i32i32s({i32, i32} {i32 -1, i32 32})
%c5 = call i1 @llvm.is.constant.a2i64([2 x i64] [i64 -1, i64 32])
- %c6 = call i1 @llvm.is.constant.p0i64(i64* inttoptr (i32 42 to i64*))
+ %c6 = call i1 @llvm.is.constant.p0(ptr inttoptr (i32 42 to ptr))
%x1 = add i1 %v1, %c1
%x2 = add i1 %v2, %c2
@@ -117,6 +117,6 @@ define i1 @test_various_types(i256 %int, float %float, <2 x i64> %vec, {i32, i32
define i1 @global_array() {
; CHECK-LABEL: @global_array(
; CHECK-NEXT: ret i1 false
- %1 = call i1 @llvm.is.constant.i64(i64 ptrtoint ([0 x i8]* @real_mode_blob_end to i64))
+ %1 = call i1 @llvm.is.constant.i64(i64 ptrtoint (ptr @real_mode_blob_end to i64))
ret i1 %1
}
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/crash-on-large-allocas.ll b/llvm/test/Transforms/LowerConstantIntrinsics/crash-on-large-allocas.ll
index e4e981161fd9d..5c6d03c8be6c5 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/crash-on-large-allocas.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/crash-on-large-allocas.ll
@@ -8,9 +8,9 @@ target datalayout = "p:16:16"
; CHECK-LABEL: @alloca_overflow_is_unknown(
define i16 @alloca_overflow_is_unknown() {
%i = alloca i8, i32 65537
- %j = call i16 @llvm.objectsize.i16.p0i8(i8* %i, i1 false, i1 false, i1 false)
+ %j = call i16 @llvm.objectsize.i16.p0(ptr %i, i1 false, i1 false, i1 false)
; CHECK: ret i16 -1
ret i16 %j
}
-declare i16 @llvm.objectsize.i16.p0i8(i8*, i1, i1, i1)
+declare i16 @llvm.objectsize.i16.p0(ptr, i1, i1, i1)
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll b/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll
index 7b78b0217b298..938962b1ce1ce 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll
@@ -4,13 +4,13 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
-declare i64 @llvm.objectsize.i64(i8*, i1, i1, i1) nounwind readonly
-declare i64 @llvm.objectsize.i64.p1i8(i8 addrspace(1)*, i1, i1, i1) nounwind readonly
+declare i64 @llvm.objectsize.i64(ptr, i1, i1, i1) nounwind readonly
+declare i64 @llvm.objectsize.i64.p1(ptr addrspace(1), i1, i1, i1) nounwind readonly
declare void @llvm.trap() nounwind
; objectsize should fold to a constant, which causes the branch to fold to an
; uncond branch.
-define i32 @test1(i8* %ptr) nounwind ssp noredzone align 2 {
+define i32 @test1(ptr %ptr) nounwind ssp noredzone align 2 {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[T:%.*]]
@@ -18,7 +18,7 @@ define i32 @test1(i8* %ptr) nounwind ssp noredzone align 2 {
; CHECK-NEXT: ret i32 4
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false, i1 false, i1 false)
+ %0 = tail call i64 @llvm.objectsize.i64(ptr %ptr, i1 false, i1 false, i1 false)
%1 = icmp ugt i64 %0, 3
br i1 %1, label %T, label %trap
@@ -31,23 +31,23 @@ T:
ret i32 4
}
-define i64 @test_objectsize_null_flag(i8* %ptr) {
+define i64 @test_objectsize_null_flag(ptr %ptr) {
; CHECK-LABEL: @test_objectsize_null_flag(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i64 -1
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64(i8* null, i1 false, i1 true, i1 false)
+ %0 = tail call i64 @llvm.objectsize.i64(ptr null, i1 false, i1 true, i1 false)
ret i64 %0
}
-define i64 @test_objectsize_null_flag_min(i8* %ptr) {
+define i64 @test_objectsize_null_flag_min(ptr %ptr) {
; CHECK-LABEL: @test_objectsize_null_flag_min(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i64 0
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64(i8* null, i1 true, i1 true, i1 false)
+ %0 = tail call i64 @llvm.objectsize.i64(ptr null, i1 true, i1 true, i1 false)
ret i64 %0
}
@@ -59,7 +59,7 @@ define i64 @test_objectsize_null_flag_noas0() {
; CHECK-NEXT: ret i64 -1
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64.p1i8(i8 addrspace(1)* null, i1 false,
+ %0 = tail call i64 @llvm.objectsize.i64.p1(ptr addrspace(1) null, i1 false,
i1 true, i1 false)
ret i64 %0
}
@@ -70,7 +70,7 @@ define i64 @test_objectsize_null_flag_min_noas0() {
; CHECK-NEXT: ret i64 0
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64.p1i8(i8 addrspace(1)* null, i1 true,
+ %0 = tail call i64 @llvm.objectsize.i64.p1(ptr addrspace(1) null, i1 true,
i1 true, i1 false)
ret i64 %0
}
@@ -81,7 +81,7 @@ define i64 @test_objectsize_null_known_flag_noas0() {
; CHECK-NEXT: ret i64 -1
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64.p1i8(i8 addrspace(1)* null, i1 false,
+ %0 = tail call i64 @llvm.objectsize.i64.p1(ptr addrspace(1) null, i1 false,
i1 false, i1 false)
ret i64 %0
}
@@ -92,28 +92,24 @@ define i64 @test_objectsize_null_known_flag_min_noas0() {
; CHECK-NEXT: ret i64 0
;
entry:
- %0 = tail call i64 @llvm.objectsize.i64.p1i8(i8 addrspace(1)* null, i1 true,
+ %0 = tail call i64 @llvm.objectsize.i64.p1(ptr addrspace(1) null, i1 true,
i1 false, i1 false)
ret i64 %0
}
-define i64 @test_objectsize_byval_arg([42 x i8]* byval([42 x i8]) %ptr) {
+define i64 @test_objectsize_byval_arg(ptr byval([42 x i8]) %ptr) {
; CHECK-LABEL: @test_objectsize_byval_arg(
-; CHECK-NEXT: [[CAST:%.*]] = bitcast [42 x i8]* [[PTR:%.*]] to i8*
; CHECK-NEXT: ret i64 42
;
- %cast = bitcast [42 x i8]* %ptr to i8*
- %size = tail call i64 @llvm.objectsize.i64(i8* %cast, i1 true, i1 false, i1 false)
+ %size = tail call i64 @llvm.objectsize.i64(ptr %ptr, i1 true, i1 false, i1 false)
ret i64 %size
}
-define i64 @test_objectsize_byref_arg([42 x i8]* byref([42 x i8]) %ptr) {
+define i64 @test_objectsize_byref_arg(ptr byref([42 x i8]) %ptr) {
; CHECK-LABEL: @test_objectsize_byref_arg(
-; CHECK-NEXT: [[CAST:%.*]] = bitcast [42 x i8]* [[PTR:%.*]] to i8*
; CHECK-NEXT: ret i64 42
;
- %cast = bitcast [42 x i8]* %ptr to i8*
- %size = tail call i64 @llvm.objectsize.i64(i8* %cast, i1 true, i1 false, i1 false)
+ %size = tail call i64 @llvm.objectsize.i64(ptr %ptr, i1 true, i1 false, i1 false)
ret i64 %size
}
@@ -125,7 +121,7 @@ define i64 @vla_pointer_size_mismatch(i42 %x) {
; CHECK-NEXT: [[TMP1:%.*]] = zext i42 [[X:%.*]] to i64
; CHECK-NEXT: [[TMP2:%.*]] = mul i64 1, [[TMP1]]
; CHECK-NEXT: [[A:%.*]] = alloca i8, i42 [[X]], align 1
-; CHECK-NEXT: [[G1:%.*]] = getelementptr i8, i8* [[A]], i8 17
+; CHECK-NEXT: [[G1:%.*]] = getelementptr i8, ptr [[A]], i8 17
; CHECK-NEXT: [[TMP3:%.*]] = sub i64 [[TMP2]], 17
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP2]], 17
; CHECK-NEXT: [[TMP5:%.*]] = select i1 [[TMP4]], i64 0, i64 [[TMP3]]
@@ -134,19 +130,19 @@ define i64 @vla_pointer_size_mismatch(i42 %x) {
; CHECK-NEXT: ret i64 [[TMP5]]
;
%A = alloca i8, i42 %x, align 1
- %G1 = getelementptr i8, i8* %A, i8 17
- %objsize = call i64 @llvm.objectsize.i64(i8* %G1, i1 false, i1 true, i1 true)
+ %G1 = getelementptr i8, ptr %A, i8 17
+ %objsize = call i64 @llvm.objectsize.i64(ptr %G1, i1 false, i1 true, i1 true)
ret i64 %objsize
}
-declare i8* @malloc(i64) allocsize(0)
+declare ptr @malloc(i64) allocsize(0)
define i64 @test_objectsize_malloc() {
; CHECK-LABEL: @test_objectsize_malloc(
-; CHECK-NEXT: [[PTR:%.*]] = call i8* @malloc(i64 16)
+; CHECK-NEXT: [[PTR:%.*]] = call ptr @malloc(i64 16)
; CHECK-NEXT: ret i64 16
;
- %ptr = call i8* @malloc(i64 16)
- %objsize = call i64 @llvm.objectsize.i64(i8* %ptr, i1 false, i1 true, i1 true)
+ %ptr = call ptr @malloc(i64 16)
+ %objsize = call i64 @llvm.objectsize.i64(ptr %ptr, i1 false, i1 true, i1 true)
ret i64 %objsize
}
diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/stale-worklist-phi.ll b/llvm/test/Transforms/LowerConstantIntrinsics/stale-worklist-phi.ll
index 0390116e8f06c..e8ff83d0cbcbf 100644
--- a/llvm/test/Transforms/LowerConstantIntrinsics/stale-worklist-phi.ll
+++ b/llvm/test/Transforms/LowerConstantIntrinsics/stale-worklist-phi.ll
@@ -13,12 +13,11 @@
%s = type { [2 x i16] }
-define fastcc void @foo(%s* %p) unnamed_addr {
+define fastcc void @foo(ptr %p) unnamed_addr {
entry:
- %0 = bitcast %s* %p to i8*
- %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false, i1 false, i1 false) #2
- %2 = icmp ne i32 %1, 0
- %.not1.i = icmp eq i32 %1, 0
+ %0 = tail call i32 @llvm.objectsize.i32.p0(ptr %p, i1 false, i1 false, i1 false) #2
+ %1 = icmp ne i32 %0, 0
+ %.not1.i = icmp eq i32 %0, 0
br label %for.cond
for.cond: ; preds = %entry
@@ -34,7 +33,7 @@ cont2.i: ; preds = %cont.i
br i1 %.not1.i, label %handler.type_mismatch3.i, label %cont4.i
handler.type_mismatch3.i: ; preds = %cont2.i, %cont2.thread.i
- %3 = phi i1 [ %2, %cont2.thread.i ], [ false, %cont2.i ]
+ %2 = phi i1 [ %1, %cont2.thread.i ], [ false, %cont2.i ]
unreachable
cont4.i: ; preds = %cont2.i
@@ -42,7 +41,7 @@ cont4.i: ; preds = %cont2.i
}
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
-declare i32 @llvm.objectsize.i32.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg) #1
+declare i32 @llvm.objectsize.i32.p0(ptr, i1 immarg, i1 immarg, i1 immarg) #1
attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
attributes #2 = { nounwind }
More information about the llvm-commits
mailing list