Skip to content

Commit 795bbba

Browse files
committed
Move check to TargetTransformInfo
1 parent e190567 commit 795bbba

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ bool TargetTransformInfo::hasBranchDivergence(const Function *F) const {
288288
}
289289

290290
bool TargetTransformInfo::isSourceOfDivergence(const Value *V) const {
291+
if (auto Call = dyn_cast<CallBase>(V)) {
292+
if (Call->hasFnAttr(Attribute::NoDivergenceSource))
293+
return false;
294+
}
291295
return TTIImpl->isSourceOfDivergence(V);
292296
}
293297

llvm/lib/Analysis/UniformityAnalysis.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ bool llvm::GenericUniformityAnalysisImpl<SSAContext>::markDefsDivergent(
3232

3333
template <> void llvm::GenericUniformityAnalysisImpl<SSAContext>::initialize() {
3434
for (auto &I : instructions(F)) {
35-
bool NoDivergenceSource = false;
36-
if (auto Call = dyn_cast<CallBase>(&I))
37-
NoDivergenceSource = Call->hasFnAttr(Attribute::NoDivergenceSource);
38-
if (!NoDivergenceSource && TTI->isSourceOfDivergence(&I))
35+
if (TTI->isSourceOfDivergence(&I))
3936
markDivergent(I);
4037
else if (TTI->isAlwaysUniform(&I))
4138
addUniformOverride(I);

0 commit comments

Comments
 (0)