[llvm] r367581 - [Attributor][FIX] Indicate a missing update change
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 09:21:54 PDT 2019
Author: jdoerfert
Date: Thu Aug 1 09:21:54 2019
New Revision: 367581
URL: http://llvm.org/viewvc/llvm-project?rev=367581&view=rev
Log:
[Attributor][FIX] Indicate a missing update change
User of AAReturnedValues need to know if HasOverdefinedReturnedCalls
changed from false to true as it will impact the result of the return
value traversal (calls are not ignored anymore).
This will be tested with the tests in D59978.
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=367581&r1=367580&r2=367581&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Attributor.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Attributor.cpp Thu Aug 1 09:21:54 2019
@@ -722,6 +722,9 @@ ChangeStatus AAReturnedValuesImpl::updat
decltype(ReturnedValues) AddRVs;
bool HasCallSite = false;
+ // Keep track of any change to trigger updates on dependent attributes.
+ ChangeStatus Changed = ChangeStatus::UNCHANGED;
+
// Look at all returned call sites.
for (auto &It : ReturnedValues) {
SmallPtrSet<ReturnInst *, 2> &ReturnInsts = It.second;
@@ -742,6 +745,8 @@ ChangeStatus AAReturnedValuesImpl::updat
// Try to find a assumed unique return value for the called function.
auto *RetCSAA = A.getAAFor<AAReturnedValuesImpl>(*this, *RV);
if (!RetCSAA) {
+ if (!HasOverdefinedReturnedCalls)
+ Changed = ChangeStatus::CHANGED;
HasOverdefinedReturnedCalls = true;
LLVM_DEBUG(dbgs() << "[AAReturnedValues] Returned call site (" << *RV
<< ") with " << (RetCSAA ? "invalid" : "no")
@@ -763,6 +768,8 @@ ChangeStatus AAReturnedValuesImpl::updat
// If multiple, non-refinable values were found, there cannot be a unique
// return value for the called function. The returned call is overdefined!
if (!AssumedUniqueRV.getValue()) {
+ if (!HasOverdefinedReturnedCalls)
+ Changed = ChangeStatus::CHANGED;
HasOverdefinedReturnedCalls = true;
LLVM_DEBUG(dbgs() << "[AAReturnedValues] Returned call site has multiple "
"potentially returned values\n");
@@ -791,9 +798,6 @@ ChangeStatus AAReturnedValuesImpl::updat
AddRVs[AssumedRetVal].insert(ReturnInsts.begin(), ReturnInsts.end());
}
- // Keep track of any change to trigger updates on dependent attributes.
- ChangeStatus Changed = ChangeStatus::UNCHANGED;
-
for (auto &It : AddRVs) {
assert(!It.second.empty() && "Entry does not add anything.");
auto &ReturnInsts = ReturnedValues[It.first];
More information about the llvm-commits
mailing list