Skip to content

Commit 1cfdcae

Browse files
jhuber6jhuber-ornl
authored andcommitted
[Attributor] Fix AAExecutionDomain returning true on invalid states
This patch fixes a problem with the AAExecutionDomain attributor not checking if it is in a valid state. This can cause it to incorrectly return that a block is executed in a single threaded context after the attributor failed for any reason. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D103186
1 parent a8bf33a commit 1cfdcae

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@ struct AAExecutionDomainFunction : public AAExecutionDomain {
23112311
}
23122312

23132313
bool isExecutedByInitialThreadOnly(const BasicBlock &BB) const override {
2314-
return SingleThreadedBBs.contains(&BB);
2314+
return isValidState() && SingleThreadedBBs.contains(&BB);
23152315
}
23162316

23172317
/// Set of basic blocks that are executed by a single thread.
@@ -2331,8 +2331,9 @@ ChangeStatus AAExecutionDomainFunction::updateImpl(Attributor &A) {
23312331
const auto &ExecutionDomainAA = A.getAAFor<AAExecutionDomain>(
23322332
*this, IRPosition::function(*ACS.getInstruction()->getFunction()),
23332333
DepClassTy::REQUIRED);
2334-
return ExecutionDomainAA.isExecutedByInitialThreadOnly(
2335-
*ACS.getInstruction());
2334+
return ACS.isDirectCall() &&
2335+
ExecutionDomainAA.isExecutedByInitialThreadOnly(
2336+
*ACS.getInstruction());
23362337
};
23372338

23382339
if (!A.checkForAllCallSites(PredForCallSite, *this,

0 commit comments

Comments
 (0)