From: Simon Pilgrim Date: Fri, 25 Feb 2022 14:42:31 +0000 (+0000) Subject: [IPO] AAFunctionReachabilityFunction.updateImpl - reduce AAReachability scope. NFCI. X-Git-Tag: upstream/15.0.7~15283 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b422455ddeb424e6c771de822889c3c352bd2ac;p=platform%2Fupstream%2Fllvm.git [IPO] AAFunctionReachabilityFunction.updateImpl - reduce AAReachability scope. NFCI. We already have a check for !InstQueries.empty(), so move the for-range over InstQueries inside to avoid the AAReachability uninitialized variable static analysis warnings. --- diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index ba986a6..40b2162 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -9849,22 +9849,21 @@ public: } // Update the Instruction queries. - const AAReachability *Reachability; if (!InstQueries.empty()) { - Reachability = &A.getAAFor( + const AAReachability *Reachability = &A.getAAFor( *this, IRPosition::function(*getAssociatedFunction()), DepClassTy::REQUIRED); - } - // Check for local callbases first. - for (auto &InstPair : InstQueries) { - SmallVector CallEdges; - bool AllKnown = - getReachableCallEdges(A, *Reachability, *InstPair.first, CallEdges); - // Update will return change if we this effects any queries. - if (!AllKnown) - InstPair.second.CanReachUnknownCallee = true; - Change |= InstPair.second.update(A, *this, CallEdges); + // Check for local callbases first. + for (auto &InstPair : InstQueries) { + SmallVector CallEdges; + bool AllKnown = + getReachableCallEdges(A, *Reachability, *InstPair.first, CallEdges); + // Update will return change if we this effects any queries. + if (!AllKnown) + InstPair.second.CanReachUnknownCallee = true; + Change |= InstPair.second.update(A, *this, CallEdges); + } } return Change;