[llvm] r369159 - [Attributor] Fix: Make sure we set the changed flag
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 14:55:02 PDT 2019
Author: jdoerfert
Date: Fri Aug 16 14:55:01 2019
New Revision: 369159
URL: http://llvm.org/viewvc/llvm-project?rev=369159&view=rev
Log:
[Attributor] Fix: Make sure we set the changed flag
The flag was updated *before* we actually run the visitor callback so we
might miss updates.
Modified:
llvm/trunk/lib/Transforms/IPO/Attributor.cpp
Modified: llvm/trunk/lib/Transforms/IPO/Attributor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Attributor.cpp?rev=369159&r1=369158&r2=369159&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Attributor.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Attributor.cpp Fri Aug 16 14:55:01 2019
@@ -878,7 +878,7 @@ ChangeStatus AAReturnedValuesImpl::updat
// The map in which we collect return values -> return instrs.
decltype(ReturnedValues) &RetValsMap;
// The flag to indicate a change.
- bool Changed;
+ bool &Changed;
// The return instrs we come from.
SmallPtrSet<ReturnInst *, 2> RetInsts;
};
@@ -906,9 +906,8 @@ ChangeStatus AAReturnedValuesImpl::updat
// Callback for all "return intructions" live in the associated function.
auto CheckReturnInst = [this, &VisitReturnedValue, &Changed](Instruction &I) {
ReturnInst &Ret = cast<ReturnInst>(I);
- RVState RVS({ReturnedValues, false, {}});
+ RVState RVS({ReturnedValues, Changed, {}});
RVS.RetInsts.insert(&Ret);
- Changed |= RVS.Changed;
return VisitReturnedValue(*Ret.getReturnValue(), RVS);
};
@@ -955,7 +954,8 @@ ChangeStatus AAReturnedValuesImpl::updat
if (Argument *Arg = dyn_cast<Argument>(RetVal)) {
// Arguments are mapped to call site operands and we begin the traversal
// again.
- RVState RVS({NewRVsMap, false, RetValAAIt.second});
+ bool Unused;
+ RVState RVS({NewRVsMap, Unused, RetValAAIt.second});
VisitReturnedValue(*CB->getArgOperand(Arg->getArgNo()), RVS);
continue;
} else if (isa<CallBase>(RetVal)) {
More information about the llvm-commits
mailing list