1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[Attributor][FIX] Do not return CHANGED unconditionally

This caused us to rerun AAMemoryBehaviorFloating::updateImpl over and
over again. Unfortunately it turned out to be hard to reproduce the
behavior in a reasonable way.
This commit is contained in:
Johannes Doerfert 2021-07-26 11:53:43 -05:00
parent 04130ef1fa
commit d40841959b

View File

@ -7097,6 +7097,9 @@ ChangeStatus AAMemoryBehaviorFloating::updateImpl(Attributor &A) {
return ChangeStatus::UNCHANGED; return ChangeStatus::UNCHANGED;
} }
// The current assumed state used to determine a change.
auto AssumedState = S.getAssumed();
// Make sure the value is not captured (except through "return"), if // Make sure the value is not captured (except through "return"), if
// it is, any information derived would be irrelevant anyway as we cannot // it is, any information derived would be irrelevant anyway as we cannot
// check the potential aliases introduced by the capture. However, no need // check the potential aliases introduced by the capture. However, no need
@ -7105,12 +7108,10 @@ ChangeStatus AAMemoryBehaviorFloating::updateImpl(Attributor &A) {
A.getAAFor<AANoCapture>(*this, IRP, DepClassTy::OPTIONAL); A.getAAFor<AANoCapture>(*this, IRP, DepClassTy::OPTIONAL);
if (!ArgNoCaptureAA.isAssumedNoCaptureMaybeReturned()) { if (!ArgNoCaptureAA.isAssumedNoCaptureMaybeReturned()) {
S.intersectAssumedBits(FnMemAssumedState); S.intersectAssumedBits(FnMemAssumedState);
return ChangeStatus::CHANGED; return (AssumedState != getAssumed()) ? ChangeStatus::CHANGED
: ChangeStatus::UNCHANGED;
} }
// The current assumed state used to determine a change.
auto AssumedState = S.getAssumed();
// Visit and expand uses until all are analyzed or a fixpoint is reached. // Visit and expand uses until all are analyzed or a fixpoint is reached.
auto UsePred = [&](const Use &U, bool &Follow) -> bool { auto UsePred = [&](const Use &U, bool &Follow) -> bool {
Instruction *UserI = cast<Instruction>(U.getUser()); Instruction *UserI = cast<Instruction>(U.getUser());