From cedd0d9a6e4b433e1cd6585d1d4d152eb5e60b11 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Mon, 19 Aug 2019 08:00:08 +0000 Subject: [PATCH] Revert [Attributor] Fix: Make sure we set the changed flag This reverts r369159 (git commit cbaf1fdea2de891bdbc49cdec89ae2077e6b9ed0) r369160 caused a test to fail under UBSAN. See thread on llvm-commits. llvm-svn: 369241 --- llvm/lib/Transforms/IPO/Attributor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 882d0931f9f4..4339a65f5e63 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 RetInsts; }; @@ -906,8 +906,9 @@ 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(I); - RVState RVS({ReturnedValues, Changed, {}}); + RVState RVS({ReturnedValues, false, {}}); RVS.RetInsts.insert(&Ret); + Changed |= RVS.Changed; return VisitReturnedValue(*Ret.getReturnValue(), RVS); }; @@ -954,8 +955,7 @@ ChangeStatus AAReturnedValuesImpl::updateImpl(Attributor &A) { if (Argument *Arg = dyn_cast(RetVal)) { // Arguments are mapped to call site operands and we begin the traversal // again. - bool Unused; - RVState RVS({NewRVsMap, Unused, RetValAAIt.second}); + RVState RVS({NewRVsMap, false, RetValAAIt.second}); VisitReturnedValue(*CB->getArgOperand(Arg->getArgNo()), RVS); continue; } else if (isa(RetVal)) {