1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[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
This commit is contained in:
Joseph Huber 2021-06-22 16:58:13 -04:00 committed by Huber, Joseph
parent 458d10ff3a
commit 1aa9483992

View File

@ -2311,7 +2311,7 @@ struct AAExecutionDomainFunction : public AAExecutionDomain {
}
bool isExecutedByInitialThreadOnly(const BasicBlock &BB) const override {
return SingleThreadedBBs.contains(&BB);
return isValidState() && SingleThreadedBBs.contains(&BB);
}
/// Set of basic blocks that are executed by a single thread.
@ -2331,8 +2331,9 @@ ChangeStatus AAExecutionDomainFunction::updateImpl(Attributor &A) {
const auto &ExecutionDomainAA = A.getAAFor<AAExecutionDomain>(
*this, IRPosition::function(*ACS.getInstruction()->getFunction()),
DepClassTy::REQUIRED);
return ExecutionDomainAA.isExecutedByInitialThreadOnly(
*ACS.getInstruction());
return ACS.isDirectCall() &&
ExecutionDomainAA.isExecutedByInitialThreadOnly(
*ACS.getInstruction());
};
if (!A.checkForAllCallSites(PredForCallSite, *this,