summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJohannes Doerfert <jdoerfert@anl.gov>2019-08-16 21:55:01 +0000
committerJohannes Doerfert <jdoerfert@anl.gov>2019-08-16 21:55:01 +0000
commitcbaf1fdea2de891bdbc49cdec89ae2077e6b9ed0 (patch)
tree3be54a94ecadbafa972c5242f5f46a0e8d2cc4cb /llvm/lib
parent17cb91853638facffe4a26fbf632c845a9830359 (diff)
downloadbcm5719-llvm-cbaf1fdea2de891bdbc49cdec89ae2077e6b9ed0.tar.gz
bcm5719-llvm-cbaf1fdea2de891bdbc49cdec89ae2077e6b9ed0.zip
[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. llvm-svn: 369159
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 4339a65f5e6..882d0931f9f 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -878,7 +878,7 @@ ChangeStatus AAReturnedValuesImpl::updateImpl(Attributor &A) {
// 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::updateImpl(Attributor &A) {
// 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::updateImpl(Attributor &A) {
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)) {
OpenPOWER on IntegriCloud