forked from OSchip/llvm-project
[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. llvm-svn: 367581
This commit is contained in:
parent
0620cf11ec
commit
da4d811707
|
@ -722,6 +722,9 @@ ChangeStatus AAReturnedValuesImpl::updateImpl(Attributor &A) {
|
|||
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::updateImpl(Attributor &A) {
|
|||
// 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::updateImpl(Attributor &A) {
|
|||
// 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::updateImpl(Attributor &A) {
|
|||
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];
|
||||
|
|
Loading…
Reference in New Issue