Skip to content

Commit ff9b636

Browse files
committed
Small fixes based on code review.
1 parent e5e18d4 commit ff9b636

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

llvm/lib/Transforms/Utils/InlineFunction.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,21 +179,20 @@ namespace {
179179
}
180180
}
181181
};
182+
} // end anonymous namespace
182183

183-
IntrinsicInst *getConevrgenceEntryIfAny(BasicBlock &BB) {
184-
auto *I = BB.getFirstNonPHI();
185-
while (I) {
186-
if (auto *IntrinsicCall = dyn_cast<IntrinsicInst>(I)) {
187-
if (IntrinsicCall->getIntrinsicID() ==
188-
Intrinsic::experimental_convergence_entry) {
189-
return IntrinsicCall;
190-
}
184+
static IntrinsicInst *getConvergenceEntry(BasicBlock &BB) {
185+
auto *I = BB.getFirstNonPHI();
186+
while (I) {
187+
if (auto *IntrinsicCall = dyn_cast<ConvergenceControlInst>(I)) {
188+
if (IntrinsicCall->isEntry()) {
189+
return IntrinsicCall;
191190
}
192-
I = I->getNextNode();
193191
}
194-
return nullptr;
192+
I = I->getNextNode();
195193
}
196-
} // end anonymous namespace
194+
return nullptr;
195+
}
197196

198197
/// Get or create a target for the branch from ResumeInsts.
199198
BasicBlock *LandingPadInliningInfo::getInnerResumeDest() {
@@ -2451,8 +2450,8 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
24512450
// fully implements convergence control tokens, there is no mixing of
24522451
// controlled and uncontrolled convergent operations in the whole program.
24532452
if (CB.isConvergent()) {
2454-
auto *I = getConevrgenceEntryIfAny(CalledFunc->getEntryBlock());
2455-
if (I && !ConvergenceControlToken) {
2453+
if (!ConvergenceControlToken &&
2454+
getConvergenceEntry(CalledFunc->getEntryBlock())) {
24562455
return InlineResult::failure(
24572456
"convergent call needs convergencectrl operand");
24582457
}
@@ -2745,7 +2744,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
27452744
}
27462745

27472746
if (ConvergenceControlToken) {
2748-
auto *IntrinsicCall = getConevrgenceEntryIfAny(*FirstNewBlock);
2747+
auto *IntrinsicCall = getConvergenceEntry(*FirstNewBlock);
27492748
if (IntrinsicCall) {
27502749
IntrinsicCall->replaceAllUsesWith(ConvergenceControlToken);
27512750
IntrinsicCall->eraseFromParent();

0 commit comments

Comments
 (0)