[llvm] 15cd1e3 - [llvm][NFC][CallSite] Remove CallSite from CoroEarly
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 20 18:15:41 PDT 2020
Author: Mircea Trofin
Date: 2020-04-20T18:15:25-07:00
New Revision: 15cd1e36e443d10eb9abb779ffb86c2f4619637d
URL: https://github.com/llvm/llvm-project/commit/15cd1e36e443d10eb9abb779ffb86c2f4619637d
DIFF: https://github.com/llvm/llvm-project/commit/15cd1e36e443d10eb9abb779ffb86c2f4619637d.diff
LOG: [llvm][NFC][CallSite] Remove CallSite from CoroEarly
Reviewers: dblaikie, craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78523
Added:
Modified:
llvm/lib/Transforms/Coroutines/CoroEarly.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Coroutines/CoroEarly.cpp b/llvm/lib/Transforms/Coroutines/CoroEarly.cpp
index 55cca12acd0c..242e6c3f6b23 100644
--- a/llvm/lib/Transforms/Coroutines/CoroEarly.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroEarly.cpp
@@ -8,7 +8,6 @@
#include "llvm/Transforms/Coroutines/CoroEarly.h"
#include "CoroInternal.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Module.h"
@@ -25,7 +24,7 @@ class Lowerer : public coro::LowererBase {
PointerType *const AnyResumeFnPtrTy;
Constant *NoopCoro = nullptr;
- void lowerResumeOrDestroy(CallSite CS, CoroSubFnInst::ResumeKind);
+ void lowerResumeOrDestroy(CallBase &CB, CoroSubFnInst::ResumeKind);
void lowerCoroPromise(CoroPromiseInst *Intrin);
void lowerCoroDone(IntrinsicInst *II);
void lowerCoroNoop(IntrinsicInst *II);
@@ -44,12 +43,11 @@ class Lowerer : public coro::LowererBase {
// an address returned by coro.subfn.addr intrinsic. This is done so that
// CGPassManager recognizes devirtualization when CoroElide pass replaces a call
// to coro.subfn.addr with an appropriate function address.
-void Lowerer::lowerResumeOrDestroy(CallSite CS,
+void Lowerer::lowerResumeOrDestroy(CallBase &CB,
CoroSubFnInst::ResumeKind Index) {
- Value *ResumeAddr =
- makeSubFnCall(CS.getArgOperand(0), Index, CS.getInstruction());
- CS.setCalledFunction(ResumeAddr);
- CS.setCallingConv(CallingConv::Fast);
+ Value *ResumeAddr = makeSubFnCall(CB.getArgOperand(0), Index, &CB);
+ CB.setCalledOperand(ResumeAddr);
+ CB.setCallingConv(CallingConv::Fast);
}
// Coroutine promise field is always at the fixed offset from the beginning of
@@ -153,8 +151,8 @@ bool Lowerer::lowerEarlyIntrinsics(Function &F) {
SmallVector<CoroFreeInst *, 4> CoroFrees;
for (auto IB = inst_begin(F), IE = inst_end(F); IB != IE;) {
Instruction &I = *IB++;
- if (auto CS = CallSite(&I)) {
- switch (CS.getIntrinsicID()) {
+ if (auto *CB = dyn_cast<CallBase>(&I)) {
+ switch (CB->getIntrinsicID()) {
default:
continue;
case Intrinsic::coro_free:
@@ -164,13 +162,13 @@ bool Lowerer::lowerEarlyIntrinsics(Function &F) {
// Make sure that final suspend point is not duplicated as CoroSplit
// pass expects that there is at most one final suspend point.
if (cast<CoroSuspendInst>(&I)->isFinal())
- CS.setCannotDuplicate();
+ CB->setCannotDuplicate();
break;
case Intrinsic::coro_end:
// Make sure that fallthrough coro.end is not duplicated as CoroSplit
// pass expects that there is at most one fallthrough coro.end.
if (cast<CoroEndInst>(&I)->isFallthrough())
- CS.setCannotDuplicate();
+ CB->setCannotDuplicate();
break;
case Intrinsic::coro_noop:
lowerCoroNoop(cast<IntrinsicInst>(&I));
@@ -192,10 +190,10 @@ bool Lowerer::lowerEarlyIntrinsics(Function &F) {
F.addFnAttr(CORO_PRESPLIT_ATTR, PREPARED_FOR_SPLIT);
break;
case Intrinsic::coro_resume:
- lowerResumeOrDestroy(CS, CoroSubFnInst::ResumeIndex);
+ lowerResumeOrDestroy(*CB, CoroSubFnInst::ResumeIndex);
break;
case Intrinsic::coro_destroy:
- lowerResumeOrDestroy(CS, CoroSubFnInst::DestroyIndex);
+ lowerResumeOrDestroy(*CB, CoroSubFnInst::DestroyIndex);
break;
case Intrinsic::coro_promise:
lowerCoroPromise(cast<CoroPromiseInst>(&I));
More information about the llvm-commits
mailing list