[llvm] r369236 - Revert [Attributor] Fix: Do not partially resolve returned calls.

David L. Jones via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 00:16:24 PDT 2019


Author: dlj
Date: Mon Aug 19 00:16:24 2019
New Revision: 369236

URL: http://llvm.org/viewvc/llvm-project?rev=369236&view=rev
Log:
Revert [Attributor] Fix: Do not partially resolve returned calls.

This reverts r369160 (git commit f72d9b1c97b41fff48ad1eecbba59a29c171bff4)

r369160 caused some tests to fail under UBSAN. See thread on llvm-commits.

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=369236&r1=369235&r2=369236&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Attributor.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Attributor.cpp Mon Aug 19 00:16:24 2019
@@ -943,35 +943,12 @@ ChangeStatus AAReturnedValuesImpl::updat
                       << static_cast<const AbstractAttribute &>(RetValAA)
                       << "\n");
 
-    // Do not try to learn partial information. If the callee has unresolved
-    // return values we will treat the call as unresolved/opaque.
-    auto &RetValAAUnresolvedCalls = RetValAA.getUnresolvedCalls();
-    if (!RetValAAUnresolvedCalls.empty()) {
-      UnresolvedCalls.insert(CB);
-      continue;
-    }
-
-    // Now check if we can track transitively returned values. If possible, thus
-    // if all return value can be represented in the current scope, do so.
-    bool Unresolved = false;
-    for (auto &RetValAAIt : RetValAA.returned_values()) {
-      Value *RetVal = RetValAAIt.first;
-      if (isa<Argument>(RetVal) || isa<CallBase>(RetVal) ||
-          isa<Constant>(RetVal))
-        continue;
-      // Anything that did not fit in the above categories cannot be resolved,
-      // mark the call as unresolved.
-      LLVM_DEBUG(dbgs() << "[AAReturnedValues] transitively returned value "
-                           "cannot be translated: "
-                        << *RetVal << "\n");
-      UnresolvedCalls.insert(CB);
-      Unresolved = true;
-      break;
-    }
-
-    if (Unresolved)
-      continue;
+    // If we know something but not everyting about the returned values, keep
+    // track of that too. Hence, remember transitively unresolved calls.
+    UnresolvedCalls.insert(RetValAA.getUnresolvedCalls().begin(),
+                           RetValAA.getUnresolvedCalls().end());
 
+    // Now track transitively returned values.
     for (auto &RetValAAIt : RetValAA.returned_values()) {
       Value *RetVal = RetValAAIt.first;
       if (Argument *Arg = dyn_cast<Argument>(RetVal)) {
@@ -990,6 +967,12 @@ ChangeStatus AAReturnedValuesImpl::updat
         NewRVsMap[RetVal].insert(It.second.begin(), It.second.end());
         continue;
       }
+      // Anything that did not fit in the above categories cannot be resolved,
+      // mark the call as unresolved.
+      LLVM_DEBUG(dbgs() << "[AAReturnedValues] transitively returned value "
+                           "cannot be translated: "
+                        << *RetVal << "\n");
+      UnresolvedCalls.insert(CB);
     }
   }
 




More information about the llvm-commits mailing list