[llvm] 304838e - [Coroutines] Convert some tests to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 3 04:59:25 PST 2023
Author: Nikita Popov
Date: 2023-01-03T13:57:51+01:00
New Revision: 304838e828f9a0de5594cc203c519cb45867b047
URL: https://github.com/llvm/llvm-project/commit/304838e828f9a0de5594cc203c519cb45867b047
DIFF: https://github.com/llvm/llvm-project/commit/304838e828f9a0de5594cc203c519cb45867b047.diff
LOG: [Coroutines] Convert some tests to opaque pointers (NFC)
Added:
Modified:
llvm/test/Transforms/Coroutines/coro-align16.ll
llvm/test/Transforms/Coroutines/coro-align32.ll
llvm/test/Transforms/Coroutines/coro-align64-02.ll
llvm/test/Transforms/Coroutines/coro-align64.ll
llvm/test/Transforms/Coroutines/coro-align8-02.ll
llvm/test/Transforms/Coroutines/coro-align8.ll
llvm/test/Transforms/Coroutines/coro-alloca-05.ll
llvm/test/Transforms/Coroutines/coro-alloca-06.ll
llvm/test/Transforms/Coroutines/coro-alloca-08.ll
llvm/test/Transforms/Coroutines/coro-alloca-09.ll
llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll
llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll
llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll
llvm/test/Transforms/Coroutines/coro-async-end-bug.ll
llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll
llvm/test/Transforms/Coroutines/coro-async-phi.ll
llvm/test/Transforms/Coroutines/coro-async-unreachable.ll
llvm/test/Transforms/Coroutines/coro-byval-param.ll
llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
llvm/test/Transforms/Coroutines/coro-cleanup-lowering.ll
llvm/test/Transforms/Coroutines/coro-cleanup.ll
llvm/test/Transforms/Coroutines/coro-elide-stat.ll
llvm/test/Transforms/Coroutines/coro-elide.ll
llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll
llvm/test/Transforms/Coroutines/coro-inline.ll
llvm/test/Transforms/Coroutines/coro-materialize.ll
llvm/test/Transforms/Coroutines/coro-noalias-param.ll
llvm/test/Transforms/Coroutines/coro-noop.ll
llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
llvm/test/Transforms/Coroutines/coro-retcon-value.ll
llvm/test/Transforms/Coroutines/coro-split-01.ll
llvm/test/Transforms/Coroutines/coro-split-alloc.ll
llvm/test/Transforms/Coroutines/coro-split-dbg.ll
llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll
llvm/test/Transforms/Coroutines/coro-split-musttail.ll
llvm/test/Transforms/Coroutines/coro-split-musttail1.ll
llvm/test/Transforms/Coroutines/coro-split-musttail10.ll
llvm/test/Transforms/Coroutines/coro-split-musttail11.ll
llvm/test/Transforms/Coroutines/coro-split-musttail2.ll
llvm/test/Transforms/Coroutines/coro-split-musttail3.ll
llvm/test/Transforms/Coroutines/coro-split-musttail4.ll
llvm/test/Transforms/Coroutines/coro-split-musttail5.ll
llvm/test/Transforms/Coroutines/coro-split-musttail6.ll
llvm/test/Transforms/Coroutines/coro-split-musttail7.ll
llvm/test/Transforms/Coroutines/coro-split-musttail8.ll
llvm/test/Transforms/Coroutines/coro-split-musttail9.ll
llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
llvm/test/Transforms/Coroutines/ex0.ll
llvm/test/Transforms/Coroutines/ex1.ll
llvm/test/Transforms/Coroutines/ex2.ll
llvm/test/Transforms/Coroutines/ex3.ll
llvm/test/Transforms/Coroutines/ex4.ll
llvm/test/Transforms/Coroutines/ex5.ll
llvm/test/Transforms/Coroutines/phi-coro-end.ll
llvm/test/Transforms/Coroutines/smoketest.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Coroutines/coro-align16.ll b/llvm/test/Transforms/Coroutines/coro-align16.ll
index 951398e159d2..fdd8af749768 100644
--- a/llvm/test/Transforms/Coroutines/coro-align16.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align16.ll
@@ -1,54 +1,52 @@
; Tests that the coro.align intrinsic could be lowered to correct alignment
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
%x = alloca i64, align 16
%y = alloca i64
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%align = call i32 @llvm.coro.align.i32()
- %alloc = call i8* @aligned_alloc(i32 %align, i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @aligned_alloc(i32 %align, i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
resume:
- %x.alias = bitcast i64* %x to i32*
- call void @capture_call(i32* %x.alias)
- %y.alias = bitcast i64* %y to i32*
- call void @capture_call(i32* %y.alias)
+ call void @capture_call(ptr %x)
+ call void @capture_call(ptr %y)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; %x needs to go to the frame since it's escaped; %y will stay as local since it doesn't escape.
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i64, i64, i1 }
-; CHECK-LABEL: define i8* @f()
-; CHECK: %[[ALLOC:.+]] = call i8* @aligned_alloc(i32 16, i32 40)
-; CHECK-NEXT: call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %[[ALLOC]])
+; CHECK: %f.Frame = type { ptr, ptr, i64, i64, i1 }
+; CHECK-LABEL: define ptr @f()
+; CHECK: %[[ALLOC:.+]] = call ptr @aligned_alloc(i32 16, i32 40)
+; CHECK-NEXT: call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %[[ALLOC]])
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i32 @llvm.coro.align.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @capture_call(i32*)
-declare void @nocapture_call(i32* nocapture)
-declare noalias i8* @aligned_alloc(i32, i32)
-declare void @free(i8*)
+declare void @capture_call(ptr)
+declare void @nocapture_call(ptr nocapture)
+declare noalias ptr @aligned_alloc(i32, i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align32.ll b/llvm/test/Transforms/Coroutines/coro-align32.ll
index 8a276a6d5906..032fda5f3b2a 100644
--- a/llvm/test/Transforms/Coroutines/coro-align32.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align32.ll
@@ -1,60 +1,56 @@
; Tests that the coro.align intrinsic could be lowered to correct alignment
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
%x = alloca i64, align 16
%y = alloca i32, align 32
%z = alloca i32, align 16
%alpha = alloca i1, align 8
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%align = call i32 @llvm.coro.align.i32()
- %alloc = call i8* @aligned_alloc(i32 %align, i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @aligned_alloc(i32 %align, i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
resume:
- %x.alias = bitcast i64* %x to i32*
- call void @capture_call(i32* %x.alias)
- %y.alias = bitcast i32* %y to i32*
- call void @capture_call(i32* %y.alias)
- %z.alias = bitcast i32* %z to i32*
- call void @capture_call(i32* %z.alias)
- %alpha.alias = bitcast i1* %alpha to i32*
- call void @capture_call(i32* %alpha.alias)
+ call void @capture_call(ptr %x)
+ call void @capture_call(ptr %y)
+ call void @capture_call(ptr %z)
+ call void @capture_call(ptr %alpha)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; %x needs to go to the frame since it's escaped; %y will stay as local since it doesn't escape.
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i64, i1, i1, [6 x i8], i32, [12 x i8], i32 }
-; CHECK-LABEL: define i8* @f()
-; CHECK: %[[ALLOC:.+]] = call i8* @aligned_alloc(i32 32, i32 56)
-; CHECK-NEXT: call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %[[ALLOC]])
+; CHECK: %f.Frame = type { ptr, ptr, i64, i1, i1, [6 x i8], i32, [12 x i8], i32 }
+; CHECK-LABEL: define ptr @f()
+; CHECK: %[[ALLOC:.+]] = call ptr @aligned_alloc(i32 32, i32 56)
+; CHECK-NEXT: call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %[[ALLOC]])
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i32 @llvm.coro.align.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @capture_call(i32*)
-declare void @nocapture_call(i32* nocapture)
-declare noalias i8* @aligned_alloc(i32, i32)
-declare void @free(i8*)
+declare void @capture_call(ptr)
+declare void @nocapture_call(ptr nocapture)
+declare noalias ptr @aligned_alloc(i32, i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align64-02.ll b/llvm/test/Transforms/Coroutines/coro-align64-02.ll
index 107b61e40a4f..2eab5c581db3 100644
--- a/llvm/test/Transforms/Coroutines/coro-align64-02.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align64-02.ll
@@ -1,54 +1,52 @@
; Tests that the coro.align intrinsic could be lowered to correct alignment
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
%x = alloca i1, align 64
%y = alloca i64, align 32
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%align = call i32 @llvm.coro.align.i32()
- %alloc = call i8* @aligned_alloc(i32 %align, i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @aligned_alloc(i32 %align, i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
resume:
- %x.alias = bitcast i1* %x to i32*
- call void @capture_call(i32* %x.alias)
- %y.alias = bitcast i64* %y to i32*
- call void @capture_call(i32* %y.alias)
+ call void @capture_call(ptr %x)
+ call void @capture_call(ptr %y)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; %x needs to go to the frame since it's escaped; %y will stay as local since it doesn't escape.
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i1, [15 x i8], i64, [24 x i8], i1 }
-; CHECK-LABEL: define i8* @f()
-; CHECK: %[[ALLOC:.+]] = call i8* @aligned_alloc(i32 64, i32 72)
-; CHECK-NEXT: call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %[[ALLOC]])
+; CHECK: %f.Frame = type { ptr, ptr, i1, [15 x i8], i64, [24 x i8], i1 }
+; CHECK-LABEL: define ptr @f()
+; CHECK: %[[ALLOC:.+]] = call ptr @aligned_alloc(i32 64, i32 72)
+; CHECK-NEXT: call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %[[ALLOC]])
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i32 @llvm.coro.align.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @capture_call(i32*)
-declare void @nocapture_call(i32* nocapture)
-declare noalias i8* @aligned_alloc(i32, i32)
-declare void @free(i8*)
+declare void @capture_call(ptr)
+declare void @nocapture_call(ptr nocapture)
+declare noalias ptr @aligned_alloc(i32, i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align64.ll b/llvm/test/Transforms/Coroutines/coro-align64.ll
index fd66e8a50432..aff05b62f1ac 100644
--- a/llvm/test/Transforms/Coroutines/coro-align64.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align64.ll
@@ -1,54 +1,52 @@
; Tests that the coro.align intrinsic could be lowered to correct alignment
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
%x = alloca i1, align 64
%y = alloca i64
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%align = call i32 @llvm.coro.align.i32()
- %alloc = call i8* @aligned_alloc(i32 %align, i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @aligned_alloc(i32 %align, i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
resume:
- %x.alias = bitcast i1* %x to i32*
- call void @capture_call(i32* %x.alias)
- %y.alias = bitcast i64* %y to i32*
- call void @capture_call(i32* %y.alias)
+ call void @capture_call(ptr %x)
+ call void @capture_call(ptr %y)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; %x needs to go to the frame since it's escaped; %y will stay as local since it doesn't escape.
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i64, i1, [39 x i8], i1 }
-; CHECK-LABEL: define i8* @f()
-; CHECK: %[[ALLOC:.+]] = call i8* @aligned_alloc(i32 64, i32 72)
-; CHECK-NEXT: call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %[[ALLOC]])
+; CHECK: %f.Frame = type { ptr, ptr, i64, i1, [39 x i8], i1 }
+; CHECK-LABEL: define ptr @f()
+; CHECK: %[[ALLOC:.+]] = call ptr @aligned_alloc(i32 64, i32 72)
+; CHECK-NEXT: call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %[[ALLOC]])
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i32 @llvm.coro.align.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @capture_call(i32*)
-declare void @nocapture_call(i32* nocapture)
-declare noalias i8* @aligned_alloc(i32, i32)
-declare void @free(i8*)
+declare void @capture_call(ptr)
+declare void @nocapture_call(ptr nocapture)
+declare noalias ptr @aligned_alloc(i32, i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align8-02.ll b/llvm/test/Transforms/Coroutines/coro-align8-02.ll
index 1da3ac63ecff..2bbdf0e0164e 100644
--- a/llvm/test/Transforms/Coroutines/coro-align8-02.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align8-02.ll
@@ -1,13 +1,13 @@
; Tests that the coro.align intrinsic could be lowered to correct alignment
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%align = call i32 @llvm.coro.align.i32()
- %alloc = call i8* @aligned_alloc(i32 %align, i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @aligned_alloc(i32 %align, i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
@@ -15,32 +15,32 @@ resume:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; %x needs to go to the frame since it's escaped; %y will stay as local since it doesn't escape.
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i1 }
-; CHECK-LABEL: define i8* @f()
-; CHECK: %[[ALLOC:.+]] = call i8* @aligned_alloc(i32 8, i32 24)
-; CHECK-NEXT: call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %[[ALLOC]])
+; CHECK: %f.Frame = type { ptr, ptr, i1 }
+; CHECK-LABEL: define ptr @f()
+; CHECK: %[[ALLOC:.+]] = call ptr @aligned_alloc(i32 8, i32 24)
+; CHECK-NEXT: call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %[[ALLOC]])
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i32 @llvm.coro.align.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @aligned_alloc(i32, i32)
-declare void @free(i8*)
+declare noalias ptr @aligned_alloc(i32, i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align8.ll b/llvm/test/Transforms/Coroutines/coro-align8.ll
index c6017f5a3489..a8bdba356b1f 100644
--- a/llvm/test/Transforms/Coroutines/coro-align8.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align8.ll
@@ -1,54 +1,52 @@
; Tests that the coro.align intrinsic could be lowered to correct alignment
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
%x = alloca i64
%y = alloca i64
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%align = call i32 @llvm.coro.align.i32()
- %alloc = call i8* @aligned_alloc(i32 %align, i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @aligned_alloc(i32 %align, i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
resume:
- %x.alias = bitcast i64* %x to i32*
- call void @capture_call(i32* %x.alias)
- %y.alias = bitcast i64* %y to i32*
- call void @nocapture_call(i32* %y.alias)
+ call void @capture_call(ptr %x)
+ call void @nocapture_call(ptr %y)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; %x needs to go to the frame since it's escaped; %y will stay as local since it doesn't escape.
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i64, i1 }
-; CHECK-LABEL: define i8* @f()
-; CHECK: %[[ALLOC:.+]] = call i8* @aligned_alloc(i32 8, i32 32)
-; CHECK-NEXT: call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %[[ALLOC]])
+; CHECK: %f.Frame = type { ptr, ptr, i64, i1 }
+; CHECK-LABEL: define ptr @f()
+; CHECK: %[[ALLOC:.+]] = call ptr @aligned_alloc(i32 8, i32 32)
+; CHECK-NEXT: call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %[[ALLOC]])
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i32 @llvm.coro.align.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @capture_call(i32*)
-declare void @nocapture_call(i32* nocapture)
-declare noalias i8* @aligned_alloc(i32, i32)
-declare void @free(i8*)
+declare void @capture_call(ptr)
+declare void @nocapture_call(ptr nocapture)
+declare noalias ptr @aligned_alloc(i32, i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-alloca-05.ll b/llvm/test/Transforms/Coroutines/coro-alloca-05.ll
index 6d637c9703e6..6529e8fda1be 100644
--- a/llvm/test/Transforms/Coroutines/coro-alloca-05.ll
+++ b/llvm/test/Transforms/Coroutines/coro-alloca-05.ll
@@ -2,51 +2,50 @@
; live on the frame are properly moved to the .resume function.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%x = alloca i32
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %sp1, label %suspend [i8 0, label %resume
i8 1, label %cleanup]
resume:
- %x.value = load i32, i32* %x
+ %x.value = load i32, ptr %x
call void @print(i32 %x.value)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; CHECK-LABEL: @f.resume(
; CHECK-NEXT: entry.resume:
-; CHECK-NEXT: [[VFRAME:%.*]] = bitcast %f.Frame* [[FRAMEPTR:%.*]] to i8*
; CHECK-NEXT: [[X:%.*]] = alloca i32, align 4
-; CHECK: [[X_VALUE:%.*]] = load i32, i32* [[X]], align 4
+; CHECK: [[X_VALUE:%.*]] = load i32, ptr [[X]], align 4
; CHECK-NEXT: call void @print(i32 [[X_VALUE]])
-; CHECK: call void @free(i8* [[VFRAME]])
+; CHECK: call void @free(ptr [[FRAMEPTR:%.*]])
; CHECK: ret void
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
declare void @print(i32)
-declare noalias i8* @malloc(i32)
-declare void @free(i8*)
+declare noalias ptr @malloc(i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-alloca-06.ll b/llvm/test/Transforms/Coroutines/coro-alloca-06.ll
index 6938ee14de43..a3444c30121e 100644
--- a/llvm/test/Transforms/Coroutines/coro-alloca-06.ll
+++ b/llvm/test/Transforms/Coroutines/coro-alloca-06.ll
@@ -2,30 +2,26 @@
; though their pointers are stored.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-%handle = type { i8* }
+%handle = type { ptr }
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
%0 = alloca %"handle", align 8
- %1 = alloca %"handle"*, align 8
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %1 = alloca ptr, align 8
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
br label %tricky
tricky:
- %2 = call i8* @await_suspend()
- %3 = getelementptr inbounds %"handle", %"handle"* %0, i32 0, i32 0
- store i8* %2, i8** %3, align 8
- %4 = bitcast %"handle"** %1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %4)
- store %"handle"* %0, %"handle"** %1, align 8
- %5 = load %"handle"*, %"handle"** %1, align 8
- %6 = getelementptr inbounds %"handle", %"handle"* %5, i32 0, i32 0
- %7 = load i8*, i8** %6, align 8
- %8 = bitcast %"handle"** %1 to i8*
- call void @llvm.lifetime.end.p0i8(i64 8, i8* %8)
+ %2 = call ptr @await_suspend()
+ store ptr %2, ptr %0, align 8
+ call void @llvm.lifetime.start.p0(i64 8, ptr %1)
+ store ptr %0, ptr %1, align 8
+ %3 = load ptr, ptr %1, align 8
+ %4 = load ptr, ptr %3, align 8
+ call void @llvm.lifetime.end.p0(i64 8, ptr %1)
br label %finish
finish:
@@ -36,45 +32,43 @@ resume:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i1 }
+; CHECK: %f.Frame = type { ptr, ptr, i1 }
; CHECK-LABEL: @f(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = alloca [[HANDLE:%.*]], align 8
-; CHECK-NEXT: [[TMP1:%.*]] = alloca %handle*, align 8
+; CHECK-NEXT: [[TMP1:%.*]] = alloca ptr, align 8
-; CHECK: [[TMP2:%.*]] = call i8* @await_suspend()
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[HANDLE]], %handle* [[TMP0]], i32 0, i32 0
-; CHECK-NEXT: store i8* [[TMP2]], i8** [[TMP3]], align 8
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast %handle** [[TMP1]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[TMP4]])
-; CHECK-NEXT: store %handle* [[TMP0]], %handle** [[TMP1]], align 8
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[TMP4]])
+; CHECK: [[TMP2:%.*]] = call ptr @await_suspend()
+; CHECK-NEXT: store ptr [[TMP2]], ptr [[TMP0]], align 8
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[TMP1]])
+; CHECK-NEXT: store ptr [[TMP0]], ptr [[TMP1]], align 8
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 8, ptr [[TMP1]])
;
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
-declare i8* @await_suspend()
-declare void @print(i32* nocapture)
-declare noalias i8* @malloc(i32)
-declare void @free(i8*)
+declare ptr @await_suspend()
+declare void @print(ptr nocapture)
+declare noalias ptr @malloc(i32)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-alloca-08.ll b/llvm/test/Transforms/Coroutines/coro-alloca-08.ll
index 9326ce926caf..b0aeadc81e9f 100644
--- a/llvm/test/Transforms/Coroutines/coro-alloca-08.ll
+++ b/llvm/test/Transforms/Coroutines/coro-alloca-08.ll
@@ -1,39 +1,38 @@
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-%"struct.std::coroutine_handle" = type { i8* }
+%"struct.std::coroutine_handle" = type { ptr }
%"struct.std::coroutine_handle.0" = type { %"struct.std::coroutine_handle" }
%"struct.lean_future<int>::Awaiter" = type { i32, %"struct.std::coroutine_handle.0" }
-declare i8* @malloc(i64)
+declare ptr @malloc(i64)
%i8.array = type { [100 x i8] }
-declare void @consume.i8.array(%i8.array*)
+declare void @consume.i8.array(ptr)
; The lifetime of testval starts and ends before coro.suspend. Even though consume.i8.array
; might capture it, we can safely say it won't live across suspension.
define void @foo() presplitcoroutine {
entry:
%testval = alloca %i8.array
- %cast = getelementptr inbounds %i8.array, %i8.array* %testval, i64 0, i32 0, i64 0
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- call void @llvm.lifetime.start.p0i8(i64 100, i8* %cast)
- call void @consume.i8.array(%i8.array* %testval)
- call void @llvm.lifetime.end.p0i8(i64 100, i8* %cast)
+ call void @llvm.lifetime.start.p0(i64 100, ptr %testval)
+ call void @consume.i8.array(ptr %testval)
+ call void @llvm.lifetime.end.p0(i64 100, ptr %testval)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
i8 0, label %await.ready
i8 1, label %exit
]
await.ready:
- %StrayCoroSave = call token @llvm.coro.save(i8* null)
+ %StrayCoroSave = call token @llvm.coro.save(ptr null)
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
@@ -42,41 +41,40 @@ exit:
define void @bar() presplitcoroutine {
entry:
%testval = alloca %i8.array
- %cast = getelementptr inbounds %i8.array, %i8.array* %testval, i64 0, i32 0, i64 0
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
i8 0, label %await.ready
i8 1, label %exit
]
await.ready:
- %StrayCoroSave = call token @llvm.coro.save(i8* null)
+ %StrayCoroSave = call token @llvm.coro.save(ptr null)
- call void @llvm.lifetime.start.p0i8(i64 100, i8* %cast)
- call void @consume.i8.array(%i8.array* %testval)
- call void @llvm.lifetime.end.p0i8(i64 100, i8* %cast)
+ call void @llvm.lifetime.start.p0(i64 100, ptr %testval)
+ call void @consume.i8.array(ptr %testval)
+ call void @llvm.lifetime.end.p0(i64 100, ptr %testval)
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that for both foo and bar, testval isn't put on the frame.
-; CHECK: %foo.Frame = type { void (%foo.Frame*)*, void (%foo.Frame*)*, i1 }
-; CHECK: %bar.Frame = type { void (%bar.Frame*)*, void (%bar.Frame*)*, i1 }
+; CHECK: %foo.Frame = type { ptr, ptr, i1 }
+; CHECK: %bar.Frame = type { ptr, ptr, i1 }
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)
declare i1 @llvm.coro.alloc(token) #3
declare i64 @llvm.coro.size.i64() #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #3
-declare token @llvm.coro.save(i8*) #3
-declare i8* @llvm.coro.frame() #5
+declare ptr @llvm.coro.begin(token, ptr writeonly) #3
+declare token @llvm.coro.save(ptr) #3
+declare ptr @llvm.coro.frame() #5
declare i8 @llvm.coro.suspend(token, i1) #3
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #2
-declare i1 @llvm.coro.end(i8*, i1) #3
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #4
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #4
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #2
+declare i1 @llvm.coro.end(ptr, i1) #3
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #4
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #4
diff --git a/llvm/test/Transforms/Coroutines/coro-alloca-09.ll b/llvm/test/Transforms/Coroutines/coro-alloca-09.ll
index 82d8da5d4186..2e0a8def2d54 100644
--- a/llvm/test/Transforms/Coroutines/coro-alloca-09.ll
+++ b/llvm/test/Transforms/Coroutines/coro-alloca-09.ll
@@ -1,57 +1,57 @@
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-%"struct.std::coroutine_handle" = type { i8* }
+%"struct.std::coroutine_handle" = type { ptr }
%"struct.std::coroutine_handle.0" = type { %"struct.std::coroutine_handle" }
%"struct.lean_future<int>::Awaiter" = type { i32, %"struct.std::coroutine_handle.0" }
-declare i8* @malloc(i64)
+declare ptr @malloc(i64)
%i8.array = type { [100 x i8] }
-declare void @consume.i8(i8*)
+declare void @consume.i8(ptr)
; The testval lives across suspend point so that it should be put on the frame.
; However, part of testval has lifetime marker which indicates the part
; wouldn't live across suspend point.
; This test whether or not %testval would be put on the frame by ignoring the
; partial lifetime markers.
-define void @foo(%i8.array** %to_store) presplitcoroutine {
+define void @foo(ptr %to_store) presplitcoroutine {
entry:
%testval = alloca %i8.array
- %subrange = getelementptr inbounds %i8.array, %i8.array* %testval, i64 0, i32 0, i64 50
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %subrange = getelementptr inbounds %i8.array, ptr %testval, i64 0, i32 0, i64 50
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- call void @llvm.lifetime.start.p0i8(i64 50, i8* %subrange)
- call void @consume.i8(i8* %subrange)
- call void @llvm.lifetime.end.p0i8(i64 50, i8* %subrange)
- store %i8.array* %testval, %i8.array** %to_store
+ call void @llvm.lifetime.start.p0(i64 50, ptr %subrange)
+ call void @consume.i8(ptr %subrange)
+ call void @llvm.lifetime.end.p0(i64 50, ptr %subrange)
+ store ptr %testval, ptr %to_store
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
i8 0, label %await.ready
i8 1, label %exit
]
await.ready:
- %StrayCoroSave = call token @llvm.coro.save(i8* null)
+ %StrayCoroSave = call token @llvm.coro.save(ptr null)
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that for both foo and bar, testval isn't put on the frame.
-; CHECK: %foo.Frame = type { void (%foo.Frame*)*, void (%foo.Frame*)*, %i8.array, i1 }
+; CHECK: %foo.Frame = type { ptr, ptr, %i8.array, i1 }
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)
declare i1 @llvm.coro.alloc(token) #3
declare i64 @llvm.coro.size.i64() #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #3
-declare token @llvm.coro.save(i8*) #3
-declare i8* @llvm.coro.frame() #5
+declare ptr @llvm.coro.begin(token, ptr writeonly) #3
+declare token @llvm.coro.save(ptr) #3
+declare ptr @llvm.coro.frame() #5
declare i8 @llvm.coro.suspend(token, i1) #3
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #2
-declare i1 @llvm.coro.end(i8*, i1) #3
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #4
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #4
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #2
+declare i1 @llvm.coro.end(ptr, i1) #3
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #4
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #4
diff --git a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll
index 467af68d278c..d4415d38fd8b 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll
@@ -6,85 +6,80 @@ target datalayout = "p:64:64:64"
%async.actor = type { i64 }
%async.fp = type <{ i32, i32 }>
-%async.ctxt = type { i8*, void (i8*, %async.task*, %async.actor*)* }
+%async.ctxt = type { ptr, ptr }
; The async callee.
@my_other_async_function_fp = external global <{ i32, i32 }>
-declare void @my_other_async_function(i8* %async.ctxt)
+declare void @my_other_async_function(ptr %async.ctxt)
@my_async_function_fp = constant <{ i32, i32 }>
<{ i32 trunc ( ; Relative pointer to async function
i64 sub (
- i64 ptrtoint (void (i8*)* @my_async_function to i64),
- i64 ptrtoint (i32* getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @my_async_function_fp, i32 0, i32 1) to i64)
+ i64 ptrtoint (ptr @my_async_function to i64),
+ i64 ptrtoint (ptr getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @my_async_function_fp, i32 0, i32 1) to i64)
)
to i32),
i32 128 ; Initial async context size without space for frame
}>
-define swiftcc void @my_other_async_function_fp.apply(i8* %fnPtr, i8* %async.ctxt) {
- %callee = bitcast i8* %fnPtr to void(i8*)*
- tail call swiftcc void %callee(i8* %async.ctxt)
+define swiftcc void @my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) {
+ tail call swiftcc void %fnPtr(ptr %async.ctxt)
ret void
}
-declare void @escape(i64*)
-declare void @store_resume(i8*)
-define i8* @resume_context_projection(i8* %ctxt) {
+declare void @escape(ptr)
+declare void @store_resume(ptr)
+define ptr @resume_context_projection(ptr %ctxt) {
entry:
- %resume_ctxt_addr = bitcast i8* %ctxt to i8**
- %resume_ctxt = load i8*, i8** %resume_ctxt_addr, align 8
- ret i8* %resume_ctxt
+ %resume_ctxt = load ptr, ptr %ctxt, align 8
+ ret ptr %resume_ctxt
}
; The address of alloca escapes but the analysis based on lifetimes fails to see
; that it can't localize this alloca.
-; CHECK: define swiftcc void @my_async_function(i8* swiftasync %async.ctxt) {
+; CHECK: define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) {
; CHECK: entry:
; CHECK-NOT: ret
; CHECK-NOT: [[ESCAPED_ADDR:%.*]] = alloca i64, align 8
; CHECK: ret
-define swiftcc void @my_async_function(i8* swiftasync %async.ctxt) {
+define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) {
entry:
%escaped_addr = alloca i64
%id = call token @llvm.coro.id.async(i32 128, i32 16, i32 0,
- i8* bitcast (<{i32, i32}>* @my_async_function_fp to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- %ltb = bitcast i64* %escaped_addr to i8*
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %ltb)
- call void @escape(i64* %escaped_addr)
+ ptr bitcast (<{i32, i32}>* @my_async_function_fp to ptr))
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %escaped_addr)
+ call void @escape(ptr %escaped_addr)
br label %callblock
callblock:
- %callee_context = call i8* @context_alloc()
+ %callee_context = call ptr @context_alloc()
- %resume.func_ptr = call i8* @llvm.coro.async.resume()
- call void @store_resume(i8* %resume.func_ptr)
- %resume_proj_fun = bitcast i8*(i8*)* @resume_context_projection to i8*
- %callee = bitcast void(i8*)* @asyncSuspend to i8*
- %res = call {i8*, i8*, i8*} (i32, i8*, i8*, ...) @llvm.coro.suspend.async(i32 0,
- i8* %resume.func_ptr,
- i8* %resume_proj_fun,
- void (i8*, i8*)* @my_other_async_function_fp.apply,
- i8* %callee, i8* %callee_context)
+ %resume.func_ptr = call ptr @llvm.coro.async.resume()
+ call void @store_resume(ptr %resume.func_ptr)
+ %res = call {ptr, ptr, ptr} (i32, ptr, ptr, ...) @llvm.coro.suspend.async(i32 0,
+ ptr %resume.func_ptr,
+ ptr @resume_context_projection,
+ ptr @my_other_async_function_fp.apply,
+ ptr @asyncSuspend, ptr %callee_context)
br label %callblock
}
-declare { i8*, i8*, i8*, i8* } @llvm.coro.suspend.async.sl_p0i8p0i8p0i8p0i8s(i32, i8*, i8*, ...)
-declare i8* @llvm.coro.prepare.async(i8*)
-declare token @llvm.coro.id.async(i32, i32, i32, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end.async(i8*, i1, ...)
-declare i1 @llvm.coro.end(i8*, i1)
-declare {i8*, i8*, i8*} @llvm.coro.suspend.async(i32, i8*, i8*, ...)
-declare i8* @context_alloc()
-declare void @llvm.coro.async.context.dealloc(i8*)
-declare swiftcc void @asyncSuspend(i8*)
-declare i8* @llvm.coro.async.resume()
-declare void @llvm.coro.async.size.replace(i8*, i8*)
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #0
+declare { ptr, ptr, ptr, ptr } @llvm.coro.suspend.async.sl_p0i8p0i8p0i8p0i8s(i32, ptr, ptr, ...)
+declare ptr @llvm.coro.prepare.async(ptr)
+declare token @llvm.coro.id.async(i32, i32, i32, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end.async(ptr, i1, ...)
+declare i1 @llvm.coro.end(ptr, i1)
+declare {ptr, ptr, ptr} @llvm.coro.suspend.async(i32, ptr, ptr, ...)
+declare ptr @context_alloc()
+declare void @llvm.coro.async.context.dealloc(ptr)
+declare swiftcc void @asyncSuspend(ptr)
+declare ptr @llvm.coro.async.resume()
+declare void @llvm.coro.async.size.replace(ptr, ptr)
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
attributes #0 = { argmemonly nofree nosync nounwind willreturn }
diff --git a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll
index 8cc8aa68e377..0f125ad274ea 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll
@@ -6,64 +6,59 @@ target datalayout = "p:64:64:64"
%async.actor = type { i64 }
%async.fp = type <{ i32, i32 }>
-%async.ctxt = type { i8*, void (i8*, %async.task*, %async.actor*)* }
+%async.ctxt = type { ptr, ptr }
; The async callee.
@my_other_async_function_fp = external global <{ i32, i32 }>
-declare void @my_other_async_function(i8* %async.ctxt)
+declare void @my_other_async_function(ptr %async.ctxt)
@my_async_function_fp = constant <{ i32, i32 }>
<{ i32 trunc ( ; Relative pointer to async function
i64 sub (
- i64 ptrtoint (void (i8*)* @my_async_function to i64),
- i64 ptrtoint (i32* getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @my_async_function_fp, i32 0, i32 1) to i64)
+ i64 ptrtoint (ptr @my_async_function to i64),
+ i64 ptrtoint (ptr getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @my_async_function_fp, i32 0, i32 1) to i64)
)
to i32),
i32 128 ; Initial async context size without space for frame
}>
-define swiftcc void @my_other_async_function_fp.apply(i8* %fnPtr, i8* %async.ctxt) {
- %callee = bitcast i8* %fnPtr to void(i8*)*
- tail call swiftcc void %callee(i8* %async.ctxt)
+define swiftcc void @my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) {
+ tail call swiftcc void %fnPtr(ptr %async.ctxt)
ret void
}
-declare void @escape(i64*)
-declare void @store_resume(i8*)
+declare void @escape(ptr)
+declare void @store_resume(ptr)
declare i1 @exitLoop()
-define i8* @resume_context_projection(i8* %ctxt) {
+define ptr @resume_context_projection(ptr %ctxt) {
entry:
- %resume_ctxt_addr = bitcast i8* %ctxt to i8**
- %resume_ctxt = load i8*, i8** %resume_ctxt_addr, align 8
- ret i8* %resume_ctxt
+ %resume_ctxt = load ptr, ptr %ctxt, align 8
+ ret ptr %resume_ctxt
}
-define swiftcc void @my_async_function(i8* swiftasync %async.ctxt) {
+define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) {
entry:
%escaped_addr = alloca i64
%id = call token @llvm.coro.id.async(i32 128, i32 16, i32 0,
- i8* bitcast (<{i32, i32}>* @my_async_function_fp to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- %ltb = bitcast i64* %escaped_addr to i8*
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %ltb)
+ ptr bitcast (<{i32, i32}>* @my_async_function_fp to ptr))
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %escaped_addr)
br label %callblock
callblock:
- %callee_context = call i8* @context_alloc()
-
- %resume.func_ptr = call i8* @llvm.coro.async.resume()
- call void @store_resume(i8* %resume.func_ptr)
- %resume_proj_fun = bitcast i8*(i8*)* @resume_context_projection to i8*
- %callee = bitcast void(i8*)* @asyncSuspend to i8*
- %res = call {i8*, i8*, i8*} (i32, i8*, i8*, ...) @llvm.coro.suspend.async(i32 0,
- i8* %resume.func_ptr,
- i8* %resume_proj_fun,
- void (i8*, i8*)* @my_other_async_function_fp.apply,
- i8* %callee, i8* %callee_context)
- call void @escape(i64* %escaped_addr)
+ %callee_context = call ptr @context_alloc()
+
+ %resume.func_ptr = call ptr @llvm.coro.async.resume()
+ call void @store_resume(ptr %resume.func_ptr)
+ %res = call {ptr, ptr, ptr} (i32, ptr, ptr, ...) @llvm.coro.suspend.async(i32 0,
+ ptr %resume.func_ptr,
+ ptr @resume_context_projection,
+ ptr @my_other_async_function_fp.apply,
+ ptr @asyncSuspend, ptr %callee_context)
+ call void @escape(ptr %escaped_addr)
%exitCond = call i1 @exitLoop()
;; We used to move the lifetime.start intrinsic here =>
@@ -73,11 +68,11 @@ callblock:
; 2.) The code marks the stack object as not alive for part of the loop.
br i1 %exitCond, label %loop_exit, label %loop
- %res2 = call {i8*, i8*, i8*} (i32, i8*, i8*, ...) @llvm.coro.suspend.async(i32 0,
- i8* %resume.func_ptr,
- i8* %resume_proj_fun,
- void (i8*, i8*)* @my_other_async_function_fp.apply,
- i8* %callee, i8* %callee_context)
+ %res2 = call {ptr, ptr, ptr} (i32, ptr, ptr, ...) @llvm.coro.suspend.async(i32 0,
+ ptr %resume.func_ptr,
+ ptr @resume_context_projection,
+ ptr @my_other_async_function_fp.apply,
+ ptr @asyncSuspend, ptr %callee_context)
%exitCond2 = call i1 @exitLoop()
br i1 %exitCond2, label %loop_exit, label %loop
@@ -86,29 +81,29 @@ loop:
br label %callblock
loop_exit:
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %ltb)
- call i1 (i8*, i1, ...) @llvm.coro.end.async(i8* %hdl, i1 false)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %escaped_addr)
+ call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %hdl, i1 false)
unreachable
}
; CHECK: define {{.*}} void @my_async_function.resume.0(
-; CHECK-NOT: call void @llvm.lifetime.start.p0i8(i64 4, i8* %3)
+; CHECK-NOT: call void @llvm.lifetime.start.p0(i64 4, ptr %3)
; CHECK: br i1 %exitCond, label %loop_exit, label %loop
; CHECK: lifetime.end
; CHECK: }
-declare { i8*, i8*, i8*, i8* } @llvm.coro.suspend.async.sl_p0i8p0i8p0i8p0i8s(i32, i8*, i8*, ...)
-declare i8* @llvm.coro.prepare.async(i8*)
-declare token @llvm.coro.id.async(i32, i32, i32, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end.async(i8*, i1, ...)
-declare i1 @llvm.coro.end(i8*, i1)
-declare {i8*, i8*, i8*} @llvm.coro.suspend.async(i32, i8*, i8*, ...)
-declare i8* @context_alloc()
-declare void @llvm.coro.async.context.dealloc(i8*)
-declare swiftcc void @asyncSuspend(i8*)
-declare i8* @llvm.coro.async.resume()
-declare void @llvm.coro.async.size.replace(i8*, i8*)
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #0
+declare { ptr, ptr, ptr, ptr } @llvm.coro.suspend.async.sl_p0i8p0i8p0i8p0i8s(i32, ptr, ptr, ...)
+declare ptr @llvm.coro.prepare.async(ptr)
+declare token @llvm.coro.id.async(i32, i32, i32, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end.async(ptr, i1, ...)
+declare i1 @llvm.coro.end(ptr, i1)
+declare {ptr, ptr, ptr} @llvm.coro.suspend.async(i32, ptr, ptr, ...)
+declare ptr @context_alloc()
+declare void @llvm.coro.async.context.dealloc(ptr)
+declare swiftcc void @asyncSuspend(ptr)
+declare ptr @llvm.coro.async.resume()
+declare void @llvm.coro.async.size.replace(ptr, ptr)
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
attributes #0 = { argmemonly nofree nosync nounwind willreturn }
diff --git a/llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll b/llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll
index 2c75dc636127..3c9cdf91a02d 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll
@@ -2,43 +2,39 @@
target datalayout = "p:64:64:64"
%swift.async_func_pointer = type <{ i32, i32 }>
-%swift.context = type { %swift.context*, void (%swift.context*)* }
+%swift.context = type { ptr, ptr }
- at repoTU = global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (void (%swift.context*)* @repo to i64), i64 ptrtoint (%swift.async_func_pointer* @repoTU to i64)) to i32), i32 16 }>, align 8
+ at repoTU = global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @repo to i64), i64 ptrtoint (ptr @repoTU to i64)) to i32), i32 16 }>, align 8
-define swifttailcc void @repo(%swift.context* swiftasync %0) {
+define swifttailcc void @repo(ptr swiftasync %0) {
entry:
- %1 = alloca %swift.context*, align 8
- %2 = bitcast %swift.context* %0 to <{ %swift.context*, void (%swift.context*)* }>*
- %3 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, i8* bitcast (%swift.async_func_pointer* @repoTU to i8*))
- %4 = call i8* @llvm.coro.begin(token %3, i8* null)
- store %swift.context* %0, %swift.context** %1, align 8
- %5 = load %swift.context*, %swift.context** %1, align 8
- %6 = bitcast %swift.context* %5 to <{ %swift.context*, void (%swift.context*)* }>*
- %7 = getelementptr inbounds <{ %swift.context*, void (%swift.context*)* }>, <{ %swift.context*, void (%swift.context*)* }>* %6, i32 0, i32 1
- %8 = load void (%swift.context*)*, void (%swift.context*)** %7, align 8
- %9 = load %swift.context*, %swift.context** %1, align 8
- %10 = bitcast void (%swift.context*)* %8 to i8*
- %11 = call i1 (i8*, i1, ...) @llvm.coro.end.async(i8* %4, i1 false, void (i8*, %swift.context*)* @repo.0, i8* %10, %swift.context* %9)
+ %1 = alloca ptr, align 8
+ %2 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @repoTU)
+ %3 = call ptr @llvm.coro.begin(token %2, ptr null)
+ store ptr %0, ptr %1, align 8
+ %4 = load ptr, ptr %1, align 8
+ %5 = getelementptr inbounds <{ ptr, ptr }>, <{ ptr, ptr }>* %4, i32 0, i32 1
+ %6 = load ptr, ptr %5, align 8
+ %7 = load ptr, ptr %1, align 8
+ %8 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %3, i1 false, ptr @repo.0, ptr %6, ptr %7)
unreachable
}
; CHECK-NOT: llvm.coro.id.async
-define internal swifttailcc void @repo.0(i8* %0, %swift.context* %1) #1 {
+define internal swifttailcc void @repo.0(ptr %0, ptr %1) #1 {
entry:
- %2 = bitcast i8* %0 to void (%swift.context*)*
- musttail call swifttailcc void %2(%swift.context* swiftasync %1)
+ musttail call swifttailcc void %0(ptr swiftasync %1)
ret void
}
; Function Attrs: nounwind
-declare token @llvm.coro.id.async(i32, i32, i32, i8*) #1
+declare token @llvm.coro.id.async(i32, i32, i32, ptr) #1
; Function Attrs: nounwind
-declare i8* @llvm.coro.begin(token, i8* writeonly) #1
+declare ptr @llvm.coro.begin(token, ptr writeonly) #1
; Function Attrs: nounwind
-declare i1 @llvm.coro.end.async(i8*, i1, ...) #1
+declare i1 @llvm.coro.end.async(ptr, i1, ...) #1
attributes #1 = { nounwind }
diff --git a/llvm/test/Transforms/Coroutines/coro-async-end-bug.ll b/llvm/test/Transforms/Coroutines/coro-async-end-bug.ll
index 7315b50c5f2c..3c523dce0abc 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-end-bug.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-end-bug.ll
@@ -2,37 +2,32 @@
target datalayout = "p:64:64:64"
%swift.async_func_pointer = type <{ i32, i32 }>
-%swift.context = type { %swift.context*, void (%swift.context*)* }
+%swift.context = type { ptr, ptr }
%swift.opaque = type opaque
-%swift.refcounted = type { %swift.type*, i64 }
+%swift.refcounted = type { ptr, i64 }
%swift.type = type { i64 }
%swift.error = type opaque
- at repoTu = linkonce_odr hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (void (%swift.context*, %swift.opaque*, %swift.opaque*, i8*, %swift.refcounted*, %swift.type*, i8**, i8**)* @repo to i64), i64 ptrtoint (%swift.async_func_pointer* @repoTu to i64)) to i32), i32 16 }>, align 8
+ at repoTu = linkonce_odr hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @repo to i64), i64 ptrtoint (ptr @repoTu to i64)) to i32), i32 16 }>, align 8
-declare token @llvm.coro.id.async(i32, i32, i32, i8*) #0
+declare token @llvm.coro.id.async(i32, i32, i32, ptr) #0
-declare i8* @llvm.coro.begin(token, i8* writeonly) #0
+declare ptr @llvm.coro.begin(token, ptr writeonly) #0
-declare i1 @llvm.coro.end.async(i8*, i1, ...) #0
+declare i1 @llvm.coro.end.async(ptr, i1, ...) #0
-define swifttailcc void @repo(%swift.context* swiftasync %0, %swift.opaque* noalias nocapture %1, %swift.opaque* noalias nocapture %2, i8* %3, %swift.refcounted* %4, %swift.type* %Self, i8** %Self.AsyncSequence, i8** %Self.Element.Comparable) #1 {
+define swifttailcc void @repo(ptr swiftasync %0, ptr noalias nocapture %1, ptr noalias nocapture %2, ptr %3, ptr %4, ptr %Self, ptr %Self.AsyncSequence, ptr %Self.Element.Comparable) #1 {
entry:
- %5 = alloca %swift.context*, align 8
- %6 = bitcast %swift.context* %0 to <{ %swift.context*, void (%swift.context*)* }>*
- %7 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, i8* bitcast (%swift.async_func_pointer* @repoTu to i8*))
- %8 = call i8* @llvm.coro.begin(token %7, i8* null)
- store %swift.context* %0, %swift.context** %5, align 8
- %9 = bitcast i8* %3 to i1 (%swift.opaque*, %swift.opaque*, %swift.refcounted*)*
- %10 = call swiftcc i1 %9(%swift.opaque* noalias nocapture %1, %swift.opaque* noalias nocapture %2, %swift.refcounted* swiftself %4) #2
- %11 = load %swift.context*, %swift.context** %5, align 8
- %12 = bitcast %swift.context* %11 to <{ %swift.context*, void (%swift.context*)* }>*
- %13 = getelementptr inbounds <{ %swift.context*, void (%swift.context*)* }>, <{ %swift.context*, void (%swift.context*)* }>* %12, i32 0, i32 1
- %14 = load void (%swift.context*)*, void (%swift.context*)** %13, align 8
- %15 = bitcast void (%swift.context*)* %14 to void (%swift.context*, i1, %swift.error*)*
- %16 = load %swift.context*, %swift.context** %5, align 8
- %17 = bitcast void (%swift.context*, i1, %swift.error*)* %15 to i8*
- %18 = call i1 (i8*, i1, ...) @llvm.coro.end.async(i8* %8, i1 false, void (i8*, %swift.context*, i1, %swift.error*)* @repo.0, i8* %17, %swift.context* %16, i1 %10, %swift.error* null)
+ %5 = alloca ptr, align 8
+ %6 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @repoTu)
+ %7 = call ptr @llvm.coro.begin(token %6, ptr null)
+ store ptr %0, ptr %5, align 8
+ %8 = call swiftcc i1 %3(ptr noalias nocapture %1, ptr noalias nocapture %2, ptr swiftself %4) #2
+ %9 = load ptr, ptr %5, align 8
+ %10 = getelementptr inbounds <{ ptr, ptr }>, <{ ptr, ptr }>* %9, i32 0, i32 1
+ %11 = load ptr, ptr %10, align 8
+ %12 = load ptr, ptr %5, align 8
+ %13 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %7, i1 false, ptr @repo.0, ptr %11, ptr %12, i1 %8, ptr null)
unreachable
}
@@ -43,10 +38,9 @@ entry:
; CHECK-NOT: unreachable
; CHECK: ret
-define internal swifttailcc void @repo.0(i8* %0, %swift.context* %1, i1 %2, %swift.error* %3) #0 {
+define internal swifttailcc void @repo.0(ptr %0, ptr %1, i1 %2, ptr %3) #0 {
entry:
- %4 = bitcast i8* %0 to void (%swift.context*, i1, %swift.error*)*
- musttail call swifttailcc void %4(%swift.context* swiftasync %1, i1 %2, %swift.error* swiftself %3)
+ musttail call swifttailcc void %0(ptr swiftasync %1, i1 %2, ptr swiftself %3)
ret void
}
diff --git a/llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll b/llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll
index c5e9ac2200c6..aac3cc970962 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll
@@ -2,76 +2,72 @@
target datalayout = "p:64:64:64"
%swift.async_func_pointer = type <{ i32, i32 }>
-%swift.context = type { %swift.context*, void (%swift.context*)* }
+%swift.context = type { ptr, ptr }
- at repoTU = global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (void (%swift.context*)* @repo to i64), i64 ptrtoint (%swift.async_func_pointer* @repoTU to i64)) to i32), i32 16 }>, align 8
+ at repoTU = global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @repo to i64), i64 ptrtoint (ptr @repoTU to i64)) to i32), i32 16 }>, align 8
-declare swifttailcc void @callee.0(%swift.context* swiftasync, i8*, i64, i64)
+declare swifttailcc void @callee.0(ptr swiftasync, ptr, i64, i64)
-define internal swifttailcc void @callee(i8* %0, i64 %1, i64 %2, %swift.context* %3) {
+define internal swifttailcc void @callee(ptr %0, i64 %1, i64 %2, ptr %3) {
entry:
- musttail call swifttailcc void @callee.0(%swift.context* swiftasync %3, i8* %0, i64 %1, i64 %2)
+ musttail call swifttailcc void @callee.0(ptr swiftasync %3, ptr %0, i64 %1, i64 %2)
ret void
}
-define swifttailcc void @repo(%swift.context* swiftasync %0) {
+define swifttailcc void @repo(ptr swiftasync %0) {
entry:
- %1 = alloca %swift.context*, align 8
- %2 = bitcast %swift.context* %0 to <{ %swift.context*, void (%swift.context*)* }>*
- %3 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, i8* bitcast (%swift.async_func_pointer* @repoTU to i8*))
- %4 = call i8* @llvm.coro.begin(token %3, i8* null)
- store %swift.context* %0, %swift.context** %1, align 8
+ %1 = alloca ptr, align 8
+ %2 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @repoTU)
+ %3 = call ptr @llvm.coro.begin(token %2, ptr null)
+ store ptr %0, ptr %1, align 8
; This context.addr is the address in the frame of the first partial function after splitting.
- %5 = call i8** @llvm.swift.async.context.addr()
- store i8* null, i8** %5, align 8
+ %4 = call ptr @llvm.swift.async.context.addr()
+ store ptr null, ptr %4, align 8
- %6 = call i8* @llvm.coro.async.resume()
- %7 = call { i8* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0,
- i8* %6,
- i8* bitcast (i8* (i8*)* @__swift_async_resume_get_context to i8*),
- i8* bitcast (void (i8*, i64, i64, %swift.context*)* @callee to i8*),
- i8* %6, i64 0, i64 0, %swift.context* %0)
- %8 = load %swift.context*, %swift.context** %1, align 8
- %9 = bitcast %swift.context* %8 to <{ %swift.context*, void (%swift.context*)* }>*
- %10 = getelementptr inbounds <{ %swift.context*, void (%swift.context*)* }>, <{ %swift.context*, void (%swift.context*)* }>* %9, i32 0, i32 1
- %11 = load void (%swift.context*)*, void (%swift.context*)** %10, align 8
- %12 = load %swift.context*, %swift.context** %1, align 8
- %13 = bitcast void (%swift.context*)* %11 to i8*
+ %5 = call ptr @llvm.coro.async.resume()
+ %6 = call { ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0,
+ ptr %5,
+ ptr @__swift_async_resume_get_context,
+ ptr @callee,
+ ptr %5, i64 0, i64 0, ptr %0)
+ %7 = load ptr, ptr %1, align 8
+ %8 = getelementptr inbounds <{ ptr, ptr }>, <{ ptr, ptr }>* %7, i32 0, i32 1
+ %9 = load ptr, ptr %8, align 8
+ %10 = load ptr, ptr %1, align 8
; This context.addr is the address in the frame of the second partial function after splitting.
; It is not valid to CSE it with the previous call.
- %14 = call i8** @llvm.swift.async.context.addr()
- store i8* %13, i8** %14, align 8
+ %11 = call ptr @llvm.swift.async.context.addr()
+ store ptr %9, ptr %11, align 8
- %15 = call i1 (i8*, i1, ...) @llvm.coro.end.async(i8* %4, i1 false, void (i8*, %swift.context*)* @repo.0, i8* %13, %swift.context* %12)
+ %12 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %3, i1 false, ptr @repo.0, ptr %9, ptr %10)
unreachable
}
; Make sure we don't CSE the llvm.swift.async.context.addr calls
; CHECK: define swifttailcc void @repo
-; CHECK: call i8** @llvm.swift.async.context.addr()
+; CHECK: call ptr @llvm.swift.async.context.addr()
; CHECK: define {{.*}}swifttailcc void @repoTY0_
-; CHECK: call i8** @llvm.swift.async.context.addr()
+; CHECK: call ptr @llvm.swift.async.context.addr()
-define internal swifttailcc void @repo.0(i8* %0, %swift.context* %1) #1 {
+define internal swifttailcc void @repo.0(ptr %0, ptr %1) #1 {
entry:
- %2 = bitcast i8* %0 to void (%swift.context*)*
- musttail call swifttailcc void %2(%swift.context* swiftasync %1)
+ musttail call swifttailcc void %0(ptr swiftasync %1)
ret void
}
-define linkonce_odr hidden i8* @__swift_async_resume_get_context(i8* %0) #1 {
+define linkonce_odr hidden ptr @__swift_async_resume_get_context(ptr %0) #1 {
entry:
- ret i8* %0
+ ret ptr %0
}
-declare { i8* } @llvm.coro.suspend.async.sl_p0i8s(i32, i8*, i8*, ...) #1
-declare token @llvm.coro.id.async(i32, i32, i32, i8*) #1
-declare i8* @llvm.coro.begin(token, i8* writeonly) #1
-declare i1 @llvm.coro.end.async(i8*, i1, ...) #1
-declare i8* @llvm.coro.async.resume() #1
-declare i8** @llvm.swift.async.context.addr() #1
+declare { ptr } @llvm.coro.suspend.async.sl_p0i8s(i32, ptr, ptr, ...) #1
+declare token @llvm.coro.id.async(i32, i32, i32, ptr) #1
+declare ptr @llvm.coro.begin(token, ptr writeonly) #1
+declare i1 @llvm.coro.end.async(ptr, i1, ...) #1
+declare ptr @llvm.coro.async.resume() #1
+declare ptr @llvm.swift.async.context.addr() #1
attributes #1 = { nounwind }
diff --git a/llvm/test/Transforms/Coroutines/coro-async-phi.ll b/llvm/test/Transforms/Coroutines/coro-async-phi.ll
index c521601005af..a60ffa6feedd 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-phi.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-phi.ll
@@ -1,187 +1,167 @@
; RUN: opt < %s -O0 -S | FileCheck --check-prefixes=CHECK %s
%swift.async_func_pointer = type <{ i32, i32 }>
-%swift.context = type { %swift.context*, void (%swift.context*)*, i64 }
+%swift.context = type { ptr, ptr, i64 }
%T10RR13AC = type <{ %swift.refcounted, %swift.defaultactor }>
-%swift.refcounted = type { %swift.type*, i64 }
+%swift.refcounted = type { ptr, i64 }
%swift.type = type { i64 }
-%swift.defaultactor = type { [10 x i8*] }
+%swift.defaultactor = type { [10 x ptr] }
%swift.bridge = type opaque
%swift.error = type opaque
%swift.executor = type {}
- at repoTU = hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (void (%swift.context*, i64, i64, %T10RR13AC*)* @repo to i64), i64 ptrtoint (%swift.async_func_pointer* @repoTU to i64)) to i32), i32 20 }>, section "__TEXT,__const", align 8
+ at repoTU = hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @repo to i64), i64 ptrtoint (ptr @repoTU to i64)) to i32), i32 20 }>, section "__TEXT,__const", align 8
-declare void @use(i8*)
+declare void @use(ptr)
; This used to crash.
; CHECK: repo
-define hidden swifttailcc void @repo(%swift.context* swiftasync %arg, i64 %arg1, i64 %arg2, %T10RR13AC* swiftself %arg3) #0 {
+define hidden swifttailcc void @repo(ptr swiftasync %arg, i64 %arg1, i64 %arg2, ptr swiftself %arg3) #0 {
entry:
- %i = alloca %swift.context*, align 8
- %i11 = call token @llvm.coro.id.async(i32 20, i32 16, i32 0, i8* bitcast (%swift.async_func_pointer* @repoTU to i8*))
- %i12 = call i8* @llvm.coro.begin(token %i11, i8* null)
- %i18 = call i8* @llvm.coro.async.resume()
- call void @use(i8* %i18)
- %i21 = call { i8* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0, i8* %i18, i8* bitcast (i8* (i8*)* @__swift_async_resume_get_context to i8*), i8* bitcast (void (i8*, %swift.executor*, %swift.context*)* @__swift_suspend_point to i8*), i8* %i18, %swift.executor* null, %swift.context* null)
- %i22 = extractvalue { i8* } %i21, 0
- %i23 = call i8* @__swift_async_resume_get_context(i8* %i22)
+ %i = alloca ptr, align 8
+ %i11 = call token @llvm.coro.id.async(i32 20, i32 16, i32 0, ptr @repoTU)
+ %i12 = call ptr @llvm.coro.begin(token %i11, ptr null)
+ %i18 = call ptr @llvm.coro.async.resume()
+ call void @use(ptr %i18)
+ %i21 = call { ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0, ptr %i18, ptr @__swift_async_resume_get_context, ptr @__swift_suspend_point, ptr %i18, ptr null, ptr null)
+ %i22 = extractvalue { ptr } %i21, 0
+ %i23 = call ptr @__swift_async_resume_get_context(ptr %i22)
%i28 = icmp eq i64 %arg2, 0
br i1 %i28, label %bb126, label %bb
bb: ; preds = %entry
- %i29 = inttoptr i64 %arg2 to %swift.bridge*
+ %i29 = inttoptr i64 %arg2 to ptr
br label %bb30
bb30: ; preds = %bb
%i31 = phi i64 [ %arg1, %bb ]
- %i32 = phi %swift.bridge* [ %i29, %bb ]
- %i35 = ptrtoint %swift.bridge* %i32 to i64
- %i36 = bitcast %T10RR13AC* %arg3 to %swift.type**
- %i37 = load %swift.type*, %swift.type** %i36, align 8
- %i38 = bitcast %swift.type* %i37 to void (%swift.context*, i64, i64, %T10RR13AC*)**
- %i39 = getelementptr inbounds void (%swift.context*, i64, i64, %T10RR13AC*)*, void (%swift.context*, i64, i64, %T10RR13AC*)** %i38, i64 11
- %i40 = load void (%swift.context*, i64, i64, %T10RR13AC*)*, void (%swift.context*, i64, i64, %T10RR13AC*)** %i39, align 8
- %i41 = bitcast void (%swift.context*, i64, i64, %T10RR13AC*)* %i40 to %swift.async_func_pointer*
- %i42 = getelementptr inbounds %swift.async_func_pointer, %swift.async_func_pointer* %i41, i32 0, i32 0
- %i43 = load i32, i32* %i42, align 8
+ %i32 = phi ptr [ %i29, %bb ]
+ %i35 = ptrtoint ptr %i32 to i64
+ %i37 = load ptr, ptr %arg3, align 8
+ %i39 = getelementptr inbounds ptr, ptr %i37, i64 11
+ %i40 = load ptr, ptr %i39, align 8
+ %i43 = load i32, ptr %i40, align 8
%i44 = sext i32 %i43 to i64
- %i45 = ptrtoint i32* %i42 to i64
+ %i45 = ptrtoint ptr %i40 to i64
%i46 = add i64 %i45, %i44
- %i47 = inttoptr i64 %i46 to i8*
- %i48 = bitcast i8* %i47 to void (%swift.context*, i64, i64, %T10RR13AC*)*
- %i52 = call swiftcc i8* @swift_task_alloc(i64 24) #1
- %i53 = bitcast i8* %i52 to <{ %swift.context*, void (%swift.context*)*, i32 }>*
- %i54 = load %swift.context*, %swift.context** %i, align 8
- %i55 = getelementptr inbounds <{ %swift.context*, void (%swift.context*)*, i32 }>, <{ %swift.context*, void (%swift.context*)*, i32 }>* %i53, i32 0, i32 0
- store %swift.context* %i54, %swift.context** %i55, align 8
- %i56 = call i8* @llvm.coro.async.resume()
- call void @use(i8* %i56)
- %i57 = bitcast i8* %i56 to void (%swift.context*)*
- %i58 = getelementptr inbounds <{ %swift.context*, void (%swift.context*)*, i32 }>, <{ %swift.context*, void (%swift.context*)*, i32 }>* %i53, i32 0, i32 1
- store void (%swift.context*)* %i57, void (%swift.context*)** %i58, align 8
- %i59 = bitcast i8* %i52 to %swift.context*
- %i60 = bitcast void (%swift.context*, i64, i64, %T10RR13AC*)* %i48 to i8*
- %i61 = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(i32 256, i8* %i56, i8* bitcast (i8* (i8*)* @__swift_async_resume_project_context to i8*), i8* bitcast (void (i8*, %swift.context*, i64, i64, %T10RR13AC*)* @__swift_suspend_dispatch_4 to i8*), i8* %i60, %swift.context* %i59, i64 %i31, i64 0, %T10RR13AC* %arg3)
- %i62 = extractvalue { i8*, %swift.error* } %i61, 0
- %i63 = call i8* @__swift_async_resume_project_context(i8* %i62)
- %i64 = bitcast i8* %i63 to %swift.context*
- store %swift.context* %i64, %swift.context** %i, align 8
- %i65 = extractvalue { i8*, %swift.error* } %i61, 1
- call swiftcc void @swift_task_dealloc(i8* %i52) #1
+ %i47 = inttoptr i64 %i46 to ptr
+ %i52 = call swiftcc ptr @swift_task_alloc(i64 24) #1
+ %i54 = load ptr, ptr %i, align 8
+ %i55 = getelementptr inbounds <{ ptr, ptr, i32 }>, <{ ptr, ptr, i32 }>* %i52, i32 0, i32 0
+ store ptr %i54, ptr %i55, align 8
+ %i56 = call ptr @llvm.coro.async.resume()
+ call void @use(ptr %i56)
+ %i58 = getelementptr inbounds <{ ptr, ptr, i32 }>, <{ ptr, ptr, i32 }>* %i52, i32 0, i32 1
+ store ptr %i56, ptr %i58, align 8
+ %i61 = call { ptr, ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(i32 256, ptr %i56, ptr @__swift_async_resume_project_context, ptr @__swift_suspend_dispatch_4, ptr %i47, ptr %i52, i64 %i31, i64 0, ptr %arg3)
+ %i62 = extractvalue { ptr, ptr } %i61, 0
+ %i63 = call ptr @__swift_async_resume_project_context(ptr %i62)
+ store ptr %i63, ptr %i, align 8
+ %i65 = extractvalue { ptr, ptr } %i61, 1
+ call swiftcc void @swift_task_dealloc(ptr %i52) #1
br i1 %i28, label %bb126, label %bb68
bb68: ; preds = %bb30
- %i69 = call i8* @llvm.coro.async.resume()
- call void @use(i8* %i69)
- %i70 = load %swift.context*, %swift.context** %i, align 8
- %i71 = call { i8* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0, i8* %i69, i8* bitcast (i8* (i8*)* @__swift_async_resume_get_context to i8*), i8* bitcast (void (i8*, %swift.executor*, %swift.context*)* @__swift_suspend_point to i8*), i8* %i69, %swift.executor* null, %swift.context* %i70)
- %i77 = ptrtoint %swift.bridge* %i32 to i64
- %i78 = bitcast %T10RR13AC* %arg3 to %swift.type**
- %i79 = load %swift.type*, %swift.type** %i78, align 8
- %i80 = bitcast %swift.type* %i79 to void (%swift.context*, i64, i64, %T10RR13AC*)**
- %i81 = getelementptr inbounds void (%swift.context*, i64, i64, %T10RR13AC*)*, void (%swift.context*, i64, i64, %T10RR13AC*)** %i80, i64 11
- %i82 = load void (%swift.context*, i64, i64, %T10RR13AC*)*, void (%swift.context*, i64, i64, %T10RR13AC*)** %i81, align 8
- %i83 = bitcast void (%swift.context*, i64, i64, %T10RR13AC*)* %i82 to %swift.async_func_pointer*
- %i84 = getelementptr inbounds %swift.async_func_pointer, %swift.async_func_pointer* %i83, i32 0, i32 0
- %i85 = load i32, i32* %i84, align 8
+ %i69 = call ptr @llvm.coro.async.resume()
+ call void @use(ptr %i69)
+ %i70 = load ptr, ptr %i, align 8
+ %i71 = call { ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0, ptr %i69, ptr @__swift_async_resume_get_context, ptr @__swift_suspend_point, ptr %i69, ptr null, ptr %i70)
+ %i77 = ptrtoint ptr %i32 to i64
+ %i79 = load ptr, ptr %arg3, align 8
+ %i81 = getelementptr inbounds ptr, ptr %i79, i64 11
+ %i82 = load ptr, ptr %i81, align 8
+ %i85 = load i32, ptr %i82, align 8
%i86 = sext i32 %i85 to i64
- %i87 = ptrtoint i32* %i84 to i64
+ %i87 = ptrtoint ptr %i82 to i64
%i88 = add i64 %i87, %i86
- %i89 = inttoptr i64 %i88 to i8*
- %i90 = bitcast i8* %i89 to void (%swift.context*, i64, i64, %T10RR13AC*)*
- %i94 = call swiftcc i8* @swift_task_alloc(i64 24) #1
- %i98 = call i8* @llvm.coro.async.resume()
- call void @use(i8* %i98)
- %i102 = bitcast void (%swift.context*, i64, i64, %T10RR13AC*)* %i90 to i8*
- %i103 = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(i32 256, i8* %i98, i8* bitcast (i8* (i8*)* @__swift_async_resume_project_context to i8*), i8* bitcast (void (i8*, %swift.context*, i64, i64, %T10RR13AC*)* @__swift_suspend_dispatch_4.1 to i8*), i8* %i102, %swift.context* null, i64 %i31, i64 0, %T10RR13AC* %arg3)
- call swiftcc void @swift_task_dealloc(i8* %i94) #1
+ %i89 = inttoptr i64 %i88 to ptr
+ %i94 = call swiftcc ptr @swift_task_alloc(i64 24) #1
+ %i98 = call ptr @llvm.coro.async.resume()
+ call void @use(ptr %i98)
+ %i103 = call { ptr, ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(i32 256, ptr %i98, ptr @__swift_async_resume_project_context, ptr @__swift_suspend_dispatch_4.1, ptr %i89, ptr null, i64 %i31, i64 0, ptr %arg3)
+ call swiftcc void @swift_task_dealloc(ptr %i94) #1
br label %bb126
bb126:
- %i162 = call i1 (i8*, i1, ...) @llvm.coro.end.async(i8* %i12, i1 false, void (i8*, %swift.context*, %swift.error*)* @__swift_suspend_dispatch_2, i8* bitcast (void (%swift.context*, %swift.error*)* @doIt to i8*), %swift.context* null, %swift.error* null)
+ %i162 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %i12, i1 false, ptr @__swift_suspend_dispatch_2, ptr @doIt, ptr null, ptr null)
unreachable
}
; Function Attrs: nounwind
-declare token @llvm.coro.id.async(i32, i32, i32, i8*) #1
+declare token @llvm.coro.id.async(i32, i32, i32, ptr) #1
; Function Attrs: nounwind
-declare i8* @llvm.coro.begin(token, i8* writeonly) #1
+declare ptr @llvm.coro.begin(token, ptr writeonly) #1
; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
-declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #3
+declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nounwind
-declare i8* @llvm.coro.async.resume() #1
+declare ptr @llvm.coro.async.resume() #1
; Function Attrs: noinline
-define linkonce_odr hidden i8* @__swift_async_resume_get_context(i8* %arg) #4 {
+define linkonce_odr hidden ptr @__swift_async_resume_get_context(ptr %arg) #4 {
entry:
- ret i8* %arg
+ ret ptr %arg
}
; Function Attrs: nounwind
-declare extern_weak swifttailcc void @swift_task_switch(%swift.context*, i8*, %swift.executor*) #1
+declare extern_weak swifttailcc void @swift_task_switch(ptr, ptr, ptr) #1
; Function Attrs: nounwind
-define internal swifttailcc void @__swift_suspend_point(i8* %arg, %swift.executor* %arg1, %swift.context* %arg2) #1 {
+define internal swifttailcc void @__swift_suspend_point(ptr %arg, ptr %arg1, ptr %arg2) #1 {
entry:
- musttail call swifttailcc void @swift_task_switch(%swift.context* swiftasync %arg2, i8* %arg, %swift.executor* %arg1) #1
+ musttail call swifttailcc void @swift_task_switch(ptr swiftasync %arg2, ptr %arg, ptr %arg1) #1
ret void
}
; Function Attrs: nounwind
-declare { i8* } @llvm.coro.suspend.async.sl_p0i8s(i32, i8*, i8*, ...) #1
+declare { ptr } @llvm.coro.suspend.async.sl_p0i8s(i32, ptr, ptr, ...) #1
; Function Attrs: nounwind
-declare i1 @llvm.coro.end.async(i8*, i1, ...) #1
+declare i1 @llvm.coro.end.async(ptr, i1, ...) #1
; Function Attrs: argmemonly nounwind
-declare extern_weak swiftcc i8* @swift_task_alloc(i64) #5
+declare extern_weak swiftcc ptr @swift_task_alloc(i64) #5
; Function Attrs: nounwind readnone
-declare i8** @llvm.swift.async.context.addr() #6
+declare ptr @llvm.swift.async.context.addr() #6
; Function Attrs: alwaysinline nounwind
-define linkonce_odr hidden i8* @__swift_async_resume_project_context(i8* %arg) #7 {
+define linkonce_odr hidden ptr @__swift_async_resume_project_context(ptr %arg) #7 {
entry:
- %i = bitcast i8* %arg to i8**
- %i1 = load i8*, i8** %i, align 8
- %i2 = call i8** @llvm.swift.async.context.addr()
- store i8* %i1, i8** %i2, align 8
- ret i8* %i1
+ %i1 = load ptr, ptr %arg, align 8
+ %i2 = call ptr @llvm.swift.async.context.addr()
+ store ptr %i1, ptr %i2, align 8
+ ret ptr %i1
}
; Function Attrs: nounwind
-declare { i8*, %swift.error* } @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(i32, i8*, i8*, ...) #1
+declare { ptr, ptr } @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(i32, ptr, ptr, ...) #1
; Function Attrs: argmemonly nounwind
-declare extern_weak swiftcc void @swift_task_dealloc(i8*) #5
+declare extern_weak swiftcc void @swift_task_dealloc(ptr) #5
; Function Attrs: nounwind
-define internal swifttailcc void @__swift_suspend_dispatch_4(i8* %arg, %swift.context* %arg1, i64 %arg2, i64 %arg3, %T10RR13AC* %arg4) #1 {
+define internal swifttailcc void @__swift_suspend_dispatch_4(ptr %arg, ptr %arg1, i64 %arg2, i64 %arg3, ptr %arg4) #1 {
entry:
- %i = bitcast i8* %arg to void (%swift.context*, i64, i64, %T10RR13AC*)*
- musttail call swifttailcc void %i(%swift.context* swiftasync %arg1, i64 %arg2, i64 %arg3, %T10RR13AC* swiftself %arg4)
+ musttail call swifttailcc void %arg(ptr swiftasync %arg1, i64 %arg2, i64 %arg3, ptr swiftself %arg4)
ret void
}
-declare swifttailcc void @doIt(%swift.context* swiftasync %arg1, %swift.error* swiftself %arg2)
+declare swifttailcc void @doIt(ptr swiftasync %arg1, ptr swiftself %arg2)
; Function Attrs: nounwind
-define internal swifttailcc void @__swift_suspend_dispatch_2(i8* %arg, %swift.context* %arg1, %swift.error* %arg2) #1 {
+define internal swifttailcc void @__swift_suspend_dispatch_2(ptr %arg, ptr %arg1, ptr %arg2) #1 {
entry:
- %i = bitcast i8* %arg to void (%swift.context*, %swift.error*)*
- musttail call swifttailcc void %i(%swift.context* swiftasync %arg1, %swift.error* swiftself %arg2)
+ musttail call swifttailcc void %arg(ptr swiftasync %arg1, ptr swiftself %arg2)
ret void
}
; Function Attrs: nounwind
-define internal swifttailcc void @__swift_suspend_dispatch_4.1(i8* %arg, %swift.context* %arg1, i64 %arg2, i64 %arg3, %T10RR13AC* %arg4) #1 {
+define internal swifttailcc void @__swift_suspend_dispatch_4.1(ptr %arg, ptr %arg1, i64 %arg2, i64 %arg3, ptr %arg4) #1 {
entry:
- %i = bitcast i8* %arg to void (%swift.context*, i64, i64, %T10RR13AC*)*
- musttail call swifttailcc void %i(%swift.context* swiftasync %arg1, i64 %arg2, i64 %arg3, %T10RR13AC* swiftself %arg4)
+ musttail call swifttailcc void %arg(ptr swiftasync %arg1, i64 %arg2, i64 %arg3, ptr swiftself %arg4)
ret void
}
diff --git a/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll b/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll
index d70820e43215..a718c4033cff 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll
@@ -6,82 +6,73 @@ target datalayout = "p:64:64:64"
%async.actor = type { i64 }
%async.fp = type <{ i32, i32 }>
-%async.ctxt = type { i8*, void (i8*, %async.task*, %async.actor*)* }
+%async.ctxt = type { ptr, ptr }
; The async callee.
@my_other_async_function_fp = external global <{ i32, i32 }>
-declare void @my_other_async_function(i8* %async.ctxt)
+declare void @my_other_async_function(ptr %async.ctxt)
; Function that implements the dispatch to the callee function.
-define swiftcc void @my_async_function.my_other_async_function_fp.apply(i8* %fnPtr, i8* %async.ctxt, %async.task* %task, %async.actor* %actor) {
- %callee = bitcast i8* %fnPtr to void(i8*, %async.task*, %async.actor*)*
- tail call swiftcc void %callee(i8* %async.ctxt, %async.task* %task, %async.actor* %actor)
+define swiftcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) {
+ tail call swiftcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor)
ret void
}
declare void @some_user(i64)
-declare void @some_may_write(i64*)
+declare void @some_may_write(ptr)
-define i8* @resume_context_projection(i8* %ctxt) {
+define ptr @resume_context_projection(ptr %ctxt) {
entry:
- %resume_ctxt_addr = bitcast i8* %ctxt to i8**
- %resume_ctxt = load i8*, i8** %resume_ctxt_addr, align 8
- ret i8* %resume_ctxt
+ %resume_ctxt = load ptr, ptr %ctxt, align 8
+ ret ptr %resume_ctxt
}
@unreachable_fp = constant <{ i32, i32 }>
<{ i32 trunc ( ; Relative pointer to async function
i64 sub (
- i64 ptrtoint (void (i8*, %async.task*, %async.actor*)* @unreachable to i64),
- i64 ptrtoint (i32* getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @unreachable_fp, i32 0, i32 1) to i64)
+ i64 ptrtoint (ptr @unreachable to i64),
+ i64 ptrtoint (ptr getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @unreachable_fp, i32 0, i32 1) to i64)
)
to i32),
i32 128 ; Initial async context size without space for frame
}>
-define swiftcc void @unreachable(i8* %async.ctxt, %async.task* %task, %async.actor* %actor) {
+define swiftcc void @unreachable(ptr %async.ctxt, ptr %task, ptr %actor) {
entry:
%tmp = alloca { i64, i64 }, align 8
- %proj.1 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %tmp, i64 0, i32 0
- %proj.2 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %tmp, i64 0, i32 1
+ %proj.1 = getelementptr inbounds { i64, i64 }, ptr %tmp, i64 0, i32 0
+ %proj.2 = getelementptr inbounds { i64, i64 }, ptr %tmp, i64 0, i32 1
%id = call token @llvm.coro.id.async(i32 128, i32 16, i32 0,
- i8* bitcast (<{i32, i32}>* @unreachable_fp to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- store i64 0, i64* %proj.1, align 8
- store i64 1, i64* %proj.2, align 8
- call void @some_may_write(i64* %proj.1)
+ ptr bitcast (<{i32, i32}>* @unreachable_fp to ptr))
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ store i64 0, ptr %proj.1, align 8
+ store i64 1, ptr %proj.2, align 8
+ call void @some_may_write(ptr %proj.1)
; Begin lowering: apply %my_other_async_function(%args...)
; setup callee context
- %arg0 = bitcast %async.task* %task to i8*
- %arg1 = bitcast <{ i32, i32}>* @my_other_async_function_fp to i8*
- %callee_context = call i8* @llvm.coro.async.context.alloc(i8* %arg0, i8* %arg1)
- %callee_context.0 = bitcast i8* %callee_context to %async.ctxt*
+ %arg1 = bitcast <{ i32, i32}>* @my_other_async_function_fp to ptr
+ %callee_context = call ptr @llvm.coro.async.context.alloc(ptr %task, ptr %arg1)
; store the return continuation
- %callee_context.return_to_caller.addr = getelementptr inbounds %async.ctxt, %async.ctxt* %callee_context.0, i32 0, i32 1
- %return_to_caller.addr = bitcast void(i8*, %async.task*, %async.actor*)** %callee_context.return_to_caller.addr to i8**
- %resume.func_ptr = call i8* @llvm.coro.async.resume()
- store i8* %resume.func_ptr, i8** %return_to_caller.addr
+ %callee_context.return_to_caller.addr = getelementptr inbounds %async.ctxt, ptr %callee_context, i32 0, i32 1
+ %resume.func_ptr = call ptr @llvm.coro.async.resume()
+ store ptr %resume.func_ptr, ptr %callee_context.return_to_caller.addr
; store caller context into callee context
- %callee_context.caller_context.addr = getelementptr inbounds %async.ctxt, %async.ctxt* %callee_context.0, i32 0, i32 0
- store i8* %async.ctxt, i8** %callee_context.caller_context.addr
- %resume_proj_fun = bitcast i8*(i8*)* @resume_context_projection to i8*
- %callee = bitcast void(i8*, %async.task*, %async.actor*)* @asyncSuspend to i8*
- %res = call {i8*, i8*, i8*} (i32, i8*, i8*, ...) @llvm.coro.suspend.async(i32 0,
- i8* %resume.func_ptr,
- i8* %resume_proj_fun,
- void (i8*, i8*, %async.task*, %async.actor*)* @my_async_function.my_other_async_function_fp.apply,
- i8* %callee, i8* %callee_context, %async.task* %task, %async.actor *%actor)
-
- call void @llvm.coro.async.context.dealloc(i8* %callee_context)
- %continuation_task_arg = extractvalue {i8*, i8*, i8*} %res, 1
- %task.2 = bitcast i8* %continuation_task_arg to %async.task*
- %val = load i64, i64* %proj.1
+ store ptr %async.ctxt, ptr %callee_context
+ %res = call {ptr, ptr, ptr} (i32, ptr, ptr, ...) @llvm.coro.suspend.async(i32 0,
+ ptr %resume.func_ptr,
+ ptr @resume_context_projection,
+ ptr @my_async_function.my_other_async_function_fp.apply,
+ ptr @asyncSuspend, ptr %callee_context, ptr %task, ptr %actor)
+
+ call void @llvm.coro.async.context.dealloc(ptr %callee_context)
+ %continuation_task_arg = extractvalue {ptr, ptr, ptr} %res, 1
+ %val = load i64, ptr %proj.1
call void @some_user(i64 %val)
- %val.2 = load i64, i64* %proj.2
+ %val.2 = load i64, ptr %proj.2
call void @some_user(i64 %val.2)
unreachable
}
@@ -93,12 +84,12 @@ entry:
; CHECK: define internal swiftcc void @unreachable.resume.0
; CHECK: unreachable
-declare i8* @llvm.coro.prepare.async(i8*)
-declare token @llvm.coro.id.async(i32, i32, i32, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare {i8*, i8*, i8*} @llvm.coro.suspend.async(i32, i8*, i8*, ...)
-declare i8* @llvm.coro.async.context.alloc(i8*, i8*)
-declare void @llvm.coro.async.context.dealloc(i8*)
-declare swiftcc void @asyncReturn(i8*, %async.task*, %async.actor*)
-declare swiftcc void @asyncSuspend(i8*, %async.task*, %async.actor*)
-declare i8* @llvm.coro.async.resume()
+declare ptr @llvm.coro.prepare.async(ptr)
+declare token @llvm.coro.id.async(i32, i32, i32, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare {ptr, ptr, ptr} @llvm.coro.suspend.async(i32, ptr, ptr, ...)
+declare ptr @llvm.coro.async.context.alloc(ptr, ptr)
+declare void @llvm.coro.async.context.dealloc(ptr)
+declare swiftcc void @asyncReturn(ptr, ptr, ptr)
+declare swiftcc void @asyncSuspend(ptr, ptr, ptr)
+declare ptr @llvm.coro.async.resume()
diff --git a/llvm/test/Transforms/Coroutines/coro-byval-param.ll b/llvm/test/Transforms/Coroutines/coro-byval-param.ll
index dd3cf9bd664b..5f7c1939f9f4 100644
--- a/llvm/test/Transforms/Coroutines/coro-byval-param.ll
+++ b/llvm/test/Transforms/Coroutines/coro-byval-param.ll
@@ -3,115 +3,112 @@
%struct.A = type <{ i64, i64, i32, [4 x i8] }>
; Function Attrs: noinline ssp uwtable mustprogress
-define %promise_type* @foo(%struct.A* nocapture readonly byval(%struct.A) align 8 %a1) #0 {
+define ptr @foo(ptr nocapture readonly byval(%struct.A) align 8 %a1) #0 {
entry:
%__promise = alloca %promise_type, align 1
%a2 = alloca %struct.A, align 8
- %0 = getelementptr inbounds %promise_type, %promise_type* %__promise, i64 0, i32 0
- %1 = call token @llvm.coro.id(i32 16, i8* nonnull %0, i8* bitcast (%promise_type* (%struct.A*)* @foo to i8*), i8* null)
- %2 = call i1 @llvm.coro.alloc(token %1)
- br i1 %2, label %coro.alloc, label %coro.init
+ %0 = call token @llvm.coro.id(i32 16, ptr nonnull %__promise, ptr @foo, ptr null)
+ %1 = call i1 @llvm.coro.alloc(token %0)
+ br i1 %1, label %coro.alloc, label %coro.init
coro.alloc: ; preds = %entry
- %3 = call i64 @llvm.coro.size.i64()
- %call = call noalias nonnull i8* @_Znwm(i64 %3) #9
+ %2 = call i64 @llvm.coro.size.i64()
+ %call = call noalias nonnull ptr @_Znwm(i64 %2) #9
br label %coro.init
coro.init: ; preds = %coro.alloc, %entry
- %4 = phi i8* [ null, %entry ], [ %call, %coro.alloc ]
- %5 = call i8* @llvm.coro.begin(token %1, i8* %4) #10
- %6 = bitcast %struct.A* %a1 to i8*
- call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %0) #2
- %call2 = call %promise_type* @_ZN4task12promise_type17get_return_objectEv(%promise_type* nonnull dereferenceable(1) %__promise)
- call void @initial_suspend(%promise_type* nonnull dereferenceable(1) %__promise)
- %7 = call token @llvm.coro.save(i8* null)
- call fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(i8* %5) #2
- %8 = call i8 @llvm.coro.suspend(token %7, i1 false)
- switch i8 %8, label %coro.ret [
+ %3 = phi ptr [ null, %entry ], [ %call, %coro.alloc ]
+ %4 = call ptr @llvm.coro.begin(token %0, ptr %3) #10
+ call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %__promise) #2
+ %call2 = call ptr @_ZN4task12promise_type17get_return_objectEv(ptr nonnull dereferenceable(1) %__promise)
+ call void @initial_suspend(ptr nonnull dereferenceable(1) %__promise)
+ %5 = call token @llvm.coro.save(ptr null)
+ call fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(ptr %4) #2
+ %6 = call i8 @llvm.coro.suspend(token %5, i1 false)
+ switch i8 %6, label %coro.ret [
i8 0, label %init.ready
i8 1, label %cleanup33
]
init.ready: ; preds = %coro.init
- %9 = bitcast %struct.A* %a2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %9) #2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %9, i8* align 8 %6, i64 24, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %9) #2
- call void @_ZN4task12promise_type13final_suspendEv(%promise_type* nonnull dereferenceable(1) %__promise) #2
- %10 = call token @llvm.coro.save(i8* null)
- call fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(i8* %5) #2
- %11 = call i8 @llvm.coro.suspend(token %10, i1 true) #10
- %switch = icmp ult i8 %11, 2
+ call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %a2) #2
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a2, ptr align 8 %a1, i64 24, i1 false)
+ call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %a2) #2
+ call void @_ZN4task12promise_type13final_suspendEv(ptr nonnull dereferenceable(1) %__promise) #2
+ %7 = call token @llvm.coro.save(ptr null)
+ call fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(ptr %4) #2
+ %8 = call i8 @llvm.coro.suspend(token %7, i1 true) #10
+ %switch = icmp ult i8 %8, 2
br i1 %switch, label %cleanup33, label %coro.ret
cleanup33: ; preds = %init.ready, %coro.init
- call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %0) #2
- %12 = call i8* @llvm.coro.free(token %1, i8* %5)
- %.not = icmp eq i8* %12, null
+ call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %__promise) #2
+ %9 = call ptr @llvm.coro.free(token %0, ptr %4)
+ %.not = icmp eq ptr %9, null
br i1 %.not, label %coro.ret, label %coro.free
coro.free: ; preds = %cleanup33
- call void @_ZdlPv(i8* nonnull %12) #2
+ call void @_ZdlPv(ptr nonnull %9) #2
br label %coro.ret
coro.ret: ; preds = %coro.free, %cleanup33, %init.ready, %coro.init
- %13 = call i1 @llvm.coro.end(i8* null, i1 false) #10
- ret %promise_type* %call2
+ %10 = call i1 @llvm.coro.end(ptr null, i1 false) #10
+ ret ptr %call2
}
; check that the frame contains the entire struct, instead of just the struct pointer
-; CHECK: %foo.Frame = type { void (%foo.Frame*)*, void (%foo.Frame*)*, %promise_type, %struct.A, i1 }
+; CHECK: %foo.Frame = type { ptr, ptr, %promise_type, %struct.A, i1 }
; Function Attrs: argmemonly nounwind readonly
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
; Function Attrs: nounwind
declare i1 @llvm.coro.alloc(token) #2
; Function Attrs: nobuiltin nofree allocsize(0)
-declare nonnull i8* @_Znwm(i64) local_unnamed_addr #3
+declare nonnull ptr @_Znwm(i64) local_unnamed_addr #3
; Function Attrs: nounwind readnone
declare i64 @llvm.coro.size.i64() #4
; Function Attrs: nounwind
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
; Function Attrs: argmemonly nofree nosync nounwind willreturn
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #5
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: argmemonly nofree nounwind willreturn
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #6
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress
-declare %promise_type* @_ZN4task12promise_type17get_return_objectEv(%promise_type* nonnull dereferenceable(1)) local_unnamed_addr #7 align 2
+declare ptr @_ZN4task12promise_type17get_return_objectEv(ptr nonnull dereferenceable(1)) local_unnamed_addr #7 align 2
; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress
-declare void @initial_suspend(%promise_type* nonnull dereferenceable(1)) local_unnamed_addr #7 align 2
+declare void @initial_suspend(ptr nonnull dereferenceable(1)) local_unnamed_addr #7 align 2
; Function Attrs: nounwind
-declare token @llvm.coro.save(i8*) #2
+declare token @llvm.coro.save(ptr) #2
; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress
-declare hidden fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(i8*) unnamed_addr #7 align 2
+declare hidden fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(ptr) unnamed_addr #7 align 2
; Function Attrs: argmemonly nofree nosync nounwind willreturn
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #5
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nounwind
declare i8 @llvm.coro.suspend(token, i1) #2
; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress
-declare void @_ZN4task12promise_type13final_suspendEv(%promise_type* nonnull dereferenceable(1)) local_unnamed_addr #7 align 2
+declare void @_ZN4task12promise_type13final_suspendEv(ptr nonnull dereferenceable(1)) local_unnamed_addr #7 align 2
; Function Attrs: nounwind
-declare i1 @llvm.coro.end(i8*, i1) #2
+declare i1 @llvm.coro.end(ptr, i1) #2
; Function Attrs: nobuiltin nounwind
-declare void @_ZdlPv(i8*) local_unnamed_addr #8
+declare void @_ZdlPv(ptr) local_unnamed_addr #8
; Function Attrs: argmemonly nounwind readonly
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
attributes #0 = { noinline ssp uwtable mustprogress presplitcoroutine "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll b/llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
index 9c9a0c436447..f6f4607b3e81 100644
--- a/llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
+++ b/llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
@@ -3,9 +3,9 @@
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg<switch-range-to-icmp>,early-cse' -S | FileCheck %s
declare i32 @__CxxFrameHandler3(...)
-define i8* @f2(i1 %val) presplitcoroutine personality i32 (...)* @__CxxFrameHandler3 {
+define ptr @f2(i1 %val) presplitcoroutine personality ptr @__CxxFrameHandler3 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%valueA = call i32 @f();
%valueB = call i32 @f();
%need.alloc = call i1 @llvm.coro.alloc(token %id)
@@ -13,12 +13,12 @@ entry:
dyn.alloc:
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
+ %alloc = call ptr @malloc(i32 %size)
br label %dowork.0
dowork.0:
- %phi = phi i8* [ null, %entry ], [ %alloc, %dyn.alloc ]
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %phi)
+ %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %phi)
invoke void @print(i32 0)
to label %checksuspend unwind label %catch.dispatch.1
@@ -32,18 +32,18 @@ dowork.1:
to label %checksuspend unwind label %catch.dispatch.1
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
catch.dispatch.1:
%cs1 = catchswitch within none [label %handler1] unwind to caller
handler1:
- %h1 = catchpad within %cs1 [i8* null, i32 64, i8* null]
+ %h1 = catchpad within %cs1 [ptr null, i32 64, ptr null]
invoke void @print(i32 2) [ "funclet"(token %h1) ]
to label %catchret1 unwind label %catch.dispatch.2
catchret1:
@@ -52,7 +52,7 @@ catchret1:
catch.dispatch.2:
%cs2 = catchswitch within %h1 [label %handler2] unwind label %cleanup2
handler2:
- %h2 = catchpad within %cs2 [i8* null, i32 64, i8* null]
+ %h2 = catchpad within %cs2 [ptr null, i32 64, ptr null]
invoke void @print(i32 3) [ "funclet"(token %h2) ]
to label %cleanup unwind label %cleanup2
cleanup2:
@@ -84,11 +84,11 @@ cleanup2:
; CHECK: br i1 %switch, label %cleanup2.from.handler2, label %cleanup2.from.catch.dispatch.2
; CHECK: cleanup2.from.handler2:
-; CHECK: %valueB.reload = load i32, i32* %valueB.spill.addr, align 4
+; CHECK: %valueB.reload = load i32, ptr %valueB.spill.addr, align 4
; CHECK: br label %cleanup2
; CHECK: cleanup2.from.catch.dispatch.2:
-; CHECK: %valueA.reload = load i32, i32* %valueA.spill.addr, align 4
+; CHECK: %valueA.reload = load i32, ptr %valueA.spill.addr, align 4
; CHECK: br label %cleanup2
; CHECK: cleanup2:
@@ -97,19 +97,19 @@ cleanup2:
; CHECK: br label %cleanup
}
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
declare i32 @f()
diff --git a/llvm/test/Transforms/Coroutines/coro-cleanup-lowering.ll b/llvm/test/Transforms/Coroutines/coro-cleanup-lowering.ll
index e2e03efc3368..321d1bc5afc7 100644
--- a/llvm/test/Transforms/Coroutines/coro-cleanup-lowering.ll
+++ b/llvm/test/Transforms/Coroutines/coro-cleanup-lowering.ll
@@ -5,25 +5,22 @@
; CHECK-NOT: @llvm.coro
; CHECK: ret void
-define void @uses_library_support_coro_intrinsics(i8* %hdl) {
+define void @uses_library_support_coro_intrinsics(ptr %hdl) {
entry:
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
- %4 = bitcast i8* %hdl to i8**
- %5 = load i8*, i8** %4
- %6 = icmp eq i8* %5, null
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
+ %2 = load ptr, ptr %hdl
+ %3 = icmp eq ptr %2, null
ret void
}
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
; Function Attrs: argmemonly nounwind
-declare i1 @llvm.coro.done(i8* nocapture readonly) #0
+declare i1 @llvm.coro.done(ptr nocapture readonly) #0
; Function Attrs: argmemonly nounwind readonly
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
attributes #0 = { argmemonly nounwind }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-cleanup.ll b/llvm/test/Transforms/Coroutines/coro-cleanup.ll
index fb35b02982a1..02671e34a18a 100644
--- a/llvm/test/Transforms/Coroutines/coro-cleanup.ll
+++ b/llvm/test/Transforms/Coroutines/coro-cleanup.ll
@@ -4,15 +4,15 @@
; CHECK-LABEL: @uses_library_support_coro_intrinsics(
; CHECK-NOT: @llvm.coro
; CHECK: ret void
-define void @uses_library_support_coro_intrinsics(i8* %hdl) {
+define void @uses_library_support_coro_intrinsics(ptr %hdl) {
entry:
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.destroy(i8* %hdl)
- call i1 @llvm.coro.done(i8* %hdl)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
+ call i1 @llvm.coro.done(ptr %hdl)
ret void
}
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
-declare i1 @llvm.coro.done(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
+declare i1 @llvm.coro.done(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-elide-stat.ll b/llvm/test/Transforms/Coroutines/coro-elide-stat.ll
index 939a7b9b7a60..0cf3143351b9 100644
--- a/llvm/test/Transforms/Coroutines/coro-elide-stat.ll
+++ b/llvm/test/Transforms/Coroutines/coro-elide-stat.ll
@@ -17,65 +17,61 @@
declare void @print(i32) nounwind
; resume part of the coroutine
-define fastcc void @f.resume(i8* dereferenceable(1)) {
+define fastcc void @f.resume(ptr dereferenceable(1)) {
tail call void @print(i32 0)
ret void
}
; destroy part of the coroutine
-define fastcc void @f.destroy(i8*) {
+define fastcc void @f.destroy(ptr) {
tail call void @print(i32 1)
ret void
}
; cleanup part of the coroutine
-define fastcc void @f.cleanup(i8*) {
+define fastcc void @f.cleanup(ptr) {
tail call void @print(i32 2)
ret void
}
- at f.resumers = internal constant [3 x void (i8*)*] [void (i8*)* @f.resume,
- void (i8*)* @f.destroy,
- void (i8*)* @f.cleanup]
+ at f.resumers = internal constant [3 x ptr] [ptr @f.resume,
+ ptr @f.destroy,
+ ptr @f.cleanup]
; a coroutine start function
-define i8* @f() {
+define ptr @f() {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null,
- i8* bitcast (i8*()* @f to i8*),
- i8* bitcast ([3 x void (i8*)*]* @f.resumers to i8*))
+ %id = call token @llvm.coro.id(i32 0, ptr null,
+ ptr @f,
+ ptr @f.resumers)
%alloc = call i1 @llvm.coro.alloc(token %id)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- ret i8* %hdl
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ ret ptr %hdl
}
define void @callResume() {
entry:
- %hdl = call i8* @f()
+ %hdl = call ptr @f()
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
ret void
}
define void @callResumeMultiRet(i1 %b) {
entry:
- %hdl = call i8* @f()
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %hdl = call ptr @f()
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
br i1 %b, label %destroy, label %ret
destroy:
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
ret void
ret:
@@ -84,13 +80,11 @@ ret:
define void @callResumeMultiRetDommmed(i1 %b) {
entry:
- %hdl = call i8* @f()
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %hdl = call ptr @f()
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
br i1 %b, label %destroy, label %ret
destroy:
@@ -100,13 +94,12 @@ ret:
ret void
}
-define void @eh() personality i8* null {
+define void @eh() personality ptr null {
entry:
- %hdl = call i8* @f()
+ %hdl = call ptr @f()
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- invoke void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ invoke void %0(ptr %hdl)
to label %cont unwind label %ehcleanup
cont:
ret void
@@ -119,37 +112,33 @@ ehcleanup:
; no devirtualization here, since coro.begin info parameter is null
define void @no_devirt_info_null() {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
ret void
}
; no devirtualization here, since coro.begin is not visible
-define void @no_devirt_no_begin(i8* %hdl) {
+define void @no_devirt_no_begin(ptr %hdl) {
entry:
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
ret void
}
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i8* @llvm.coro.frame()
-declare i8* @llvm.coro.subfn.addr(i8*, i8)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare ptr @llvm.coro.frame()
+declare ptr @llvm.coro.subfn.addr(ptr, i8)
declare i1 @llvm.coro.alloc(token)
diff --git a/llvm/test/Transforms/Coroutines/coro-elide.ll b/llvm/test/Transforms/Coroutines/coro-elide.ll
index 35cf0efbef28..4232615a464b 100644
--- a/llvm/test/Transforms/Coroutines/coro-elide.ll
+++ b/llvm/test/Transforms/Coroutines/coro-elide.ll
@@ -7,52 +7,50 @@
declare void @print(i32) nounwind
; resume part of the coroutine
-define fastcc void @f.resume(i8* dereferenceable(1)) {
+define fastcc void @f.resume(ptr dereferenceable(1)) {
tail call void @print(i32 0)
ret void
}
; destroy part of the coroutine
-define fastcc void @f.destroy(i8*) {
+define fastcc void @f.destroy(ptr) {
tail call void @print(i32 1)
ret void
}
; cleanup part of the coroutine
-define fastcc void @f.cleanup(i8*) {
+define fastcc void @f.cleanup(ptr) {
tail call void @print(i32 2)
ret void
}
- at f.resumers = internal constant [3 x void (i8*)*] [void (i8*)* @f.resume,
- void (i8*)* @f.destroy,
- void (i8*)* @f.cleanup]
+ at f.resumers = internal constant [3 x ptr] [ptr @f.resume,
+ ptr @f.destroy,
+ ptr @f.cleanup]
; a coroutine start function
-define i8* @f() {
+define ptr @f() {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null,
- i8* bitcast (i8*()* @f to i8*),
- i8* bitcast ([3 x void (i8*)*]* @f.resumers to i8*))
+ %id = call token @llvm.coro.id(i32 0, ptr null,
+ ptr @f,
+ ptr @f.resumers)
%alloc = call i1 @llvm.coro.alloc(token %id)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- ret i8* %hdl
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ ret ptr %hdl
}
; CHECK-LABEL: @callResume(
define void @callResume() {
entry:
- %hdl = call i8* @f()
+ %hdl = call ptr @f()
; CHECK: call void @print(i32 0)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
; CHECK-NEXT: call void @print(i32 2)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
; CHECK-NEXT: ret void
ret void
@@ -61,19 +59,17 @@ entry:
; CHECK-LABEL: @callResumeMultiRet(
define void @callResumeMultiRet(i1 %b) {
entry:
- %hdl = call i8* @f()
+ %hdl = call ptr @f()
; CHECK: %alloc.i = call i1 @llvm.coro.alloc
; CHECK: call void @print(i32 0)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
br i1 %b, label %destroy, label %ret
destroy:
; CHECK: call void @print(i32 1)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
ret void
ret:
@@ -83,16 +79,14 @@ ret:
; CHECK-LABEL: @callResumeMultiRetDommmed(
define void @callResumeMultiRetDommmed(i1 %b) {
entry:
- %hdl = call i8* @f()
+ %hdl = call ptr @f()
; CHECK-NOT: %alloc.i = call i1 @llvm.coro.alloc
; CHECK: call void @print(i32 0)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
; CHECK: call void @print(i32 2)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
br i1 %b, label %destroy, label %ret
destroy:
@@ -103,14 +97,13 @@ ret:
}
; CHECK-LABEL: @eh(
-define void @eh() personality i8* null {
+define void @eh() personality ptr null {
entry:
- %hdl = call i8* @f()
+ %hdl = call ptr @f()
; CHECK: call void @print(i32 0)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- invoke void %1(i8* %hdl)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ invoke void %0(ptr %hdl)
to label %cont unwind label %ehcleanup
cont:
ret void
@@ -124,18 +117,16 @@ ehcleanup:
; no devirtualization here, since coro.begin info parameter is null
define void @no_devirt_info_null() {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
-; CHECK: call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+; CHECK: call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
-; CHECK: call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+; CHECK: call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
; CHECK: ret void
ret void
@@ -143,25 +134,23 @@ entry:
; CHECK-LABEL: @no_devirt_no_begin(
; no devirtualization here, since coro.begin is not visible
-define void @no_devirt_no_begin(i8* %hdl) {
+define void @no_devirt_no_begin(ptr %hdl) {
entry:
-; CHECK: call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %1 = bitcast i8* %0 to void (i8*)*
- call fastcc void %1(i8* %hdl)
+; CHECK: call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ %0 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %0(ptr %hdl)
-; CHECK: call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
- %3 = bitcast i8* %2 to void (i8*)*
- call fastcc void %3(i8* %hdl)
+; CHECK: call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ %1 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 1)
+ call fastcc void %1(ptr %hdl)
; CHECK: ret void
ret void
}
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i8* @llvm.coro.frame()
-declare i8* @llvm.coro.subfn.addr(i8*, i8)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare ptr @llvm.coro.frame()
+declare ptr @llvm.coro.subfn.addr(ptr, i8)
declare i1 @llvm.coro.alloc(token)
diff --git a/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll b/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
index 1e1a72bafee5..0aee256d20e1 100644
--- a/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
+++ b/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
@@ -2,77 +2,75 @@
; RUN: opt < %s -passes='cgscc(coro-split<reuse-storage>),simplifycfg,early-cse' -S | FileCheck %s
%struct.big_structure = type { [500 x i8] }
-declare void @consume(%struct.big_structure*)
+declare void @consume(ptr)
; Function Attrs: noinline optnone uwtable
-define i8* @f(i1 %cond) presplitcoroutine {
+define ptr @f(i1 %cond) presplitcoroutine {
entry:
%data = alloca %struct.big_structure, align 1
%data2 = alloca %struct.big_structure, align 1
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
br i1 %cond, label %then, label %else
then:
- %0 = bitcast %struct.big_structure* %data to i8*
- call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %0)
- call void @consume(%struct.big_structure* %data)
+ call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %data)
+ call void @consume(ptr %data)
%suspend.value = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %suspend.value, label %coro.ret [i8 0, label %resume
i8 1, label %cleanup1]
resume:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data)
br label %cleanup1
cleanup1:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data)
br label %cleanup
else:
- %1 = bitcast %struct.big_structure* %data2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %1)
- call void @consume(%struct.big_structure* %data2)
+ call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %data2)
+ call void @consume(ptr %data2)
%suspend.value2 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %suspend.value2, label %coro.ret [i8 0, label %resume2
i8 1, label %cleanup2]
resume2:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data2)
br label %cleanup2
cleanup2:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data2)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %coro.ret
coro.ret:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; CHECK-LABEL: @f(
-; CHECK: call i8* @malloc(i32 520)
+; CHECK: call ptr @malloc(i32 520)
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare double @print(double)
-declare void @free(i8*)
+declare void @free(ptr)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
diff --git a/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll b/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
index 8ef7ed5ddfe9..a1d1134fab35 100644
--- a/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
+++ b/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
@@ -4,8 +4,8 @@
%"struct.task::promise_type" = type { i8 }
%struct.awaitable = type { i8 }
%struct.big_structure = type { [500 x i8] }
-declare i8* @malloc(i64)
-declare void @consume(%struct.big_structure*)
+declare ptr @malloc(i64)
+declare void @consume(ptr)
define void @a(i1 zeroext %cond) presplitcoroutine {
entry:
%__promise = alloca %"struct.task::promise_type", align 1
@@ -13,64 +13,61 @@ entry:
%ref.tmp7 = alloca %struct.awaitable, align 1
%b = alloca %struct.big_structure, align 1
%ref.tmp18 = alloca %struct.awaitable, align 1
- %0 = getelementptr inbounds %"struct.task::promise_type", %"struct.task::promise_type"* %__promise, i64 0, i32 0
- %1 = call token @llvm.coro.id(i32 16, i8* nonnull %0, i8* bitcast (void (i1)* @a to i8*), i8* null)
+ %0 = call token @llvm.coro.id(i32 16, ptr nonnull %__promise, ptr @a, ptr null)
br label %init.ready
init.ready:
- %2 = call noalias nonnull i8* @llvm.coro.begin(token %1, i8* null)
- call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %0)
+ %1 = call noalias nonnull ptr @llvm.coro.begin(token %0, ptr null)
+ call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %__promise)
br i1 %cond, label %if.then, label %if.else
if.then:
- %3 = getelementptr inbounds %struct.big_structure, %struct.big_structure* %a, i64 0, i32 0, i64 0
- call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %3)
- call void @consume(%struct.big_structure* nonnull %a)
- %save = call token @llvm.coro.save(i8* null)
+ call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %a)
+ call void @consume(ptr nonnull %a)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %coro.ret [
i8 0, label %await.ready
i8 1, label %cleanup1
]
await.ready:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %3)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %a)
br label %cleanup1
if.else:
- %4 = getelementptr inbounds %struct.big_structure, %struct.big_structure* %b, i64 0, i32 0, i64 0
- call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %4)
- call void @consume(%struct.big_structure* nonnull %b)
- %save2 = call token @llvm.coro.save(i8* null)
+ call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %b)
+ call void @consume(ptr nonnull %b)
+ %save2 = call token @llvm.coro.save(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %coro.ret [
i8 0, label %await2.ready
i8 1, label %cleanup2
]
await2.ready:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %4)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %b)
br label %cleanup2
cleanup1:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %3)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %a)
br label %cleanup
cleanup2:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %4)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %b)
br label %cleanup
cleanup:
- call i8* @llvm.coro.free(token %1, i8* %2)
+ call ptr @llvm.coro.free(token %0, ptr %1)
br label %coro.ret
coro.ret:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; check that there is only one %struct.big_structure in the frame.
-; CHECK: %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1 }
+; CHECK: %a.Frame = type { ptr, ptr, %"struct.task::promise_type", %struct.big_structure, i1 }
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)
declare i1 @llvm.coro.alloc(token) #3
declare i64 @llvm.coro.size.i64() #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #3
-declare token @llvm.coro.save(i8*) #3
-declare i8* @llvm.coro.frame() #5
+declare ptr @llvm.coro.begin(token, ptr writeonly) #3
+declare token @llvm.coro.save(ptr) #3
+declare ptr @llvm.coro.frame() #5
declare i8 @llvm.coro.suspend(token, i1) #3
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #2
-declare i1 @llvm.coro.end(i8*, i1) #3
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #4
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #4
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #2
+declare i1 @llvm.coro.end(ptr, i1) #3
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #4
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #4
diff --git a/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll b/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
index 06ded3b5e67f..94032607d98d 100644
--- a/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
+++ b/llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
@@ -2,77 +2,75 @@
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
%struct.big_structure = type { [500 x i8] }
-declare void @consume(%struct.big_structure*)
+declare void @consume(ptr)
; Function Attrs: noinline optnone uwtable
-define i8* @f(i1 %cond) presplitcoroutine {
+define ptr @f(i1 %cond) presplitcoroutine {
entry:
%data = alloca %struct.big_structure, align 1
%data2 = alloca %struct.big_structure, align 1
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
br i1 %cond, label %then, label %else
then:
- %0 = bitcast %struct.big_structure* %data to i8*
- call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %0)
- call void @consume(%struct.big_structure* %data)
+ call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %data)
+ call void @consume(ptr %data)
%suspend.value = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %suspend.value, label %coro.ret [i8 0, label %resume
i8 1, label %cleanup1]
resume:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data)
br label %cleanup1
cleanup1:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data)
br label %cleanup
else:
- %1 = bitcast %struct.big_structure* %data2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %1)
- call void @consume(%struct.big_structure* %data2)
+ call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %data2)
+ call void @consume(ptr %data2)
%suspend.value2 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %suspend.value2, label %coro.ret [i8 0, label %resume2
i8 1, label %cleanup2]
resume2:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data2)
br label %cleanup2
cleanup2:
- call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1)
+ call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %data2)
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %coro.ret
coro.ret:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; CHECK-LABEL: @f(
-; CHECK: call i8* @malloc(i32 1024)
+; CHECK: call ptr @malloc(i32 1024)
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare double @print(double)
-declare void @free(i8*)
+declare void @free(ptr)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
diff --git a/llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll b/llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll
index 92c93b1a789e..17d2250611b8 100644
--- a/llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll
+++ b/llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll
@@ -1,14 +1,14 @@
; Check that coro-split doesn't choke on intrinsics in unreachable blocks
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S
-define i8* @f(i1 %arg) presplitcoroutine personality i32 0 {
+define ptr @f(i1 %arg) presplitcoroutine personality i32 0 {
entry:
%arg.addr = alloca i1
- store i1 %arg, i1* %arg.addr
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ store i1 %arg, ptr %arg.addr
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
br label %cont
cont:
@@ -19,32 +19,32 @@ resume:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
no.predecessors:
- %argval = load i1, i1* %arg.addr
+ %argval = load i1, ptr %arg.addr
call void @print(i1 %argval)
br label %suspend
}
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i1)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-inline.ll b/llvm/test/Transforms/Coroutines/coro-inline.ll
index 1195830f8b67..baf86838bb5f 100644
--- a/llvm/test/Transforms/Coroutines/coro-inline.ll
+++ b/llvm/test/Transforms/Coroutines/coro-inline.ll
@@ -4,16 +4,16 @@
; Function Attrs: alwaysinline ssp uwtable
define void @ff() #0 {
entry:
- %id = call token @llvm.coro.id(i32 16, i8* null, i8* null, i8* null)
- %begin = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id(i32 16, ptr null, ptr null, ptr null)
+ %begin = call ptr @llvm.coro.begin(token %id, ptr null)
ret void
}
; Function Attrs: alwaysinline ssp uwtable
define void @foo() #0 {
entry:
- %id1 = call token @llvm.coro.id(i32 16, i8* null, i8* null, i8* null)
- %begin = call i8* @llvm.coro.begin(token %id1, i8* null)
+ %id1 = call token @llvm.coro.id(i32 16, ptr null, ptr null, ptr null)
+ %begin = call ptr @llvm.coro.begin(token %id1, ptr null)
call void @ff()
ret void
}
@@ -21,8 +21,8 @@ entry:
; CHECK: call void @ff()
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
-declare i8* @llvm.coro.begin(token, i8* writeonly)
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)
+declare ptr @llvm.coro.begin(token, ptr writeonly)
attributes #0 = { alwaysinline ssp uwtable presplitcoroutine "use-sample-profile" }
diff --git a/llvm/test/Transforms/Coroutines/coro-materialize.ll b/llvm/test/Transforms/Coroutines/coro-materialize.ll
index ff52144d3c1f..c41a8860142d 100644
--- a/llvm/test/Transforms/Coroutines/coro-materialize.ll
+++ b/llvm/test/Transforms/Coroutines/coro-materialize.ll
@@ -1,12 +1,12 @@
; Verifies that we materialize instruction across suspend points
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%inc1 = add i32 %n, 1
%sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
@@ -24,29 +24,29 @@ resume2:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; See that we only spilled one value
-; CHECK: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i32, i1 }
+; CHECK: %f.Frame = type { ptr, ptr, i32, i1 }
; CHECK-LABEL: @f(
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-noalias-param.ll b/llvm/test/Transforms/Coroutines/coro-noalias-param.ll
index 29b72def6fe6..67e51b1005f8 100644
--- a/llvm/test/Transforms/Coroutines/coro-noalias-param.ll
+++ b/llvm/test/Transforms/Coroutines/coro-noalias-param.ll
@@ -1,11 +1,11 @@
; RUN: opt < %s -S -passes=coro-early | FileCheck %s
%struct.A = type <{ i64, i64, i32, [4 x i8] }>
-define void @f(%struct.A* nocapture readonly noalias align 8 %a) presplitcoroutine {
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+define void @f(ptr nocapture readonly noalias align 8 %a) presplitcoroutine {
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
call void @print(i32 0)
%s1 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %s1, label %suspend [i8 0, label %resume
@@ -15,26 +15,26 @@ resume:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
ret void
}
; check that the noalias attribute is removed from the argument
-; CHECK: define void @f(%struct.A* nocapture readonly align 8 %a)
+; CHECK: define void @f(ptr nocapture readonly align 8 %a)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i8* @llvm.coro.free(token, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-noop.ll b/llvm/test/Transforms/Coroutines/coro-noop.ll
index 23533c87a18f..1e4f19a2ef66 100644
--- a/llvm/test/Transforms/Coroutines/coro-noop.ll
+++ b/llvm/test/Transforms/Coroutines/coro-noop.ll
@@ -1,20 +1,20 @@
; Tests that CoroEarly pass correctly lowers coro.noop
; RUN: opt < %s -S -passes=coro-early | FileCheck %s
-; CHECK: %NoopCoro.Frame = type { void (%NoopCoro.Frame*)*, void (%NoopCoro.Frame*)* }
-; CHECK: @NoopCoro.Frame.Const = private constant %NoopCoro.Frame { void (%NoopCoro.Frame*)* @__NoopCoro_ResumeDestroy, void (%NoopCoro.Frame*)* @__NoopCoro_ResumeDestroy }
+; CHECK: %NoopCoro.Frame = type { ptr, ptr }
+; CHECK: @NoopCoro.Frame.Const = private constant %NoopCoro.Frame { ptr @__NoopCoro_ResumeDestroy, ptr @__NoopCoro_ResumeDestroy }
; CHECK-LABEL: @noop(
-define i8* @noop() {
+define ptr @noop() {
; CHECK-NEXT: entry
entry:
-; CHECK-NEXT: ret i8* bitcast (%NoopCoro.Frame* @NoopCoro.Frame.Const to i8*)
- %n = call i8* @llvm.coro.noop()
- ret i8* %n
+; CHECK-NEXT: ret ptr @NoopCoro.Frame.Const
+ %n = call ptr @llvm.coro.noop()
+ ret ptr %n
}
-declare i8* @llvm.coro.noop()
+declare ptr @llvm.coro.noop()
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
@@ -26,7 +26,7 @@ declare i8* @llvm.coro.noop()
!4 = !{i32 2, !"Debug Info Version", i32 3}
-; CHECK: define private fastcc void @__NoopCoro_ResumeDestroy(%NoopCoro.Frame* %0) !dbg ![[RESUME:[0-9]+]] {
+; CHECK: define private fastcc void @__NoopCoro_ResumeDestroy(ptr %0) !dbg ![[RESUME:[0-9]+]] {
; CHECK-NEXT: entry
; CHECK-NEXT: ret void
diff --git a/llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll b/llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
index 1486123902a5..3476db91dc85 100644
--- a/llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
+++ b/llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
@@ -5,11 +5,11 @@ target triple = "x86_64-apple-macosx10.12.0"
; CHECK-NOT: define
-define internal {i8*, i32} @f(i8* %buffer, i32* %array) {
+define internal {ptr, i32} @f(ptr %buffer, ptr %array) {
entry:
- %id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, i8* %buffer, i8* bitcast (void (i8*, i1)* @prototype to i8*), i8* bitcast (i8* (i32)* @allocate to i8*), i8* bitcast (void (i8*)* @deallocate to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- %load = load i32, i32* %array
+ %id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ %load = load i32, ptr %array
%load.pos = icmp sgt i32 %load, 0
br i1 %load.pos, label %pos, label %neg
@@ -18,7 +18,7 @@ pos:
br i1 %unwind0, label %cleanup, label %pos.cont
pos.cont:
- store i32 0, i32* %array, align 4
+ store i32 0, ptr %array, align 4
br label %cleanup
neg:
@@ -26,21 +26,21 @@ neg:
br i1 %unwind1, label %cleanup, label %neg.cont
neg.cont:
- store i32 10, i32* %array, align 4
+ store i32 10, ptr %array, align 4
br label %cleanup
cleanup:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
unreachable
}
-declare token @llvm.coro.id.retcon.once(i32, i32, i8*, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
+declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
declare i1 @llvm.coro.suspend.retcon.i1(...)
-declare i1 @llvm.coro.end(i8*, i1)
-declare i8* @llvm.coro.prepare.retcon(i8*)
+declare i1 @llvm.coro.end(ptr, i1)
+declare ptr @llvm.coro.prepare.retcon(ptr)
-declare void @prototype(i8*, i1 zeroext)
+declare void @prototype(ptr, i1 zeroext)
-declare noalias i8* @allocate(i32 %size)
-declare void @deallocate(i8* %ptr)
+declare noalias ptr @allocate(i32 %size)
+declare void @deallocate(ptr %ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll b/llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
index b509717d2ff9..83c293f0a44f 100644
--- a/llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
+++ b/llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
@@ -3,68 +3,62 @@
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
-define {i8*, i32*} @f(i8* %buffer, i32* %ptr) presplitcoroutine {
+define {ptr, ptr} @f(ptr %buffer, ptr %ptr) presplitcoroutine {
entry:
%temp = alloca i32, align 4
- %id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, i8* %buffer, i8* bitcast (void (i8*, i1)* @prototype to i8*), i8* bitcast (i8* (i32)* @allocate to i8*), i8* bitcast (void (i8*)* @deallocate to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
- %oldvalue = load i32, i32* %ptr
- store i32 %oldvalue, i32* %temp
- %unwind = call i1 (...) @llvm.coro.suspend.retcon.i1(i32* %temp)
+ %id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
+ %oldvalue = load i32, ptr %ptr
+ store i32 %oldvalue, ptr %temp
+ %unwind = call i1 (...) @llvm.coro.suspend.retcon.i1(ptr %temp)
br i1 %unwind, label %cleanup, label %cont
cont:
- %newvalue = load i32, i32* %temp
- store i32 %newvalue, i32* %ptr
+ %newvalue = load i32, ptr %temp
+ store i32 %newvalue, ptr %ptr
br label %cleanup
cleanup:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
unreachable
}
-declare token @llvm.coro.id.retcon.once(i32, i32, i8*, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
+declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
declare i1 @llvm.coro.suspend.retcon.i1(...)
-declare i1 @llvm.coro.end(i8*, i1)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @prototype(i8*, i1 zeroext)
+declare void @prototype(ptr, i1 zeroext)
-declare noalias i8* @allocate(i32 %size)
-declare fastcc void @deallocate(i8* %ptr)
+declare noalias ptr @allocate(i32 %size)
+declare fastcc void @deallocate(ptr %ptr)
declare void @print(i32)
; CHECK-LABEL: @f(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = call i8* @allocate(i32 16)
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[BUFFER:%.*]] to i8**
-; CHECK-NEXT: store i8* [[TMP0]], i8** [[TMP1]], align 8
-; CHECK-NEXT: [[FRAMEPTR:%.*]] = bitcast i8* [[TMP0]] to %f.Frame*
-; CHECK-NEXT: [[TEMP:%.*]] = getelementptr inbounds [[F_FRAME:%.*]], %f.Frame* [[FRAMEPTR]], i32 0, i32 1
-; CHECK-NEXT: [[PTR_SPILL_ADDR:%.*]] = getelementptr inbounds [[F_FRAME]], %f.Frame* [[FRAMEPTR]], i32 0, i32 0
-; CHECK-NEXT: store i32* [[PTR:%.*]], i32** [[PTR_SPILL_ADDR]], align 8
-; CHECK-NEXT: [[OLDVALUE:%.*]] = load i32, i32* [[PTR]], align 4
-; CHECK-NEXT: store i32 [[OLDVALUE]], i32* [[TEMP]], align 4
-; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { i8*, i32* } { i8* bitcast (void (i8*, i1)* @f.resume.0 to i8*), i32* undef }, i32* [[TEMP]], 1
-; CHECK-NEXT: ret { i8*, i32* } [[TMP2]]
+; CHECK-NEXT: [[TMP0:%.*]] = call ptr @allocate(i32 16)
+; CHECK-NEXT: store ptr [[TMP0]], ptr [[BUFFER:%.*]], align 8
+; CHECK-NEXT: [[TEMP:%.*]] = getelementptr inbounds [[F_FRAME:%.*]], ptr [[TMP0]], i32 0, i32 1
+; CHECK-NEXT: store ptr [[PTR:%.*]], ptr [[TMP0]], align 8
+; CHECK-NEXT: [[OLDVALUE:%.*]] = load i32, ptr [[PTR]], align 4
+; CHECK-NEXT: store i32 [[OLDVALUE]], ptr [[TEMP]], align 4
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue { ptr, ptr } { ptr @f.resume.0, ptr undef }, ptr [[TEMP]], 1
+; CHECK-NEXT: ret { ptr, ptr } [[TMP2]]
;
;
; CHECK-LABEL: @f.resume.0(
; CHECK-NEXT: entryresume.0:
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP0:%.*]] to %f.Frame**
-; CHECK-NEXT: [[FRAMEPTR:%.*]] = load %f.Frame*, %f.Frame** [[TMP2]], align 8
-; CHECK-NEXT: [[TEMP:%.*]] = getelementptr inbounds [[F_FRAME:%.*]], %f.Frame* [[FRAMEPTR]], i32 0, i32 1
+; CHECK-NEXT: [[FRAMEPTR:%.*]] = load ptr, ptr [[TMP0:%.*]], align 8
+; CHECK-NEXT: [[TEMP:%.*]] = getelementptr inbounds [[F_FRAME:%.*]], ptr [[FRAMEPTR]], i32 0, i32 1
; CHECK-NEXT: br i1 [[TMP1:%.*]], label [[COROEND:%.*]], label [[CONT:%.*]]
; CHECK: cont:
-; CHECK-NEXT: [[PTR_RELOAD_ADDR:%.*]] = getelementptr inbounds [[F_FRAME]], %f.Frame* [[FRAMEPTR]], i32 0, i32 0
-; CHECK-NEXT: [[PTR_RELOAD:%.*]] = load i32*, i32** [[PTR_RELOAD_ADDR]], align 8
-; CHECK-NEXT: [[NEWVALUE:%.*]] = load i32, i32* [[TEMP]], align 4
-; CHECK-NEXT: store i32 [[NEWVALUE]], i32* [[PTR_RELOAD]], align 4
+; CHECK-NEXT: [[PTR_RELOAD:%.*]] = load ptr, ptr [[FRAMEPTR]], align 8
+; CHECK-NEXT: [[NEWVALUE:%.*]] = load i32, ptr [[TEMP]], align 4
+; CHECK-NEXT: store i32 [[NEWVALUE]], ptr [[PTR_RELOAD]], align 4
; CHECK-NEXT: br label [[COROEND]]
; CHECK: CoroEnd:
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast %f.Frame* [[FRAMEPTR]] to i8*
-; CHECK-NEXT: call fastcc void @deallocate(i8* [[TMP3]])
+; CHECK-NEXT: call fastcc void @deallocate(ptr [[FRAMEPTR]])
; CHECK-NEXT: ret void
;
diff --git a/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
index 4d82f18e3d05..f598e0a3e0d7 100644
--- a/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
+++ b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
@@ -7,41 +7,41 @@ target datalayout = "E-p:64:64"
%T4red215EmptyCollectionV = type opaque
%TSi = type <{ i64 }>
-define hidden swiftcc { i8*, %swift.opaque* } @no_suspends(i8* %buffer, i64 %arg) #1 {
+define hidden swiftcc { ptr, ptr } @no_suspends(ptr %buffer, i64 %arg) #1 {
; CHECK-LABEL: @no_suspends(
; CHECK-NEXT: AllocaSpillBB:
-; CHECK-NEXT: [[ID:%.*]] = call token @llvm.coro.id.retcon.once(i32 32, i32 8, i8* [[BUFFER:%.*]], i8* bitcast (void (i8*, i1)* @prototype to i8*), i8* bitcast (i8* (i64)* @malloc to i8*), i8* bitcast (void (i8*)* @free to i8*))
+; CHECK-NEXT: [[ID:%.*]] = call token @llvm.coro.id.retcon.once(i32 32, i32 8, ptr [[BUFFER:%.*]], ptr @prototype, ptr @malloc, ptr @free)
; CHECK-NEXT: call void @print(i64 [[ARG:%.*]])
; CHECK-NEXT: call void @llvm.trap()
; CHECK-NEXT: unreachable
;
- %id = call token @llvm.coro.id.retcon.once(i32 32, i32 8, i8* %buffer, i8* bitcast (void (i8*, i1)* @prototype to i8*), i8* bitcast (i8* (i64)* @malloc to i8*), i8* bitcast (void (i8*)* @free to i8*))
- %begin = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id.retcon.once(i32 32, i32 8, ptr %buffer, ptr @prototype, ptr @malloc, ptr @free)
+ %begin = call ptr @llvm.coro.begin(token %id, ptr null)
call void @print(i64 %arg)
call void @llvm.trap()
unreachable
bb1:
call void @print(i64 %arg)
- call i1 @llvm.coro.end(i8* %begin, i1 false)
+ call i1 @llvm.coro.end(ptr %begin, i1 false)
unreachable
}
-declare swiftcc void @prototype(i8* noalias dereferenceable(32), i1)
+declare swiftcc void @prototype(ptr noalias dereferenceable(32), i1)
declare void @print(i64)
-declare noalias i8* @malloc(i64) #5
-declare void @free(i8* nocapture) #5
+declare noalias ptr @malloc(i64) #5
+declare void @free(ptr nocapture) #5
-declare token @llvm.coro.id.retcon.once(i32, i32, i8*, i8*, i8*, i8*) #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #5
+declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr) #5
+declare ptr @llvm.coro.begin(token, ptr writeonly) #5
declare token @llvm.coro.alloca.alloc.i64(i64, i32) #5
-declare i8* @llvm.coro.alloca.get(token) #5
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #6
+declare ptr @llvm.coro.alloca.get(token) #5
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #6
declare i1 @llvm.coro.suspend.retcon.i1(...) #5
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #6
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #6
declare void @llvm.coro.alloca.free(token) #5
-declare i1 @llvm.coro.end(i8*, i1) #5
+declare i1 @llvm.coro.end(ptr, i1) #5
declare void @llvm.trap()
diff --git a/llvm/test/Transforms/Coroutines/coro-retcon-value.ll b/llvm/test/Transforms/Coroutines/coro-retcon-value.ll
index 0298c5d0c8f3..27344ffe63c9 100644
--- a/llvm/test/Transforms/Coroutines/coro-retcon-value.ll
+++ b/llvm/test/Transforms/Coroutines/coro-retcon-value.ll
@@ -2,17 +2,16 @@
; First example from Doc/Coroutines.rst (two block loop) converted to retcon
; RUN: opt < %s -passes='default<O2>' -S | FileCheck %s
-define {i8*, i32} @f(i8* %buffer, i32 %n) {
+define {ptr, i32} @f(ptr %buffer, i32 %n) {
; CHECK-LABEL: @f(
; CHECK-NEXT: coro.return:
-; CHECK-NEXT: [[N_VAL_SPILL_ADDR:%.*]] = bitcast i8* [[BUFFER:%.*]] to i32*
-; CHECK-NEXT: store i32 [[N:%.*]], i32* [[N_VAL_SPILL_ADDR]], align 4
-; CHECK-NEXT: [[TMP0:%.*]] = insertvalue { i8*, i32 } { i8* bitcast ({ i8*, i32 } (i8*, i8)* @f.resume.0 to i8*), i32 undef }, i32 [[N]], 1
-; CHECK-NEXT: ret { i8*, i32 } [[TMP0]]
+; CHECK-NEXT: store i32 [[N:%.*]], ptr [[BUFFER:%.*]], align 4
+; CHECK-NEXT: [[TMP0:%.*]] = insertvalue { ptr, i32 } { ptr @f.resume.0, i32 undef }, i32 [[N]], 1
+; CHECK-NEXT: ret { ptr, i32 } [[TMP0]]
;
entry:
- %id = call token @llvm.coro.id.retcon(i32 8, i32 4, i8* %buffer, i8* bitcast ({i8*, i32} (i8*, i8)* @prototype to i8*), i8* bitcast (i8* (i32)* @allocate to i8*), i8* bitcast (void (i8*)* @deallocate to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
br label %loop
loop:
@@ -26,7 +25,7 @@ resume:
br label %loop
cleanup:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
unreachable
}
@@ -42,40 +41,35 @@ define i32 @main() {
;
entry:
%0 = alloca [8 x i8], align 4
- %buffer = bitcast [8 x i8]* %0 to i8*
- %prepare = call i8* @llvm.coro.prepare.retcon(i8* bitcast ({i8*, i32} (i8*, i32)* @f to i8*))
- %f = bitcast i8* %prepare to {i8*, i32} (i8*, i32)*
- %result0 = call {i8*, i32} %f(i8* %buffer, i32 4)
- %value0 = extractvalue {i8*, i32} %result0, 1
+ %prepare = call ptr @llvm.coro.prepare.retcon(ptr @f)
+ %result0 = call {ptr, i32} %prepare(ptr %0, i32 4)
+ %value0 = extractvalue {ptr, i32} %result0, 1
call void @print(i32 %value0)
- %cont0 = extractvalue {i8*, i32} %result0, 0
- %cont0.cast = bitcast i8* %cont0 to {i8*, i32} (i8*, i8)*
- %result1 = call {i8*, i32} %cont0.cast(i8* %buffer, i8 zeroext 0)
- %value1 = extractvalue {i8*, i32} %result1, 1
+ %cont0 = extractvalue {ptr, i32} %result0, 0
+ %result1 = call {ptr, i32} %cont0(ptr %0, i8 zeroext 0)
+ %value1 = extractvalue {ptr, i32} %result1, 1
call void @print(i32 %value1)
- %cont1 = extractvalue {i8*, i32} %result1, 0
- %cont1.cast = bitcast i8* %cont1 to {i8*, i32} (i8*, i8)*
- %result2 = call {i8*, i32} %cont1.cast(i8* %buffer, i8 zeroext 0)
- %value2 = extractvalue {i8*, i32} %result2, 1
+ %cont1 = extractvalue {ptr, i32} %result1, 0
+ %result2 = call {ptr, i32} %cont1(ptr %0, i8 zeroext 0)
+ %value2 = extractvalue {ptr, i32} %result2, 1
call void @print(i32 %value2)
- %cont2 = extractvalue {i8*, i32} %result2, 0
- %cont2.cast = bitcast i8* %cont2 to {i8*, i32} (i8*, i8)*
- call {i8*, i32} %cont2.cast(i8* %buffer, i8 zeroext 1)
+ %cont2 = extractvalue {ptr, i32} %result2, 0
+ call {ptr, i32} %cont2(ptr %0, i8 zeroext 1)
ret i32 0
}
; Unfortunately, we don't seem to fully optimize this right now due
; to some sort of phase-ordering thing.
-declare token @llvm.coro.id.retcon(i32, i32, i8*, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
+declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
declare i8 @llvm.coro.suspend.retcon.i8(...)
-declare i1 @llvm.coro.end(i8*, i1)
-declare i8* @llvm.coro.prepare.retcon(i8*)
+declare i1 @llvm.coro.end(ptr, i1)
+declare ptr @llvm.coro.prepare.retcon(ptr)
-declare {i8*, i32} @prototype(i8*, i8 zeroext)
+declare {ptr, i32} @prototype(ptr, i8 zeroext)
-declare noalias i8* @allocate(i32 %size)
-declare void @deallocate(i8* %ptr)
+declare noalias ptr @allocate(i32 %size)
+declare void @deallocate(ptr %ptr)
declare void @print(i32)
diff --git a/llvm/test/Transforms/Coroutines/coro-split-01.ll b/llvm/test/Transforms/Coroutines/coro-split-01.ll
index 5387536a7b29..039f80db57ac 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-01.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-01.ll
@@ -1,18 +1,18 @@
; Tests that a coroutine is split, inlined into the caller and devirtualized.
; RUN: opt < %s -S -passes='default<O2>' | FileCheck %s
-define i8* @f() presplitcoroutine {
+define ptr @f() presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
br i1 %need.dyn.alloc, label %dyn.alloc, label %coro.begin
dyn.alloc:
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
+ %alloc = call ptr @malloc(i32 %size)
br label %coro.begin
coro.begin:
- %phi = phi i8* [ null, %entry ], [ %alloc, %dyn.alloc ]
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %phi)
+ %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %phi)
call void @print(i32 0)
%0 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %0, label %suspend [i8 0, label %resume
@@ -22,17 +22,17 @@ resume:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
define i32 @main() {
entry:
- %hdl = call i8* @f()
- call void @llvm.coro.resume(i8* %hdl)
+ %hdl = call ptr @f()
+ call void @llvm.coro.resume(ptr %hdl)
ret i32 0
; CHECK-LABEL: @main(
; CHECK: call void @print(i32 0)
@@ -40,17 +40,17 @@ entry:
; CHECK: ret i32 0
}
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-split-alloc.ll b/llvm/test/Transforms/Coroutines/coro-split-alloc.ll
index 83bdf87cdf97..8759c525b65a 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-alloc.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-alloc.ll
@@ -1,25 +1,25 @@
; Tests that coro-split passes initialized values to coroutine frame allocator.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define i8* @f(i32 %argument) presplitcoroutine {
+define ptr @f(i32 %argument) presplitcoroutine {
entry:
%argument.addr = alloca i32, align 4
%incremented = add i32 %argument, 1
- store i32 %incremented, i32* %argument.addr, align 4
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ store i32 %incremented, ptr %argument.addr, align 4
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%need.alloc = call i1 @llvm.coro.alloc(token %id)
br i1 %need.alloc, label %dyn.alloc, label %begin
dyn.alloc:
%size = call i32 @llvm.coro.size.i32()
- %allocator_argument = load i32, i32* %argument.addr, align 4
- %alloc = call i8* @custom_alloctor(i32 %size, i32 %allocator_argument)
+ %allocator_argument = load i32, ptr %argument.addr, align 4
+ %alloc = call ptr @custom_alloctor(i32 %size, i32 %allocator_argument)
br label %begin
begin:
- %phi = phi i8* [ null, %entry ], [ %alloc, %dyn.alloc ]
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %phi)
- %print_argument = load i32, i32* %argument.addr, align 4
+ %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %phi)
+ %print_argument = load i32, ptr %argument.addr, align 4
call void @print(i32 %print_argument)
%0 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %0, label %suspend [i8 0, label %resume
@@ -29,36 +29,36 @@ resume:
br label %cleanup
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; CHECK-LABEL: @f(
; CHECK: %argument.addr = alloca i32
; CHECK: %incremented = add i32 %argument, 1
-; CHECK-NEXT: store i32 %incremented, i32* %argument.addr
+; CHECK-NEXT: store i32 %incremented, ptr %argument.addr
; CHECK-LABEL: dyn.alloc:
-; CHECK: %allocator_argument = load i32, i32* %argument.addr
-; CHECK: %alloc = call i8* @custom_alloctor(i32 24, i32 %allocator_argument)
+; CHECK: %allocator_argument = load i32, ptr %argument.addr
+; CHECK: %alloc = call ptr @custom_alloctor(i32 24, i32 %allocator_argument)
; CHECK-LABEL: begin:
-; CHECK: %print_argument = load i32, i32* %argument.addr
+; CHECK: %print_argument = load i32, ptr %argument.addr
; CHECK: call void @print(i32 %print_argument)
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @custom_alloctor(i32, i32)
+declare noalias ptr @custom_alloctor(i32, i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-split-dbg.ll b/llvm/test/Transforms/Coroutines/coro-split-dbg.ll
index 1f6a938f8784..781571d4a2ce 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-dbg.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-dbg.ll
@@ -11,20 +11,20 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare void @bar(...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
-define i8* @f() #3 !dbg !16 {
+define ptr @f() #3 !dbg !16 {
entry:
- %0 = tail call token @llvm.coro.id(i32 0, i8* null, i8* bitcast (i8* ()* @f to i8*), i8* null), !dbg !26
+ %0 = tail call token @llvm.coro.id(i32 0, ptr null, ptr @f, ptr null), !dbg !26
%1 = tail call i64 @llvm.coro.size.i64(), !dbg !26
- %call = tail call i8* @malloc(i64 %1), !dbg !26
- %2 = tail call i8* @llvm.coro.begin(token %0, i8* %call) #9, !dbg !26
- tail call void @llvm.dbg.value(metadata i8* %2, metadata !21, metadata !12), !dbg !26
+ %call = tail call ptr @malloc(i64 %1), !dbg !26
+ %2 = tail call ptr @llvm.coro.begin(token %0, ptr %call) #9, !dbg !26
+ tail call void @llvm.dbg.value(metadata ptr %2, metadata !21, metadata !12), !dbg !26
br label %for.cond, !dbg !27
for.cond: ; preds = %for.cond, %entry
tail call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !12), !dbg !28
tail call void @llvm.dbg.value(metadata i32 undef, metadata !11, metadata !12) #7, !dbg !29
tail call void (...) @bar() #7, !dbg !33
- %3 = tail call token @llvm.coro.save(i8* null), !dbg !34
+ %3 = tail call token @llvm.coro.save(ptr null), !dbg !34
%4 = tail call i8 @llvm.coro.suspend(token %3, i1 false), !dbg !34
%conv = sext i8 %4 to i32, !dbg !34
switch i32 %conv, label %coro_Suspend [
@@ -33,32 +33,32 @@ for.cond: ; preds = %for.cond, %entry
], !dbg !34
coro_Cleanup: ; preds = %for.cond
- %5 = tail call i8* @llvm.coro.free(token %0, i8* %2), !dbg !35
- tail call void @free(i8* nonnull %5), !dbg !36
+ %5 = tail call ptr @llvm.coro.free(token %0, ptr %2), !dbg !35
+ tail call void @free(ptr nonnull %5), !dbg !36
br label %coro_Suspend, !dbg !36
coro_Suspend: ; preds = %for.cond, %if.then, %coro_Cleanup
- tail call i1 @llvm.coro.end(i8* null, i1 false) #9, !dbg !38
- ret i8* %2, !dbg !39
+ tail call i1 @llvm.coro.end(ptr null, i1 false) #9, !dbg !38
+ ret ptr %2, !dbg !39
}
; Function Attrs: argmemonly nounwind
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #4
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #4
; Function Attrs: argmemonly nounwind readonly
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #5
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #5
; Function Attrs: nounwind
-declare noalias i8* @malloc(i64) local_unnamed_addr #6
+declare noalias ptr @malloc(i64) local_unnamed_addr #6
declare i64 @llvm.coro.size.i64() #1
-declare i8* @llvm.coro.begin(token, i8* writeonly) #7
-declare token @llvm.coro.save(i8*) #7
+declare ptr @llvm.coro.begin(token, ptr writeonly) #7
+declare token @llvm.coro.save(ptr) #7
declare i8 @llvm.coro.suspend(token, i1) #7
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #4
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #5
-declare void @free(i8* nocapture) local_unnamed_addr #6
-declare i1 @llvm.coro.end(i8*, i1) #7
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #5
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #4
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #5
+declare void @free(ptr nocapture) local_unnamed_addr #6
+declare i1 @llvm.coro.end(ptr, i1) #7
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #5
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll
index f8d4c36aa904..ddb8e5946e3c 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll
@@ -7,14 +7,13 @@
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -22,10 +21,9 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr2(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -33,40 +31,37 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that in the initial function resume is not marked with musttail.
; CHECK-LABEL: @f(
-; CHECK: %[[addr1:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv1:.+]] = bitcast i8* %[[addr1]] to void (i8*)*
-; CHECK-NOT: musttail call fastcc void %[[pv1]](i8* null)
+; CHECK: %[[addr1:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NOT: musttail call fastcc void %[[addr1]](ptr null)
; Verify that ppc target not using PC-Relative addressing in the resume part resume call is not marked with musttail.
; CHECK-LABEL: @f.resume(
-; CHECK: %[[addr2:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv2:.+]] = bitcast i8* %[[addr2]] to void (i8*)*
-; CHECK-NEXT: call fastcc void %[[pv2]](i8* null)
+; CHECK: %[[addr2:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NEXT: call fastcc void %[[addr2]](ptr null)
; Verify that ppc target using PC-Relative addressing in the resume part resume call is marked with musttail.
; CHECK-PCREL-LABEL: @f.resume(
-; CHECK-PCREL: %[[addr2:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-PCREL-NEXT: %[[pv2:.+]] = bitcast i8* %[[addr2]] to void (i8*)*
-; CHECK-PCREL-NEXT: musttail call fastcc void %[[pv2]](i8* null)
+; CHECK-PCREL: %[[addr2:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-PCREL-NEXT: musttail call fastcc void %[[addr2]](ptr null)
; CHECK-PCREL-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail.ll
index 56f55cf047e6..718e272c1d46 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail.ll
@@ -4,14 +4,13 @@
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -19,10 +18,9 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr2(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -30,34 +28,32 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that in the initial function resume is not marked with musttail.
; CHECK-LABEL: @f(
-; CHECK: %[[addr1:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv1:.+]] = bitcast i8* %[[addr1]] to void (i8*)*
-; CHECK-NOT: musttail call fastcc void %[[pv1]](i8* null)
+; CHECK: %[[addr1:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NOT: musttail call fastcc void %[[addr1]](ptr null)
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @f.resume(
-; CHECK: %[[addr2:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv2:.+]] = bitcast i8* %[[addr2]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv2]](i8* null)
+; CHECK: %[[addr2:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr2]](ptr null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail1.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail1.ll
index 28ccb8144b54..3a1e8694b277 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail1.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail1.ll
@@ -4,14 +4,13 @@
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -19,7 +18,7 @@ entry:
i8 1, label %exit
]
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
%br0 = call i8 @switch_result()
switch i8 %br0, label %unreach [
i8 0, label %await.resume3
@@ -27,21 +26,18 @@ await.suspend:
i8 2, label %await.resume2
]
await.resume1:
- %hdl = call i8* @g()
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* %hdl)
+ %hdl = call ptr @g()
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %addr2(ptr %hdl)
br label %final.suspend
await.resume2:
- %hdl2 = call i8* @h()
- %addr3 = call i8* @llvm.coro.subfn.addr(i8* %hdl2, i8 0)
- %pv3 = bitcast i8* %addr3 to void (i8*)*
- call fastcc void %pv3(i8* %hdl2)
+ %hdl2 = call ptr @h()
+ %addr3 = call ptr @llvm.coro.subfn.addr(ptr %hdl2, i8 0)
+ call fastcc void %addr3(ptr %hdl2)
br label %final.suspend
await.resume3:
- %addr4 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv4 = bitcast i8* %addr4 to void (i8*)*
- call fastcc void %pv4(i8* null)
+ %addr4 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr4(ptr null)
br label %final.suspend
final.suspend:
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
@@ -52,7 +48,7 @@ final.suspend:
pre.exit:
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
unreach:
unreachable
@@ -60,43 +56,39 @@ unreach:
; Verify that in the initial function resume is not marked with musttail.
; CHECK-LABEL: @f(
-; CHECK: %[[addr1:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv1:.+]] = bitcast i8* %[[addr1]] to void (i8*)*
-; CHECK-NOT: musttail call fastcc void %[[pv1]](i8* null)
+; CHECK: %[[addr1:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NOT: musttail call fastcc void %[[addr1]](ptr null)
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @f.resume(
-; CHECK: %[[hdl:.+]] = call i8* @g()
-; CHECK-NEXT: %[[addr2:.+]] = call i8* @llvm.coro.subfn.addr(i8* %[[hdl]], i8 0)
-; CHECK-NEXT: %[[pv2:.+]] = bitcast i8* %[[addr2]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv2]](i8* %[[hdl]])
+; CHECK: %[[hdl:.+]] = call ptr @g()
+; CHECK-NEXT: %[[addr2:.+]] = call ptr @llvm.coro.subfn.addr(ptr %[[hdl]], i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr2]](ptr %[[hdl]])
; CHECK-NEXT: ret void
-; CHECK: %[[hdl2:.+]] = call i8* @h()
-; CHECK-NEXT: %[[addr3:.+]] = call i8* @llvm.coro.subfn.addr(i8* %[[hdl2]], i8 0)
-; CHECK-NEXT: %[[pv3:.+]] = bitcast i8* %[[addr3]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv3]](i8* %[[hdl2]])
+; CHECK: %[[hdl2:.+]] = call ptr @h()
+; CHECK-NEXT: %[[addr3:.+]] = call ptr @llvm.coro.subfn.addr(ptr %[[hdl2]], i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr3]](ptr %[[hdl2]])
; CHECK-NEXT: ret void
-; CHECK: %[[addr4:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv4:.+]] = bitcast i8* %[[addr4]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv4]](i8* null)
+; CHECK: %[[addr4:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr4]](ptr null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
declare i8 @switch_result()
-declare i8* @g()
-declare i8* @h()
+declare ptr @g()
+declare ptr @h()
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail10.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail10.ll
index 42d6417808e4..c8f681cbcf6c 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail10.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail10.ll
@@ -6,14 +6,13 @@ target triple = "wasm64-unknown-unknown"
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -21,10 +20,9 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr2(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -32,23 +30,23 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; CHECK: musttail call
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
attributes #0 = { presplitcoroutine "target-features"="+tail-call" }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail11.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail11.ll
index 3f07448c3225..e892fa9fc21c 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail11.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail11.ll
@@ -6,14 +6,13 @@ target triple = "wasm32-unknown-unknown"
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -21,10 +20,9 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr2(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -32,23 +30,23 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; CHECK: musttail call
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
attributes #0 = { presplitcoroutine "target-features"="+tail-call" }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail2.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail2.ll
index 228f753689f9..8dc347b7c4ae 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail2.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail2.ll
@@ -2,24 +2,24 @@
; musttail call.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define void @fakeresume1(i8*) {
+define void @fakeresume1(ptr) {
entry:
ret void;
}
-define void @fakeresume2(i64* align 8) {
+define void @fakeresume2(ptr align 8) {
entry:
ret void;
}
define void @g() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -27,8 +27,8 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume2(i64* align 8 null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume2(ptr align 8 null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -36,30 +36,30 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that in the initial function resume is not marked with musttail.
; CHECK-LABEL: @g(
-; CHECK-NOT: musttail call fastcc void @fakeresume1(i8* null)
+; CHECK-NOT: musttail call fastcc void @fakeresume1(ptr null)
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @g.resume(
-; CHECK: musttail call fastcc void @fakeresume2(i64* align 8 null)
+; CHECK: musttail call fastcc void @fakeresume2(ptr align 8 null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail3.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail3.ll
index 3513e7a5721c..30ab7a2e861a 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail3.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail3.ll
@@ -4,20 +4,19 @@
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
%cmp = icmp eq i8 %suspend, 0
br i1 %cmp, label %await.suspend, label %exit
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
%br0 = call i8 @switch_result()
switch i8 %br0, label %unreach [
i8 0, label %await.resume3
@@ -25,21 +24,18 @@ await.suspend:
i8 2, label %await.resume2
]
await.resume1:
- %hdl = call i8* @g()
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* %hdl)
+ %hdl = call ptr @g()
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr %hdl, i8 0)
+ call fastcc void %addr2(ptr %hdl)
br label %final.suspend
await.resume2:
- %hdl2 = call i8* @h()
- %addr3 = call i8* @llvm.coro.subfn.addr(i8* %hdl2, i8 0)
- %pv3 = bitcast i8* %addr3 to void (i8*)*
- call fastcc void %pv3(i8* %hdl2)
+ %hdl2 = call ptr @h()
+ %addr3 = call ptr @llvm.coro.subfn.addr(ptr %hdl2, i8 0)
+ call fastcc void %addr3(ptr %hdl2)
br label %final.suspend
await.resume3:
- %addr4 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv4 = bitcast i8* %addr4 to void (i8*)*
- call fastcc void %pv4(i8* null)
+ %addr4 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr4(ptr null)
br label %final.suspend
final.suspend:
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
@@ -48,7 +44,7 @@ final.suspend:
pre.exit:
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
unreach:
unreachable
@@ -56,43 +52,39 @@ unreach:
; Verify that in the initial function resume is not marked with musttail.
; CHECK-LABEL: @f(
-; CHECK: %[[addr1:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv1:.+]] = bitcast i8* %[[addr1]] to void (i8*)*
-; CHECK-NOT: musttail call fastcc void %[[pv1]](i8* null)
+; CHECK: %[[addr1:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NOT: musttail call fastcc void %[[addr1]](ptr null)
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @f.resume(
-; CHECK: %[[hdl:.+]] = call i8* @g()
-; CHECK-NEXT: %[[addr2:.+]] = call i8* @llvm.coro.subfn.addr(i8* %[[hdl]], i8 0)
-; CHECK-NEXT: %[[pv2:.+]] = bitcast i8* %[[addr2]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv2]](i8* %[[hdl]])
+; CHECK: %[[hdl:.+]] = call ptr @g()
+; CHECK-NEXT: %[[addr2:.+]] = call ptr @llvm.coro.subfn.addr(ptr %[[hdl]], i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr2]](ptr %[[hdl]])
; CHECK-NEXT: ret void
-; CHECK: %[[hdl2:.+]] = call i8* @h()
-; CHECK-NEXT: %[[addr3:.+]] = call i8* @llvm.coro.subfn.addr(i8* %[[hdl2]], i8 0)
-; CHECK-NEXT: %[[pv3:.+]] = bitcast i8* %[[addr3]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv3]](i8* %[[hdl2]])
+; CHECK: %[[hdl2:.+]] = call ptr @h()
+; CHECK-NEXT: %[[addr3:.+]] = call ptr @llvm.coro.subfn.addr(ptr %[[hdl2]], i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr3]](ptr %[[hdl2]])
; CHECK-NEXT: ret void
-; CHECK: %[[addr4:.+]] = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
-; CHECK-NEXT: %[[pv4:.+]] = bitcast i8* %[[addr4]] to void (i8*)*
-; CHECK-NEXT: musttail call fastcc void %[[pv4]](i8* null)
+; CHECK: %[[addr4:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+; CHECK-NEXT: musttail call fastcc void %[[addr4]](ptr null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
declare i8 @switch_result()
-declare i8* @g()
-declare i8* @h()
+declare ptr @g()
+declare ptr @h()
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail4.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail4.ll
index 4341c59e1d27..93bb7ef49f29 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail4.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail4.ll
@@ -2,18 +2,18 @@
; while the user of the coro.suspend is a icmpinst.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-define void @fakeresume1(i8*) {
+define void @fakeresume1(ptr) {
entry:
ret void;
}
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%init_suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %init_suspend, label %coro.end [
@@ -21,24 +21,24 @@ entry:
i8 1, label %coro.end
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
- call fastcc void @fakeresume1(i8* align 8 null)
+ call fastcc void @fakeresume1(ptr align 8 null)
%suspend = call i8 @llvm.coro.suspend(token %save2, i1 true)
%switch = icmp ult i8 %suspend, 2
br i1 %switch, label %cleanup, label %coro.end
cleanup:
- %free.handle = call i8* @llvm.coro.free(token %id, i8* %vFrame)
- %.not = icmp eq i8* %free.handle, null
+ %free.handle = call ptr @llvm.coro.free(token %id, ptr %vFrame)
+ %.not = icmp eq ptr %free.handle, null
br i1 %.not, label %coro.end, label %coro.free
coro.free:
- call void @delete(i8* nonnull %free.handle) #2
+ call void @delete(ptr nonnull %free.handle) #2
br label %coro.end
coro.end:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
@@ -46,18 +46,18 @@ coro.end:
; CHECK: musttail call fastcc void @fakeresume1(
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
-declare void @delete(i8* nonnull) #2
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
+declare void @delete(ptr nonnull) #2
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail5.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail5.ll
index 4c444437413b..b892b6b30409 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail5.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail5.ll
@@ -2,17 +2,17 @@
; to convert a resuming call to a musttail call.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-declare void @fakeresume1(i64* align 8)
+declare void @fakeresume1(ptr align 8)
define void @g() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
%alloc.var = alloca i8
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %alloc.var)
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %alloc.var)
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -20,41 +20,41 @@ entry:
i8 1, label %exit
]
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume1(i64* align 8 null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume1(ptr align 8 null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
i8 0, label %await.ready
i8 1, label %exit
]
await.ready:
- call void @consume(i8* %alloc.var)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %alloc.var)
+ call void @consume(ptr %alloc.var)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %alloc.var)
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @g.resume(
-; CHECK: musttail call fastcc void @fakeresume1(i64* align 8 null)
+; CHECK: musttail call fastcc void @fakeresume1(ptr align 8 null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
-declare void @consume(i8*)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
+declare void @consume(ptr)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail6.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail6.ll
index 123b56fa4ed8..846d2b5ab6b2 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail6.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail6.ll
@@ -5,18 +5,17 @@
; optimize.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-declare void @fakeresume1(i64* align 8)
+declare void @fakeresume1(ptr align 8)
define void @g() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
%alloc.var = alloca i64
- %alloca.var.i8 = bitcast i64* %alloc.var to i8*
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %alloca.var.i8)
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %alloc.var)
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -24,38 +23,37 @@ entry:
i8 1, label %exit
]
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume1(i64* align 8 null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume1(ptr align 8 null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
i8 0, label %await.ready
i8 1, label %exit
]
await.ready:
- call void @consume(i64* %alloc.var)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %alloca.var.i8)
+ call void @consume(ptr %alloc.var)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %alloc.var)
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @g.resume(
-; CHECK: musttail call fastcc void @fakeresume1(i64* align 8 null)
+; CHECK: musttail call fastcc void @fakeresume1(ptr align 8 null)
; CHECK-NEXT: ret void
; It has a cleanup bb.
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
%alloc.var = alloca i64
- %alloca.var.i8 = bitcast i64* %alloc.var to i8*
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %alloca.var.i8)
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %alloc.var)
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -63,53 +61,53 @@ entry:
i8 1, label %exit
]
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume1(i64* align 8 null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume1(ptr align 8 null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
i8 0, label %await.ready
i8 1, label %cleanup
]
await.ready:
- call void @consume(i64* %alloc.var)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %alloca.var.i8)
+ call void @consume(ptr %alloc.var)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %alloc.var)
br label %exit
cleanup:
- %free.handle = call i8* @llvm.coro.free(token %id, i8* %vFrame)
- %.not = icmp eq i8* %free.handle, null
+ %free.handle = call ptr @llvm.coro.free(token %id, ptr %vFrame)
+ %.not = icmp eq ptr %free.handle, null
br i1 %.not, label %exit, label %coro.free
coro.free:
- call void @delete(i8* nonnull %free.handle) #2
+ call void @delete(ptr nonnull %free.handle) #2
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; FIXME: The fakeresume1 here should be marked as musttail.
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @f.resume(
-; CHECK: musttail call fastcc void @fakeresume1(i64* align 8 null)
+; CHECK: musttail call fastcc void @fakeresume1(ptr align 8 null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
-declare void @delete(i8* nonnull) #2
-declare void @consume(i64*)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
+declare void @delete(ptr nonnull) #2
+declare void @consume(ptr)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail7.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail7.ll
index c4923f868955..3280bfd60327 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail7.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail7.ll
@@ -5,18 +5,17 @@
; which makes the optimization harder.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-declare void @fakeresume1(i64* align 8)
+declare void @fakeresume1(ptr align 8)
define void @g() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
%alloc.var = alloca i64
- %alloca.var.i8 = bitcast i64* %alloc.var to i8*
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %alloca.var.i8)
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %alloc.var)
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -24,39 +23,37 @@ entry:
i8 1, label %exit
]
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume1(i64* align 8 null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume1(ptr align 8 null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
i8 0, label %await.ready
i8 1, label %exit
]
await.ready:
- call void @consume(i64* %alloc.var)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %alloca.var.i8)
+ call void @consume(ptr %alloc.var)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %alloc.var)
br label %exit
exit:
- %.unused = getelementptr inbounds i8, i8* %vFrame, i32 0
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @g.resume(
-; CHECK: musttail call fastcc void @fakeresume1(i64* align 8 null)
+; CHECK: musttail call fastcc void @fakeresume1(ptr align 8 null)
; CHECK-NEXT: ret void
; It has a cleanup bb.
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
%alloc.var = alloca i64
- %alloca.var.i8 = bitcast i64* %alloc.var to i8*
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %alloca.var.i8)
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %alloc.var)
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -64,54 +61,53 @@ entry:
i8 1, label %exit
]
await.suspend:
- %save2 = call token @llvm.coro.save(i8* null)
- call fastcc void @fakeresume1(i64* align 8 null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ call fastcc void @fakeresume1(ptr align 8 null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
i8 0, label %await.ready
i8 1, label %cleanup
]
await.ready:
- call void @consume(i64* %alloc.var)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %alloca.var.i8)
+ call void @consume(ptr %alloc.var)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %alloc.var)
br label %exit
cleanup:
- %free.handle = call i8* @llvm.coro.free(token %id, i8* %vFrame)
- %.not = icmp eq i8* %free.handle, null
+ %free.handle = call ptr @llvm.coro.free(token %id, ptr %vFrame)
+ %.not = icmp eq ptr %free.handle, null
br i1 %.not, label %exit, label %coro.free
coro.free:
- call void @delete(i8* nonnull %free.handle) #2
+ call void @delete(ptr nonnull %free.handle) #2
br label %exit
exit:
- %.unused = getelementptr inbounds i8, i8* %vFrame, i32 0
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; FIXME: The fakeresume1 here should be marked as musttail.
; Verify that in the resume part resume call is marked with musttail.
; CHECK-LABEL: @f.resume(
-; CHECK: musttail call fastcc void @fakeresume1(i64* align 8 null)
+; CHECK: musttail call fastcc void @fakeresume1(ptr align 8 null)
; CHECK-NEXT: ret void
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
-declare void @delete(i8* nonnull) #2
-declare void @consume(i64*)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
+declare void @delete(ptr nonnull) #2
+declare void @consume(ptr)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
attributes #0 = { presplitcoroutine }
attributes #1 = { argmemonly nounwind readonly }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail8.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail8.ll
index eff763caac13..25da65e2c440 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail8.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail8.ll
@@ -8,14 +8,13 @@ target triple = "wasm32-unknown-unknown"
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -23,10 +22,9 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr2(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -34,23 +32,23 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; CHECK-NOT: musttail
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
declare void @print()
attributes #0 = { presplitcoroutine }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-musttail9.ll b/llvm/test/Transforms/Coroutines/coro-split-musttail9.ll
index ad1d9ea3ab69..6b41cad6be35 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-musttail9.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-musttail9.ll
@@ -8,14 +8,13 @@ target triple = "wasm64-unknown-unknown"
define void @f() #0 {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
- %save = call token @llvm.coro.save(i8* null)
- %addr1 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv1 = bitcast i8* %addr1 to void (i8*)*
- call fastcc void %pv1(i8* null)
+ %save = call token @llvm.coro.save(ptr null)
+ %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr1(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
@@ -23,10 +22,9 @@ entry:
i8 1, label %exit
]
await.ready:
- %save2 = call token @llvm.coro.save(i8* null)
- %addr2 = call i8* @llvm.coro.subfn.addr(i8* null, i8 0)
- %pv2 = bitcast i8* %addr2 to void (i8*)*
- call fastcc void %pv2(i8* null)
+ %save2 = call token @llvm.coro.save(ptr null)
+ %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
+ call fastcc void %addr2(ptr null)
%suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
switch i8 %suspend2, label %exit [
@@ -34,23 +32,23 @@ await.ready:
i8 1, label %exit
]
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; CHECK-NOT: musttail
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*) #1
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
declare i1 @llvm.coro.alloc(token) #2
declare i64 @llvm.coro.size.i64() #3
-declare i8* @llvm.coro.begin(token, i8* writeonly) #2
-declare token @llvm.coro.save(i8*) #2
-declare i8* @llvm.coro.frame() #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #2
+declare token @llvm.coro.save(ptr) #2
+declare ptr @llvm.coro.frame() #3
declare i8 @llvm.coro.suspend(token, i1) #2
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #1
-declare i1 @llvm.coro.end(i8*, i1) #2
-declare i8* @llvm.coro.subfn.addr(i8* nocapture readonly, i8) #1
-declare i8* @malloc(i64)
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
+declare i1 @llvm.coro.end(ptr, i1) #2
+declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
+declare ptr @malloc(i64)
declare void @print()
attributes #0 = { presplitcoroutine }
diff --git a/llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll b/llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
index d7dfa3380732..771468cd4ac0 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
@@ -2,30 +2,28 @@
; sink them to the places after the suspend block.
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
-%"struct.std::coroutine_handle" = type { i8* }
+%"struct.std::coroutine_handle" = type { ptr }
%"struct.std::coroutine_handle.0" = type { %"struct.std::coroutine_handle" }
%"struct.lean_future<int>::Awaiter" = type { i32, %"struct.std::coroutine_handle.0" }
declare i1 @getcond()
-declare i8* @malloc(i64)
+declare ptr @malloc(i64)
declare void @print(i32)
define void @a() presplitcoroutine {
entry:
%ref.tmp7 = alloca %"struct.lean_future<int>::Awaiter", align 8
%testval = alloca i32
- %cast = bitcast i32* %testval to i8*
; lifetime of %testval starts here, but not used until await.ready.
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %cast)
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
- %alloc = call i8* @malloc(i64 16) #3
- %vFrame = call noalias nonnull i8* @llvm.coro.begin(token %id, i8* %alloc)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %testval)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
+ %alloc = call ptr @malloc(i64 16) #3
+ %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
%testcond = call i1 @getcond()
br i1 %testcond, label %if.suspend, label %else.direct
if.suspend:
- %save = call token @llvm.coro.save(i8* null)
- %Result.i19 = getelementptr inbounds %"struct.lean_future<int>::Awaiter", %"struct.lean_future<int>::Awaiter"* %ref.tmp7, i64 0, i32 0
+ %save = call token @llvm.coro.save(ptr null)
%suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
switch i8 %suspend, label %exit [
i8 0, label %await.ready
@@ -36,40 +34,40 @@ else.direct:
br label %after.await
await.ready:
- %StrayCoroSave = call token @llvm.coro.save(i8* null)
- %val = load i32, i32* %Result.i19
- %test = load i32, i32* %testval
+ %StrayCoroSave = call token @llvm.coro.save(ptr null)
+ %val = load i32, ptr %ref.tmp7
+ %test = load i32, ptr %testval
call void @print(i32 %test)
call void @print(i32 %val)
br label %after.await
after.await:
- %test1 = load i32, i32* %testval
+ %test1 = load i32, ptr %testval
call void @print(i32 %test1)
- call void @llvm.lifetime.end.p0i8(i64 4, i8* %cast)
+ call void @llvm.lifetime.end.p0(i64 4, ptr %testval)
br label %exit
exit:
- call i1 @llvm.coro.end(i8* null, i1 false)
+ call i1 @llvm.coro.end(ptr null, i1 false)
ret void
}
; CHECK-LABEL: @a.resume(
; CHECK: %[[VAL:testval.+]] = getelementptr inbounds %a.Frame
-; CHECK-NOT: call void @llvm.lifetime.start.p0i8(i64 4, i8* %{{.*}})
-; CHECK: %test = load i32, i32* %[[VAL]]
+; CHECK-NOT: call void @llvm.lifetime.start.p0(i64 4, ptr %{{.*}})
+; CHECK: %test = load i32, ptr %[[VAL]]
-declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
+declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)
declare i1 @llvm.coro.alloc(token) #3
-declare noalias nonnull i8* @"\01??2 at YAPEAX_K@Z"(i64) local_unnamed_addr
+declare noalias nonnull ptr @"\01??2 at YAPEAX_K@Z"(i64) local_unnamed_addr
declare i64 @llvm.coro.size.i64() #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #3
+declare ptr @llvm.coro.begin(token, ptr writeonly) #3
declare void @"\01?puts@@YAXZZ"(...)
-declare token @llvm.coro.save(i8*) #3
-declare i8* @llvm.coro.frame() #5
+declare token @llvm.coro.save(ptr) #3
+declare ptr @llvm.coro.frame() #5
declare i8 @llvm.coro.suspend(token, i1) #3
-declare void @"\01??3 at YAXPEAX@Z"(i8*) local_unnamed_addr #10
-declare i8* @llvm.coro.free(token, i8* nocapture readonly) #2
-declare i1 @llvm.coro.end(i8*, i1) #3
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #4
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #4
+declare void @"\01??3 at YAXPEAX@Z"(ptr) local_unnamed_addr #10
+declare ptr @llvm.coro.free(token, ptr nocapture readonly) #2
+declare i1 @llvm.coro.end(ptr, i1) #3
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #4
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #4
diff --git a/llvm/test/Transforms/Coroutines/ex0.ll b/llvm/test/Transforms/Coroutines/ex0.ll
index 2a92dde2820d..4ef0910e5e72 100644
--- a/llvm/test/Transforms/Coroutines/ex0.ll
+++ b/llvm/test/Transforms/Coroutines/ex0.ll
@@ -1,12 +1,12 @@
; First example from Doc/Coroutines.rst (two block loop)
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
br label %loop
loop:
@@ -20,21 +20,21 @@ resume:
br label %loop
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
+ ret ptr %hdl
}
; CHECK-LABEL: @main(
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.destroy(i8* %hdl)
+ %hdl = call ptr @f(i32 4)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
ret i32 0
; CHECK: entry:
; CHECK: call void @print(i32 4)
@@ -43,17 +43,17 @@ entry:
; CHECK: ret i32 0
}
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
-declare i8* @llvm.coro.alloc(token)
-declare i8* @llvm.coro.free(token, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
+declare ptr @llvm.coro.alloc(token)
+declare ptr @llvm.coro.free(token, ptr)
declare i32 @llvm.coro.size.i32()
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/ex1.ll b/llvm/test/Transforms/Coroutines/ex1.ll
index 6f42ccfd2b66..fd969c2c1f6a 100644
--- a/llvm/test/Transforms/Coroutines/ex1.ll
+++ b/llvm/test/Transforms/Coroutines/ex1.ll
@@ -1,12 +1,12 @@
; First example from Doc/Coroutines.rst (one block loop)
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call noalias i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call noalias ptr @llvm.coro.begin(token %id, ptr %alloc)
br label %loop
loop:
%n.val = phi i32 [ %n, %entry ], [ %inc, %loop ]
@@ -16,21 +16,21 @@ loop:
switch i8 %0, label %suspend [i8 0, label %loop
i8 1, label %cleanup]
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 false)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 false)
+ ret ptr %hdl
}
; CHECK-LABEL: @main(
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.destroy(i8* %hdl)
+ %hdl = call ptr @f(i32 4)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
ret i32 0
; CHECK-NEXT: entry:
; CHECK: call void @print(i32 4)
@@ -39,16 +39,16 @@ entry:
; CHECK: ret i32 0
}
-declare i8* @malloc(i32)
-declare void @free(i8*)
+declare ptr @malloc(i32)
+declare void @free(ptr)
declare void @print(i32)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i32 @llvm.coro.size.i32()
-declare i8* @llvm.coro.begin(token, i8*)
+declare ptr @llvm.coro.begin(token, ptr)
declare i8 @llvm.coro.suspend(token, i1)
-declare i8* @llvm.coro.free(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.free(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/ex2.ll b/llvm/test/Transforms/Coroutines/ex2.ll
index d52482e7e904..ade3bc7b9885 100644
--- a/llvm/test/Transforms/Coroutines/ex2.ll
+++ b/llvm/test/Transforms/Coroutines/ex2.ll
@@ -1,18 +1,18 @@
; Second example from Doc/Coroutines.rst (custom alloc and free functions)
; RUN: opt < %s -passes='default<O2>' -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
br i1 %need.dyn.alloc, label %dyn.alloc, label %coro.begin
dyn.alloc:
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @CustomAlloc(i32 %size)
+ %alloc = call ptr @CustomAlloc(i32 %size)
br label %coro.begin
coro.begin:
- %phi = phi i8* [ null, %entry ], [ %alloc, %dyn.alloc ]
- %hdl = call noalias i8* @llvm.coro.begin(token %id, i8* %phi)
+ %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
+ %hdl = call noalias ptr @llvm.coro.begin(token %id, ptr %phi)
br label %loop
loop:
%n.val = phi i32 [ %n, %coro.begin ], [ %inc, %loop ]
@@ -22,48 +22,48 @@ loop:
switch i8 %0, label %suspend [i8 0, label %loop
i8 1, label %cleanup]
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- %need.dyn.free = icmp ne i8* %mem, null
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ %need.dyn.free = icmp ne ptr %mem, null
br i1 %need.dyn.free, label %dyn.free, label %suspend
dyn.free:
- call void @CustomFree(i8* %mem)
+ call void @CustomFree(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 false)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 false)
+ ret ptr %hdl
}
; CHECK-LABEL: @main
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.resume(i8* %hdl)
- %to = icmp eq i8* %hdl, null
+ %hdl = call ptr @f(i32 4)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.resume(ptr %hdl)
+ %to = icmp eq ptr %hdl, null
br i1 %to, label %return, label %destroy
destroy:
- call void @llvm.coro.destroy(i8* %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
br label %return
return:
ret i32 0
-; CHECK-NOT: call i8* @CustomAlloc
+; CHECK-NOT: call ptr @CustomAlloc
; CHECK: call void @print(i32 4)
; CHECK-NEXT: call void @print(i32 5)
; CHECK-NEXT: call void @print(i32 6)
; CHECK-NEXT: ret i32 0
}
-declare i8* @CustomAlloc(i32)
-declare void @CustomFree(i8*)
+declare ptr @CustomAlloc(i32)
+declare void @CustomFree(ptr)
declare void @print(i32)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
declare i32 @llvm.coro.size.i32()
-declare i8* @llvm.coro.begin(token, i8*)
+declare ptr @llvm.coro.begin(token, ptr)
declare i8 @llvm.coro.suspend(token, i1)
-declare i8* @llvm.coro.free(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.free(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/ex3.ll b/llvm/test/Transforms/Coroutines/ex3.ll
index af57b8a5fcbb..60dfc33bf135 100644
--- a/llvm/test/Transforms/Coroutines/ex3.ll
+++ b/llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,18 +1,18 @@
; Third example from Doc/Coroutines.rst (two suspend points)
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
%need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
br i1 %need.dyn.alloc, label %dyn.alloc, label %coro.begin
dyn.alloc:
- %alloc = call i8* @malloc(i32 %size)
+ %alloc = call ptr @malloc(i32 %size)
br label %coro.begin
coro.begin:
- %phi = phi i8* [ null, %entry ], [ %alloc, %dyn.alloc ]
- %hdl = call noalias i8* @llvm.coro.begin(token %id, i8* %phi)
+ %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
+ %hdl = call noalias ptr @llvm.coro.begin(token %id, ptr %phi)
br label %loop
loop:
%n.val = phi i32 [ %n, %coro.begin ], [ %inc, %loop.resume ]
@@ -28,46 +28,46 @@ loop.resume:
switch i8 %1, label %suspend [i8 0, label %loop
i8 1, label %cleanup]
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 false)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 false)
+ ret ptr %hdl
}
; CHECK-LABEL: @main
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
- call void @llvm.coro.resume(i8* %hdl)
- call void @llvm.coro.resume(i8* %hdl)
- %c = ptrtoint i8* %hdl to i64
+ %hdl = call ptr @f(i32 4)
+ call void @llvm.coro.resume(ptr %hdl)
+ call void @llvm.coro.resume(ptr %hdl)
+ %c = ptrtoint ptr %hdl to i64
%to = icmp eq i64 %c, 0
br i1 %to, label %return, label %destroy
destroy:
- call void @llvm.coro.destroy(i8* %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
br label %return
return:
ret i32 0
-; CHECK-NOT: i8* @malloc
+; CHECK-NOT: ptr @malloc
; CHECK: call void @print(i32 4)
; CHECK-NEXT: call void @print(i32 -5)
; CHECK-NEXT: call void @print(i32 5)
; CHECK: ret i32 0
}
-declare i8* @malloc(i32)
-declare void @free(i8*)
+declare ptr @malloc(i32)
+declare void @free(ptr)
declare void @print(i32)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
declare i32 @llvm.coro.size.i32()
-declare i8* @llvm.coro.begin(token, i8*)
+declare ptr @llvm.coro.begin(token, ptr)
declare i8 @llvm.coro.suspend(token, i1)
-declare i8* @llvm.coro.free(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.free(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/ex4.ll b/llvm/test/Transforms/Coroutines/ex4.ll
index b9505a68c63e..d4dba1cf818d 100644
--- a/llvm/test/Transforms/Coroutines/ex4.ll
+++ b/llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,52 +1,50 @@
; Fourth example from Doc/Coroutines.rst (coroutine promise)
; RUN: opt < %s -passes='default<O2>' -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
%promise = alloca i32
- %pv = bitcast i32* %promise to i8*
- %id = call token @llvm.coro.id(i32 0, i8* %pv, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr %promise, ptr null, ptr null)
%need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
br i1 %need.dyn.alloc, label %dyn.alloc, label %coro.begin
dyn.alloc:
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
+ %alloc = call ptr @malloc(i32 %size)
br label %coro.begin
coro.begin:
- %phi = phi i8* [ null, %entry ], [ %alloc, %dyn.alloc ]
- %hdl = call noalias i8* @llvm.coro.begin(token %id, i8* %phi)
+ %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
+ %hdl = call noalias ptr @llvm.coro.begin(token %id, ptr %phi)
br label %loop
loop:
%n.val = phi i32 [ %n, %coro.begin ], [ %inc, %loop ]
%inc = add nsw i32 %n.val, 1
- store i32 %n.val, i32* %promise
+ store i32 %n.val, ptr %promise
%0 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %0, label %suspend [i8 0, label %loop
i8 1, label %cleanup]
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 false)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 false)
+ ret ptr %hdl
}
; CHECK-LABEL: @main
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
- %promise.addr.raw = call i8* @llvm.coro.promise(i8* %hdl, i32 4, i1 false)
- %promise.addr = bitcast i8* %promise.addr.raw to i32*
- %val0 = load i32, i32* %promise.addr
+ %hdl = call ptr @f(i32 4)
+ %promise.addr.raw = call ptr @llvm.coro.promise(ptr %hdl, i32 4, i1 false)
+ %val0 = load i32, ptr %promise.addr.raw
call void @print(i32 %val0)
- call void @llvm.coro.resume(i8* %hdl)
- %val1 = load i32, i32* %promise.addr
+ call void @llvm.coro.resume(ptr %hdl)
+ %val1 = load i32, ptr %promise.addr.raw
call void @print(i32 %val1)
- call void @llvm.coro.resume(i8* %hdl)
- %val2 = load i32, i32* %promise.addr
+ call void @llvm.coro.resume(ptr %hdl)
+ %val2 = load i32, ptr %promise.addr.raw
call void @print(i32 %val2)
- call void @llvm.coro.destroy(i8* %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
ret i32 0
; CHECK: call void @print(i32 4)
; CHECK-NEXT: call void @print(i32 5)
@@ -54,18 +52,18 @@ entry:
; CHECK: ret i32 0
}
-declare i8* @llvm.coro.promise(i8*, i32, i1)
-declare i8* @malloc(i32)
-declare void @free(i8*)
+declare ptr @llvm.coro.promise(ptr, i32, i1)
+declare ptr @malloc(i32)
+declare void @free(ptr)
declare void @print(i32)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
declare i1 @llvm.coro.alloc(token)
declare i32 @llvm.coro.size.i32()
-declare i8* @llvm.coro.begin(token, i8*)
+declare ptr @llvm.coro.begin(token, ptr)
declare i8 @llvm.coro.suspend(token, i1)
-declare i8* @llvm.coro.free(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.free(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/ex5.ll b/llvm/test/Transforms/Coroutines/ex5.ll
index 69b2e6d071c8..e6daec528ce4 100644
--- a/llvm/test/Transforms/Coroutines/ex5.ll
+++ b/llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,12 +1,12 @@
; Fifth example from Doc/Coroutines.rst (final suspend)
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call noalias i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call noalias ptr @llvm.coro.begin(token %id, ptr %alloc)
br label %while.cond
while.cond:
%n.val = phi i32 [ %n, %entry ], [ %dec, %while.body ]
@@ -27,38 +27,38 @@ trap:
call void @llvm.trap()
unreachable
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
- call i1 @llvm.coro.end(i8* %hdl, i1 false)
- ret i8* %hdl
+ call i1 @llvm.coro.end(ptr %hdl, i1 false)
+ ret ptr %hdl
}
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
declare void @llvm.trap()
-declare void @free(i8* nocapture)
+declare void @free(ptr nocapture)
-declare token @llvm.coro.id( i32, i8*, i8*, i8*)
+declare token @llvm.coro.id( i32, ptr, ptr, ptr)
declare i32 @llvm.coro.size.i32()
-declare i8* @llvm.coro.begin(token, i8*)
-declare token @llvm.coro.save(i8*)
+declare ptr @llvm.coro.begin(token, ptr)
+declare token @llvm.coro.save(ptr)
declare i8 @llvm.coro.suspend(token, i1)
-declare i8* @llvm.coro.free(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare ptr @llvm.coro.free(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
; CHECK-LABEL: @main
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
+ %hdl = call ptr @f(i32 4)
br label %while
while:
- call void @llvm.coro.resume(i8* %hdl)
- %done = call i1 @llvm.coro.done(i8* %hdl)
+ call void @llvm.coro.resume(ptr %hdl)
+ %done = call i1 @llvm.coro.done(ptr %hdl)
br i1 %done, label %end, label %while
end:
- call void @llvm.coro.destroy(i8* %hdl)
+ call void @llvm.coro.destroy(ptr %hdl)
ret i32 0
; CHECK: call void @print(i32 4)
@@ -68,6 +68,6 @@ end:
; CHECK: ret i32 0
}
-declare i1 @llvm.coro.done(i8*)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare i1 @llvm.coro.done(ptr)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/phi-coro-end.ll b/llvm/test/Transforms/Coroutines/phi-coro-end.ll
index 249e5c2eebc1..52cecce869e4 100644
--- a/llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ b/llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,48 +1,48 @@
; Verify that we correctly handle suspend when the coro.end block contains phi
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -S | FileCheck %s
-define i8* @f(i32 %n) presplitcoroutine {
+define ptr @f(i32 %n) presplitcoroutine {
entry:
- %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
+ %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
%size = call i32 @llvm.coro.size.i32()
- %alloc = call i8* @malloc(i32 %size)
- %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)
+ %alloc = call ptr @malloc(i32 %size)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
%0 = call i8 @llvm.coro.suspend(token none, i1 false)
switch i8 %0, label %suspend [i8 0, label %cleanup i8 1, label %cleanup]
cleanup:
- %mem = call i8* @llvm.coro.free(token %id, i8* %hdl)
- call void @free(i8* %mem)
+ %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
+ call void @free(ptr %mem)
br label %suspend
suspend:
%r = phi i32 [%n, %entry], [1, %cleanup]
- call i1 @llvm.coro.end(i8* %hdl, i1 false)
+ call i1 @llvm.coro.end(ptr %hdl, i1 false)
call void @print(i32 %r)
- ret i8* %hdl
+ ret ptr %hdl
}
; CHECK-LABEL: @main
define i32 @main() {
entry:
- %hdl = call i8* @f(i32 4)
- call void @llvm.coro.resume(i8* %hdl)
+ %hdl = call ptr @f(i32 4)
+ call void @llvm.coro.resume(ptr %hdl)
ret i32 0
;CHECK: call void @print(i32 4)
;CHECK: ret i32 0
}
-declare i8* @llvm.coro.alloc()
+declare ptr @llvm.coro.alloc()
declare i32 @llvm.coro.size.i32()
-declare i8* @llvm.coro.free(token, i8*)
+declare ptr @llvm.coro.free(token, ptr)
declare i8 @llvm.coro.suspend(token, i1)
-declare void @llvm.coro.resume(i8*)
-declare void @llvm.coro.destroy(i8*)
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
-declare i1 @llvm.coro.end(i8*, i1)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
+declare i1 @llvm.coro.end(ptr, i1)
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
declare void @print(i32)
-declare void @free(i8*)
+declare void @free(ptr)
diff --git a/llvm/test/Transforms/Coroutines/smoketest.ll b/llvm/test/Transforms/Coroutines/smoketest.ll
index 49894d81cb1c..bb85acecb03c 100644
--- a/llvm/test/Transforms/Coroutines/smoketest.ll
+++ b/llvm/test/Transforms/Coroutines/smoketest.ll
@@ -22,7 +22,7 @@
; CHECK-ALL: CoroSplitPass
; CHECK-ALL: CoroCleanupPass
-declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+declare token @llvm.coro.id(i32, ptr, ptr, ptr)
define void @foo() {
ret void
More information about the llvm-commits
mailing list