Skip to content

Commit 3e21ebd

Browse files
fix formatting
1 parent e48430e commit 3e21ebd

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

llvm/lib/Transforms/Coroutines/CoroAnnotationElide.cpp

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ static Instruction *getFirstNonAllocaInTheEntryBlock(Function *F) {
4444
// Create an alloca in the caller, using FrameSize and FrameAlign as the callee
4545
// coroutine's activation frame.
4646
static Value *allocateFrameInCaller(Function *Caller, uint64_t FrameSize,
47-
Align FrameAlign) {
47+
Align FrameAlign) {
4848
LLVMContext &C = Caller->getContext();
4949
BasicBlock::iterator InsertPt =
50-
getFirstNonAllocaInTheEntryBlock(Caller)->getIterator();
50+
getFirstNonAllocaInTheEntryBlock(Caller)->getIterator();
5151
const DataLayout &DL = Caller->getDataLayout();
5252
auto FrameTy = ArrayType::get(Type::getInt8Ty(C), FrameSize);
5353
auto *Frame = new AllocaInst(FrameTy, DL.getAllocaAddrSpace(), "", InsertPt);
@@ -61,7 +61,7 @@ static Value *allocateFrameInCaller(Function *Caller, uint64_t FrameSize,
6161
// - Replace the old CB with a new Call or Invoke to `NewCallee`, with the
6262
// pointer to the frame as an additional argument to NewCallee.
6363
static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
64-
uint64_t FrameSize, Align FrameAlign) {
64+
uint64_t FrameSize, Align FrameAlign) {
6565
// TODO: generate the lifetime intrinsics for the new frame. This will require
6666
// introduction of two pesudo lifetime intrinsics in the frontend around the
6767
// `co_await` expression and convert them to real lifetime intrinsics here.
@@ -74,13 +74,13 @@ static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
7474

7575
if (auto *CI = dyn_cast<CallInst>(CB)) {
7676
auto *NewCI = CallInst::Create(NewCallee->getFunctionType(), NewCallee,
77-
NewArgs, "", NewCBInsertPt);
77+
NewArgs, "", NewCBInsertPt);
7878
NewCI->setTailCallKind(CI->getTailCallKind());
7979
NewCB = NewCI;
8080
} else if (auto *II = dyn_cast<InvokeInst>(CB)) {
8181
NewCB = InvokeInst::Create(NewCallee->getFunctionType(), NewCallee,
82-
II->getNormalDest(), II->getUnwindDest(),
83-
NewArgs, {}, "", NewCBInsertPt);
82+
II->getNormalDest(), II->getUnwindDest(),
83+
NewArgs, {}, "", NewCBInsertPt);
8484
} else {
8585
llvm_unreachable("CallBase should either be Call or Invoke!");
8686
}
@@ -90,7 +90,7 @@ static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
9090
NewCB->setAttributes(CB->getAttributes());
9191
NewCB->setDebugLoc(CB->getDebugLoc());
9292
std::copy(CB->bundle_op_info_begin(), CB->bundle_op_info_end(),
93-
NewCB->bundle_op_info_begin());
93+
NewCB->bundle_op_info_begin());
9494

9595
NewCB->removeFnAttr(llvm::Attribute::CoroElideSafe);
9696
CB->replaceAllUsesWith(NewCB);
@@ -106,15 +106,15 @@ static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
106106
}
107107

108108
PreservedAnalyses CoroAnnotationElidePass::run(LazyCallGraph::SCC &C,
109-
CGSCCAnalysisManager &AM,
110-
LazyCallGraph &CG,
111-
CGSCCUpdateResult &UR) {
109+
CGSCCAnalysisManager &AM,
110+
LazyCallGraph &CG,
111+
CGSCCUpdateResult &UR) {
112112
bool Changed = false;
113113
CallGraphUpdater CGUpdater;
114114
CGUpdater.initialize(CG, C, AM, UR);
115115

116116
auto &FAM =
117-
AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C, CG).getManager();
117+
AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C, CG).getManager();
118118

119119
for (LazyCallGraph::Node &N : C) {
120120
Function *Callee = &N.getFunction();
@@ -131,8 +131,10 @@ PreservedAnalyses CoroAnnotationElidePass::run(LazyCallGraph::SCC &C,
131131
}
132132
}
133133
auto FramePtrArgPosition = NewCallee->arg_size() - 1;
134-
auto FrameSize = NewCallee->getParamDereferenceableBytes(FramePtrArgPosition);
135-
auto FrameAlign = NewCallee->getParamAlign(FramePtrArgPosition).valueOrOne();
134+
auto FrameSize =
135+
NewCallee->getParamDereferenceableBytes(FramePtrArgPosition);
136+
auto FrameAlign =
137+
NewCallee->getParamAlign(FramePtrArgPosition).valueOrOne();
136138

137139
auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(*Callee);
138140

@@ -149,26 +151,28 @@ PreservedAnalyses CoroAnnotationElidePass::run(LazyCallGraph::SCC &C,
149151
processCall(CB, Caller, NewCallee, FrameSize, FrameAlign);
150152

151153
ORE.emit([&]() {
152-
return OptimizationRemark(DEBUG_TYPE, "CoroAnnotationElide", Caller)
153-
<< "'" << ore::NV("callee", Callee->getName()) << "' elided in '"
154-
<< ore::NV("caller", Caller->getName()) << "'";
155-
});
154+
return OptimizationRemark(DEBUG_TYPE, "CoroAnnotationElide", Caller)
155+
<< "'" << ore::NV("callee", Callee->getName())
156+
<< "' elided in '" << ore::NV("caller", Caller->getName())
157+
<< "'";
158+
});
156159

157160
FAM.invalidate(*Caller, PreservedAnalyses::none());
158161
Changed = true;
159162
updateCGAndAnalysisManagerForCGSCCPass(CG, *CallerC, *CallerN, AM, UR,
160-
FAM);
163+
FAM);
161164

162165
} else {
163166
ORE.emit([&]() {
164-
return OptimizationRemarkMissed(DEBUG_TYPE, "CoroAnnotationElide",
165-
Caller)
166-
<< "'" << ore::NV("callee", Callee->getName()) << "' not elided in '"
167-
<< ore::NV("caller", Caller->getName()) << "' (caller_presplit="
168-
<< ore::NV("caller_presplit", IsCallerPresplitCoroutine)
169-
<< ", elide_safe_attr=" << ore::NV("elide_safe_attr", HasAttr)
170-
<< ")";
171-
});
167+
return OptimizationRemarkMissed(DEBUG_TYPE, "CoroAnnotationElide",
168+
Caller)
169+
<< "'" << ore::NV("callee", Callee->getName())
170+
<< "' not elided in '" << ore::NV("caller", Caller->getName())
171+
<< "' (caller_presplit="
172+
<< ore::NV("caller_presplit", IsCallerPresplitCoroutine)
173+
<< ", elide_safe_attr=" << ore::NV("elide_safe_attr", HasAttr)
174+
<< ")";
175+
});
172176
}
173177
}
174178
}

0 commit comments

Comments
 (0)