Skip to content

Commit 1fea9e0

Browse files
git clang-format
1 parent 62131d5 commit 1fea9e0

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
@@ -43,10 +43,10 @@ static Instruction *getFirstNonAllocaInTheEntryBlock(Function *F) {
4343
// Create an alloca in the caller, using FrameSize and FrameAlign as the callee
4444
// coroutine's activation frame.
4545
static Value *allocateFrameInCaller(Function *Caller, uint64_t FrameSize,
46-
Align FrameAlign) {
46+
Align FrameAlign) {
4747
LLVMContext &C = Caller->getContext();
4848
BasicBlock::iterator InsertPt =
49-
getFirstNonAllocaInTheEntryBlock(Caller)->getIterator();
49+
getFirstNonAllocaInTheEntryBlock(Caller)->getIterator();
5050
const DataLayout &DL = Caller->getDataLayout();
5151
auto FrameTy = ArrayType::get(Type::getInt8Ty(C), FrameSize);
5252
auto *Frame = new AllocaInst(FrameTy, DL.getAllocaAddrSpace(), "", InsertPt);
@@ -60,7 +60,7 @@ static Value *allocateFrameInCaller(Function *Caller, uint64_t FrameSize,
6060
// - Replace the old CB with a new Call or Invoke to `NewCallee`, with the
6161
// pointer to the frame as an additional argument to NewCallee.
6262
static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
63-
uint64_t FrameSize, Align FrameAlign) {
63+
uint64_t FrameSize, Align FrameAlign) {
6464
// TODO: generate the lifetime intrinsics for the new frame. This will require
6565
// introduction of two pesudo lifetime intrinsics in the frontend around the
6666
// `co_await` expression and convert them to real lifetime intrinsics here.
@@ -73,13 +73,13 @@ static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
7373

7474
if (auto *CI = dyn_cast<CallInst>(CB)) {
7575
auto *NewCI = CallInst::Create(NewCallee->getFunctionType(), NewCallee,
76-
NewArgs, "", NewCBInsertPt);
76+
NewArgs, "", NewCBInsertPt);
7777
NewCI->setTailCallKind(CI->getTailCallKind());
7878
NewCB = NewCI;
7979
} else if (auto *II = dyn_cast<InvokeInst>(CB)) {
8080
NewCB = InvokeInst::Create(NewCallee->getFunctionType(), NewCallee,
81-
II->getNormalDest(), II->getUnwindDest(),
82-
NewArgs, {}, "", NewCBInsertPt);
81+
II->getNormalDest(), II->getUnwindDest(),
82+
NewArgs, {}, "", NewCBInsertPt);
8383
} else {
8484
llvm_unreachable("CallBase should either be Call or Invoke!");
8585
}
@@ -89,7 +89,7 @@ static void processCall(CallBase *CB, Function *Caller, Function *NewCallee,
8989
NewCB->setAttributes(CB->getAttributes());
9090
NewCB->setDebugLoc(CB->getDebugLoc());
9191
std::copy(CB->bundle_op_info_begin(), CB->bundle_op_info_end(),
92-
NewCB->bundle_op_info_begin());
92+
NewCB->bundle_op_info_begin());
9393

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

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

115115
auto &FAM =
116-
AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C, CG).getManager();
116+
AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C, CG).getManager();
117117

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

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

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

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

156159
FAM.invalidate(*Caller, PreservedAnalyses::none());
157160
Changed = true;
158161
updateCGAndAnalysisManagerForCGSCCPass(CG, *CallerC, *CallerN, AM, UR,
159-
FAM);
162+
FAM);
160163

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

0 commit comments

Comments
 (0)