Skip to content

Commit b9c17e4

Browse files
committed
review feedback
1 parent 64b87ef commit b9c17e4

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,14 +1132,14 @@ struct BitTest {
11321132
};
11331133

11341134
// Returns the first convergence entry/loop/anchor instruction found in |BB|.
1135-
// std::nullopt otherwise.
1136-
std::optional<llvm::IntrinsicInst *> getConvergenceToken(llvm::BasicBlock *BB) {
1135+
// std::nullptr otherwise.
1136+
llvm::IntrinsicInst *getConvergenceToken(llvm::BasicBlock *BB) {
11371137
for (auto &I : *BB) {
11381138
auto *II = dyn_cast<llvm::IntrinsicInst>(&I);
11391139
if (II && isConvergenceControlIntrinsic(II->getIntrinsicID()))
11401140
return II;
11411141
}
1142-
return std::nullopt;
1142+
return nullptr;
11431143
}
11441144

11451145
} // namespace
@@ -1166,19 +1166,15 @@ CodeGenFunction::EmitConvergenceLoop(llvm::BasicBlock *BB,
11661166
Builder.restoreIP(IP);
11671167

11681168
auto I = AddConvergenceControlAttr(CB, ParentToken);
1169-
// Controlled convergence is incompatible with uncontrolled convergence.
1170-
// Removing any old attributes.
1171-
I->setNotConvergent();
1172-
11731169
return cast<llvm::IntrinsicInst>(I);
11741170
}
11751171

11761172
llvm::IntrinsicInst *
11771173
CodeGenFunction::getOrEmitConvergenceEntryToken(llvm::Function *F) {
11781174
auto *BB = &F->getEntryBlock();
1179-
auto token = getConvergenceToken(BB);
1180-
if (token.has_value())
1181-
return token.value();
1175+
auto *token = getConvergenceToken(BB);
1176+
if (token)
1177+
return token;
11821178

11831179
// Adding a convergence token requires the function to be marked as
11841180
// convergent.
@@ -1198,9 +1194,9 @@ llvm::IntrinsicInst *
11981194
CodeGenFunction::getOrEmitConvergenceLoopToken(const LoopInfo *LI) {
11991195
assert(LI != nullptr);
12001196

1201-
auto token = getConvergenceToken(LI->getHeader());
1202-
if (token.has_value())
1203-
return *token;
1197+
auto *token = getConvergenceToken(LI->getHeader());
1198+
if (token)
1199+
return token;
12041200

12051201
llvm::IntrinsicInst *PII =
12061202
LI->getParent()

clang/lib/CodeGen/CGCall.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5686,8 +5686,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
56865686
if (!CI->getType()->isVoidTy())
56875687
CI->setName("call");
56885688

5689-
if (getTarget().getTriple().isSPIRVLogical() &&
5690-
CI->getCalledFunction()->isConvergent())
5689+
if (getTarget().getTriple().isSPIRVLogical() && CI->isConvergent())
56915690
CI = AddControlledConvergenceAttr(CI);
56925691

56935692
// Update largest vector width from the return type.

clang/lib/CodeGen/CGLoopInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ class LoopInfoStack {
297297

298298
/// Returns true if there is LoopInfo on the stack.
299299
bool hasInfo() const { return !Active.empty(); }
300-
301300
/// Return the LoopInfo for the current loop. HasInfo should be called
302301
/// first to ensure LoopInfo is present.
303302
const LoopInfo &getInfo() const { return *Active.back(); }

0 commit comments

Comments
 (0)