[llvm] 650041a - [Inline] Convert tests to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 21 02:32:54 PDT 2023
Author: Nikita Popov
Date: 2023-06-21T11:32:45+02:00
New Revision: 650041a7f1852e95c3543c9852ab63f75165b223
URL: https://github.com/llvm/llvm-project/commit/650041a7f1852e95c3543c9852ab63f75165b223
DIFF: https://github.com/llvm/llvm-project/commit/650041a7f1852e95c3543c9852ab63f75165b223.diff
LOG: [Inline] Convert tests to opaque pointers (NFC)
Added:
Modified:
llvm/test/Transforms/Inline/alloca-dbgdeclare.ll
llvm/test/Transforms/Inline/inline-skip-use-empty-alloca.ll
llvm/test/Transforms/Inline/inline-tail.ll
llvm/test/Transforms/Inline/lifetime-no-datalayout.ll
llvm/test/Transforms/Inline/lifetime.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Inline/alloca-dbgdeclare.ll b/llvm/test/Transforms/Inline/alloca-dbgdeclare.ll
index ad5d8b6fefd1f..7fc1bdd8ed68d 100644
--- a/llvm/test/Transforms/Inline/alloca-dbgdeclare.ll
+++ b/llvm/test/Transforms/Inline/alloca-dbgdeclare.ll
@@ -1,5 +1,5 @@
-; RUN: opt -opaque-pointers=0 -passes=inline -S < %s | FileCheck %s
-; RUN: opt -opaque-pointers=0 -passes='cgscc(inline)' -S < %s | FileCheck %s
+; RUN: opt -passes=inline -S < %s | FileCheck %s
+; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s
; struct A {
; int arg0;
; double arg1[2];
@@ -27,13 +27,13 @@ target triple = "aarch64-apple-darwin"
@b = global %struct.A zeroinitializer, align 8, !dbg !12
; Function Attrs: nounwind
-declare void @_Z3fn31A(%struct.A* nocapture readonly) #0
+declare void @_Z3fn31A(ptr nocapture readonly) #0
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: argmemonly nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #2
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #2
; Function Attrs: nounwind
define void @_Z3fn4v() #0 !dbg !22 {
@@ -44,22 +44,20 @@ entry:
; CHECK-NEXT: %agg.tmp.sroa.3.i = alloca [20 x i8], align 4
; CHECK-NEXT: br label %while.body
; CHECK: while.body:
-; CHECK-NEXT: bitcast
; CHECK-NEXT: llvm.lifetime.start
-; CHECK-NEXT: call void @llvm.dbg.declare(metadata [20 x i8]* %agg.tmp.sroa.3.i,
+; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr %agg.tmp.sroa.3.i,
%agg.tmp.sroa.3 = alloca [20 x i8], align 4
- tail call void @llvm.dbg.declare(metadata [20 x i8]* %agg.tmp.sroa.3, metadata !25, metadata !30), !dbg !31
- %agg.tmp.sroa.0.0.copyload = load i32, i32* getelementptr inbounds (%struct.A, %struct.A* @b, i64 0, i32 0), align 8, !dbg !33
+ tail call void @llvm.dbg.declare(metadata ptr %agg.tmp.sroa.3, metadata !25, metadata !30), !dbg !31
+ %agg.tmp.sroa.0.0.copyload = load i32, ptr @b, align 8, !dbg !33
tail call void @llvm.dbg.value(metadata i32 %agg.tmp.sroa.0.0.copyload, metadata !25, metadata !34), !dbg !31
- %agg.tmp.sroa.3.0..sroa_idx = getelementptr inbounds [20 x i8], [20 x i8]* %agg.tmp.sroa.3, i64 0, i64 0, !dbg !33
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %agg.tmp.sroa.3.0..sroa_idx, i8* align 4 getelementptr (i8, i8* bitcast (%struct.A* @b to i8*), i64 4), i64 20, i1 false), !dbg !33
- tail call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !25, metadata !35) #0, !dbg !31
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp.sroa.3, ptr align 4 getelementptr (i8, ptr @b, i64 4), i64 20, i1 false), !dbg !33
+ tail call void @llvm.dbg.declare(metadata ptr undef, metadata !25, metadata !35) #0, !dbg !31
%tobool.i = icmp eq i32 %agg.tmp.sroa.0.0.copyload, 0, !dbg !36
br i1 %tobool.i, label %_Z3fn31A.exit, label %if.then.i, !dbg !38
if.then.i: ; preds = %entry
- store i32 %agg.tmp.sroa.0.0.copyload, i32* getelementptr inbounds (%struct.A, %struct.A* @a, i64 0, i32 0), align 8, !dbg !39
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 getelementptr (i8, i8* bitcast (%struct.A* @a to i8*), i64 4), i8* align 4 %agg.tmp.sroa.3.0..sroa_idx, i64 20, i1 false), !dbg !39
+ store i32 %agg.tmp.sroa.0.0.copyload, ptr @a, align 8, !dbg !39
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 getelementptr (i8, ptr @a, i64 4), ptr align 4 %agg.tmp.sroa.3, i64 20, i1 false), !dbg !39
br label %_Z3fn31A.exit, !dbg !39
_Z3fn31A.exit: ; preds = %if.then.i, %entry
diff --git a/llvm/test/Transforms/Inline/inline-skip-use-empty-alloca.ll b/llvm/test/Transforms/Inline/inline-skip-use-empty-alloca.ll
index 879f3afdc7405..e2660e2648b76 100644
--- a/llvm/test/Transforms/Inline/inline-skip-use-empty-alloca.ll
+++ b/llvm/test/Transforms/Inline/inline-skip-use-empty-alloca.ll
@@ -1,10 +1,12 @@
-; RUN: opt -opaque-pointers=0 < %s -S -passes=inline | FileCheck %s
-; RUN: opt -opaque-pointers=0 < %s -S -strip-debug -passes=inline | FileCheck %s
+; RUN: opt < %s -S -passes=inline | FileCheck %s
+; RUN: opt < %s -S -strip-debug -passes=inline | FileCheck %s
; https://bugs.llvm.org/show_bug.cgi?id=43291
; The purpose of this test is to check if there is use_empty in the inner loop when scanning
; blocks of allocas, if the alloca is use_empty, skip it when allocas inlining.
+declare void @use(ptr )
+
define void @foo(i16 %k) !dbg !6 {
call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !15
%alloca_a = alloca i32
@@ -13,14 +15,13 @@ define void @foo(i16 %k) !dbg !6 {
call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !15
%alloca_c = alloca i32
call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !15
- %alloca_a..1 = bitcast i32* %alloca_a to i8**, !dbg !16
- %alloca_c..1 = bitcast i32* %alloca_c to i8**, !dbg !16
+ call void @use(ptr %alloca_a), !dbg !16
+ call void @use(ptr %alloca_c), !dbg !16
%_tmp23 = icmp ne i16 %k, 0
br i1 %_tmp23, label %bb1, label %bb2
bb1: ; preds = %0
- %_tmp28 = getelementptr [3 x i32], [3 x i32]* %alloca_b, i16 0, i64 0
- store i32 0, i32* %_tmp28
+ store i32 0, ptr %alloca_b
br label %bb2
bb2: ; preds = %bb1, %0
diff --git a/llvm/test/Transforms/Inline/inline-tail.ll b/llvm/test/Transforms/Inline/inline-tail.ll
index 1d06b35e5556c..6b9d391c76c0a 100644
--- a/llvm/test/Transforms/Inline/inline-tail.ll
+++ b/llvm/test/Transforms/Inline/inline-tail.ll
@@ -1,106 +1,100 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
-; RUN: opt -opaque-pointers=0 < %s -passes=inline -S | FileCheck %s
+; RUN: opt < %s -passes=inline -S | FileCheck %s
; We have to apply the less restrictive TailCallKind of the call site being
; inlined and any call sites cloned into the caller.
; No tail marker after inlining, since test_capture_c captures an alloca.
-declare void @test_capture_c(i32*)
-define internal void @test_capture_b(i32* %P) {
- tail call void @test_capture_c(i32* %P)
+declare void @test_capture_c(ptr)
+define internal void @test_capture_b(ptr %P) {
+ tail call void @test_capture_c(ptr %P)
ret void
}
define void @test_capture_a() {
; CHECK-LABEL: define void @test_capture_a() {
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @test_capture_c(i32* [[A]])
+; CHECK-NEXT: call void @test_capture_c(ptr [[A]])
; CHECK-NEXT: ret void
;
%A = alloca i32 ; captured by test_capture_b
- call void @test_capture_b(i32* %A)
+ call void @test_capture_b(ptr %A)
ret void
}
; No musttail marker after inlining, since the prototypes don't match.
-declare void @test_proto_mismatch_c(i32*)
-define internal void @test_proto_mismatch_b(i32* %p) {
- musttail call void @test_proto_mismatch_c(i32* %p)
+declare void @test_proto_mismatch_c(ptr)
+define internal void @test_proto_mismatch_b(ptr %p) {
+ musttail call void @test_proto_mismatch_c(ptr %p)
ret void
}
define void @test_proto_mismatch_a() {
; CHECK-LABEL: define void @test_proto_mismatch_a() {
-; CHECK-NEXT: call void @test_proto_mismatch_c(i32* null)
+; CHECK-NEXT: call void @test_proto_mismatch_c(ptr null)
; CHECK-NEXT: ret void
;
- call void @test_proto_mismatch_b(i32* null)
+ call void @test_proto_mismatch_b(ptr null)
ret void
}
; After inlining through a musttail call site, we need to keep musttail markers
; to prevent unbounded stack growth.
-declare void @test_musttail_basic_c(i32* %p)
-define internal void @test_musttail_basic_b(i32* %p) {
- musttail call void @test_musttail_basic_c(i32* %p)
+declare void @test_musttail_basic_c(ptr %p)
+define internal void @test_musttail_basic_b(ptr %p) {
+ musttail call void @test_musttail_basic_c(ptr %p)
ret void
}
-define void @test_musttail_basic_a(i32* %p) {
+define void @test_musttail_basic_a(ptr %p) {
; CHECK-LABEL: define void @test_musttail_basic_a
-; CHECK-SAME: (i32* [[P:%.*]]) {
-; CHECK-NEXT: musttail call void @test_musttail_basic_c(i32* [[P]])
+; CHECK-SAME: (ptr [[P:%.*]]) {
+; CHECK-NEXT: musttail call void @test_musttail_basic_c(ptr [[P]])
; CHECK-NEXT: ret void
;
- musttail call void @test_musttail_basic_b(i32* %p)
+ musttail call void @test_musttail_basic_b(ptr %p)
ret void
}
; Don't insert lifetime end markers here, the lifetime is trivially over due
; the return.
-declare void @test_byval_c(i32* byval(i32) %p)
-define internal void @test_byval_b(i32* byval(i32) %p) {
- musttail call void @test_byval_c(i32* byval(i32) %p)
+declare void @test_byval_c(ptr byval(i32) %p)
+define internal void @test_byval_b(ptr byval(i32) %p) {
+ musttail call void @test_byval_c(ptr byval(i32) %p)
ret void
}
-define void @test_byval_a(i32* byval(i32) %p) {
+define void @test_byval_a(ptr byval(i32) %p) {
; CHECK-LABEL: define void @test_byval_a
-; CHECK-SAME: (i32* byval(i32) [[P:%.*]]) {
+; CHECK-SAME: (ptr byval(i32) [[P:%.*]]) {
; CHECK-NEXT: [[P1:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[P1]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[TMP1]])
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[P1]] to i8*
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[P]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 [[TMP2]], i8* align 1 [[TMP3]], i64 4, i1 false)
-; CHECK-NEXT: musttail call void @test_byval_c(i32* byval(i32) [[P1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[P1]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[P1]], ptr align 1 [[P]], i64 4, i1 false)
+; CHECK-NEXT: musttail call void @test_byval_c(ptr byval(i32) [[P1]])
; CHECK-NEXT: ret void
;
- musttail call void @test_byval_b(i32* byval(i32) %p)
+ musttail call void @test_byval_b(ptr byval(i32) %p)
ret void
}
; Don't insert a stack restore, we're about to return.
-declare void @escape(i8* %buf)
-declare void @test_dynalloca_c(i32* byval(i32) %p, i32 %n)
-define internal void @test_dynalloca_b(i32* byval(i32) %p, i32 %n) alwaysinline {
+declare void @escape(ptr %buf)
+declare void @test_dynalloca_c(ptr byval(i32) %p, i32 %n)
+define internal void @test_dynalloca_b(ptr byval(i32) %p, i32 %n) alwaysinline {
%buf = alloca i8, i32 %n ; dynamic alloca
- call void @escape(i8* %buf) ; escape it
- musttail call void @test_dynalloca_c(i32* byval(i32) %p, i32 %n)
+ call void @escape(ptr %buf) ; escape it
+ musttail call void @test_dynalloca_c(ptr byval(i32) %p, i32 %n)
ret void
}
-define void @test_dynalloca_a(i32* byval(i32) %p, i32 %n) {
+define void @test_dynalloca_a(ptr byval(i32) %p, i32 %n) {
; CHECK-LABEL: define void @test_dynalloca_a
-; CHECK-SAME: (i32* byval(i32) [[P:%.*]], i32 [[N:%.*]]) {
+; CHECK-SAME: (ptr byval(i32) [[P:%.*]], i32 [[N:%.*]]) {
; CHECK-NEXT: [[P1:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[SAVEDSTACK:%.*]] = call i8* @llvm.stacksave()
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[P1]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[TMP1]])
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[P1]] to i8*
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[P]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 [[TMP2]], i8* align 1 [[TMP3]], i64 4, i1 false)
+; CHECK-NEXT: [[SAVEDSTACK:%.*]] = call ptr @llvm.stacksave()
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[P1]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[P1]], ptr align 1 [[P]], i64 4, i1 false)
; CHECK-NEXT: [[BUF_I:%.*]] = alloca i8, i32 [[N]], align 1
-; CHECK-NEXT: call void @escape(i8* [[BUF_I]])
-; CHECK-NEXT: musttail call void @test_dynalloca_c(i32* byval(i32) [[P1]], i32 [[N]])
+; CHECK-NEXT: call void @escape(ptr [[BUF_I]])
+; CHECK-NEXT: musttail call void @test_dynalloca_c(ptr byval(i32) [[P1]], i32 [[N]])
; CHECK-NEXT: ret void
;
- musttail call void @test_dynalloca_b(i32* byval(i32) %p, i32 %n)
+ musttail call void @test_dynalloca_b(ptr byval(i32) %p, i32 %n)
ret void
}
@@ -132,53 +126,45 @@ define void @test_multiret_a(i1 zeroext %b) {
}
; We have to avoid bitcast chains.
-declare i8* @test_retptr_c()
-define internal i16* @test_retptr_b() {
- %rv = musttail call i8* @test_retptr_c()
- %v = bitcast i8* %rv to i16*
- ret i16* %v
-}
-define i32* @test_retptr_a() {
-; CHECK-LABEL: define i32* @test_retptr_a() {
-; CHECK-NEXT: [[RV_I:%.*]] = musttail call i8* @test_retptr_c()
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[RV_I]] to i32*
-; CHECK-NEXT: ret i32* [[TMP1]]
+declare ptr @test_retptr_c()
+define internal ptr @test_retptr_b() {
+ %rv = musttail call ptr @test_retptr_c()
+ ret ptr %rv
+}
+define ptr @test_retptr_a() {
+; CHECK-LABEL: define ptr @test_retptr_a() {
+; CHECK-NEXT: [[RV_I:%.*]] = musttail call ptr @test_retptr_c()
+; CHECK-NEXT: ret ptr [[RV_I]]
;
- %rv = musttail call i16* @test_retptr_b()
- %v = bitcast i16* %rv to i32*
- ret i32* %v
+ %rv = musttail call ptr @test_retptr_b()
+ ret ptr %rv
}
; Combine the last two cases: multiple returns with pointer bitcasts.
-declare i8* @test_multiptrret_c(i1 zeroext %b)
-declare i8* @test_multiptrret_d(i1 zeroext %b)
-define internal i16* @test_multiptrret_b(i1 zeroext %b) {
+declare ptr @test_multiptrret_c(i1 zeroext %b)
+declare ptr @test_multiptrret_d(i1 zeroext %b)
+define internal ptr @test_multiptrret_b(i1 zeroext %b) {
br i1 %b, label %c, label %d
c:
- %c_rv = musttail call i8* @test_multiptrret_c(i1 zeroext %b)
- %c_v = bitcast i8* %c_rv to i16*
- ret i16* %c_v
+ %c_rv = musttail call ptr @test_multiptrret_c(i1 zeroext %b)
+ ret ptr %c_rv
d:
- %d_rv = musttail call i8* @test_multiptrret_d(i1 zeroext %b)
- %d_v = bitcast i8* %d_rv to i16*
- ret i16* %d_v
+ %d_rv = musttail call ptr @test_multiptrret_d(i1 zeroext %b)
+ ret ptr %d_rv
}
-define i32* @test_multiptrret_a(i1 zeroext %b) {
-; CHECK-LABEL: define i32* @test_multiptrret_a
+define ptr @test_multiptrret_a(i1 zeroext %b) {
+; CHECK-LABEL: define ptr @test_multiptrret_a
; CHECK-SAME: (i1 zeroext [[B:%.*]]) {
; CHECK-NEXT: br i1 [[B]], label [[C_I:%.*]], label [[D_I:%.*]]
; CHECK: c.i:
-; CHECK-NEXT: [[C_RV_I:%.*]] = musttail call i8* @test_multiptrret_c(i1 zeroext [[B]])
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[C_RV_I]] to i32*
-; CHECK-NEXT: ret i32* [[TMP1]]
+; CHECK-NEXT: [[C_RV_I:%.*]] = musttail call ptr @test_multiptrret_c(i1 zeroext [[B]])
+; CHECK-NEXT: ret ptr [[C_RV_I]]
; CHECK: d.i:
-; CHECK-NEXT: [[D_RV_I:%.*]] = musttail call i8* @test_multiptrret_d(i1 zeroext [[B]])
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[D_RV_I]] to i32*
-; CHECK-NEXT: ret i32* [[TMP2]]
+; CHECK-NEXT: [[D_RV_I:%.*]] = musttail call ptr @test_multiptrret_d(i1 zeroext [[B]])
+; CHECK-NEXT: ret ptr [[D_RV_I]]
;
- %rv = musttail call i16* @test_multiptrret_b(i1 zeroext %b)
- %v = bitcast i16* %rv to i32*
- ret i32* %v
+ %rv = musttail call ptr @test_multiptrret_b(i1 zeroext %b)
+ ret ptr %rv
}
; Inline a musttail call site which contains a normal return and a musttail call.
diff --git a/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll b/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll
index 1fa189b9af6b3..7438ef3b4e744 100644
--- a/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll
+++ b/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll
@@ -1,16 +1,16 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
-; RUN: opt -opaque-pointers=0 -passes=inline -S < %s | FileCheck %s
+; RUN: opt -passes=inline -S < %s | FileCheck %s
-declare void @use(i8* %a)
+declare void @use(ptr %a)
define void @helper() {
; CHECK-LABEL: define void @helper() {
; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @use(i8* [[A]])
+; CHECK-NEXT: call void @use(ptr [[A]])
; CHECK-NEXT: ret void
;
%a = alloca i8
- call void @use(i8* %a)
+ call void @use(ptr %a)
ret void
}
@@ -18,9 +18,9 @@ define void @helper() {
define void @test() {
; CHECK-LABEL: define void @test() {
; CHECK-NEXT: [[A_I:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[A_I]])
-; CHECK-NEXT: call void @use(i8* [[A_I]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[A_I]])
+; CHECK-NEXT: call void @use(ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[A_I]])
; CHECK-NEXT: ret void
;
call void @helper()
diff --git a/llvm/test/Transforms/Inline/lifetime.ll b/llvm/test/Transforms/Inline/lifetime.ll
index 1397f090c51bb..3ef5019303b48 100644
--- a/llvm/test/Transforms/Inline/lifetime.ll
+++ b/llvm/test/Transforms/Inline/lifetime.ll
@@ -1,22 +1,22 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
-; RUN: opt -opaque-pointers=0 -passes=inline -S < %s | FileCheck %s
+; RUN: opt -passes=inline -S < %s | FileCheck %s
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-S128"
-declare void @llvm.lifetime.start.p0i8(i64, i8*)
-declare void @llvm.lifetime.end.p0i8(i64, i8*)
+declare void @llvm.lifetime.start.p0(i64, ptr)
+declare void @llvm.lifetime.end.p0(i64, ptr)
define void @helper_both_markers() {
; CHECK-LABEL: define void @helper_both_markers() {
; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 2, i8* [[A]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 2, i8* [[A]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 2, ptr [[A]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 2, ptr [[A]])
; CHECK-NEXT: ret void
;
%a = alloca i8
; Size in llvm.lifetime.start / llvm.lifetime.end
diff ers from
; allocation size. We should use the former.
- call void @llvm.lifetime.start.p0i8(i64 2, i8* %a)
- call void @llvm.lifetime.end.p0i8(i64 2, i8* %a)
+ call void @llvm.lifetime.start.p0(i64 2, ptr %a)
+ call void @llvm.lifetime.end.p0(i64 2, ptr %a)
ret void
}
@@ -24,10 +24,10 @@ define void @test_both_markers() {
; CHECK-LABEL: define void @test_both_markers() {
; CHECK-NEXT: [[A_I1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[A_I:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 2, i8* [[A_I]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 2, i8* [[A_I]])
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 2, i8* [[A_I1]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 2, i8* [[A_I1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 2, ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 2, ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 2, ptr [[A_I1]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 2, ptr [[A_I1]])
; CHECK-NEXT: ret void
;
call void @helper_both_markers()
@@ -37,16 +37,16 @@ define void @test_both_markers() {
;; Without this, the inliner will simplify out @test_no_marker before adding
;; any lifetime markers.
-declare void @use(i8* %a)
+declare void @use(ptr %a)
define void @helper_no_markers() {
; CHECK-LABEL: define void @helper_no_markers() {
; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @use(i8* [[A]])
+; CHECK-NEXT: call void @use(ptr [[A]])
; CHECK-NEXT: ret void
;
%a = alloca i8 ; Allocation size is 1 byte.
- call void @use(i8* %a)
+ call void @use(ptr %a)
ret void
}
@@ -54,12 +54,12 @@ define void @test_no_marker() {
; CHECK-LABEL: define void @test_no_marker() {
; CHECK-NEXT: [[A_I1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[A_I:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[A_I]])
-; CHECK-NEXT: call void @use(i8* [[A_I]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[A_I]])
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[A_I1]])
-; CHECK-NEXT: call void @use(i8* [[A_I1]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[A_I1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[A_I]])
+; CHECK-NEXT: call void @use(ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[A_I1]])
+; CHECK-NEXT: call void @use(ptr [[A_I1]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[A_I1]])
; CHECK-NEXT: ret void
;
call void @helper_no_markers()
@@ -70,17 +70,13 @@ define void @test_no_marker() {
define void @helper_two_casts() {
; CHECK-LABEL: define void @helper_two_casts() {
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[B:%.*]] = bitcast i32* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[B]])
-; CHECK-NEXT: [[C:%.*]] = bitcast i32* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[C]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[A]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr [[A]])
; CHECK-NEXT: ret void
;
%a = alloca i32
- %b = bitcast i32* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %b)
- %c = bitcast i32* %a to i8*
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %c)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %a)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %a)
ret void
}
@@ -88,14 +84,10 @@ define void @test_two_casts() {
; CHECK-LABEL: define void @test_two_casts() {
; CHECK-NEXT: [[A_I1:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[A_I:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[B_I:%.*]] = bitcast i32* [[A_I]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[B_I]])
-; CHECK-NEXT: [[C_I:%.*]] = bitcast i32* [[A_I]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[C_I]])
-; CHECK-NEXT: [[B_I2:%.*]] = bitcast i32* [[A_I1]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[B_I2]])
-; CHECK-NEXT: [[C_I3:%.*]] = bitcast i32* [[A_I1]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[C_I3]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[A_I1]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr [[A_I1]])
; CHECK-NEXT: ret void
;
call void @helper_two_casts()
@@ -106,25 +98,20 @@ define void @test_two_casts() {
define void @helper_arrays_alloca() {
; CHECK-LABEL: define void @helper_arrays_alloca() {
; CHECK-NEXT: [[A:%.*]] = alloca [10 x i32], align 16
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast [10 x i32]* [[A]] to i8*
-; CHECK-NEXT: call void @use(i8* [[TMP1]])
+; CHECK-NEXT: call void @use(ptr [[A]])
; CHECK-NEXT: ret void
;
%a = alloca [10 x i32], align 16
- %1 = bitcast [10 x i32]* %a to i8*
- call void @use(i8* %1)
+ call void @use(ptr %a)
ret void
}
define void @test_arrays_alloca() {
; CHECK-LABEL: define void @test_arrays_alloca() {
; CHECK-NEXT: [[A_I:%.*]] = alloca [10 x i32], align 16
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast [10 x i32]* [[A_I]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 40, i8* [[TMP1]])
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast [10 x i32]* [[A_I]] to i8*
-; CHECK-NEXT: call void @use(i8* [[TMP2]])
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast [10 x i32]* [[A_I]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 40, i8* [[TMP3]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 40, ptr [[A_I]])
+; CHECK-NEXT: call void @use(ptr [[A_I]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 40, ptr [[A_I]])
; CHECK-NEXT: ret void
;
call void @helper_arrays_alloca()
@@ -136,20 +123,20 @@ define void @test_arrays_alloca() {
define void @helper_swifterror_alloca() {
; CHECK-LABEL: define void @helper_swifterror_alloca() {
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[SWIFTERROR:%.*]] = alloca swifterror %swift.error*, align 8
-; CHECK-NEXT: store %swift.error* null, %swift.error** [[SWIFTERROR]], align 8
+; CHECK-NEXT: [[SWIFTERROR:%.*]] = alloca swifterror ptr, align 8
+; CHECK-NEXT: store ptr null, ptr [[SWIFTERROR]], align 8
; CHECK-NEXT: ret void
;
entry:
- %swifterror = alloca swifterror %swift.error*, align 8
- store %swift.error* null, %swift.error** %swifterror, align 8
+ %swifterror = alloca swifterror ptr, align 8
+ store ptr null, ptr %swifterror, align 8
ret void
}
define void @test_swifterror_alloca() {
; CHECK-LABEL: define void @test_swifterror_alloca() {
-; CHECK-NEXT: [[SWIFTERROR_I:%.*]] = alloca swifterror %swift.error*, align 8
-; CHECK-NEXT: store %swift.error* null, %swift.error** [[SWIFTERROR_I]], align 8
+; CHECK-NEXT: [[SWIFTERROR_I:%.*]] = alloca swifterror ptr, align 8
+; CHECK-NEXT: store ptr null, ptr [[SWIFTERROR_I]], align 8
; CHECK-NEXT: ret void
;
call void @helper_swifterror_alloca()
More information about the llvm-commits
mailing list