[llvm] fd520e7 - [Attributor] Verify `checkForAllUses` return value properly

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 15:50:42 PDT 2021


Author: Johannes Doerfert
Date: 2021-07-27T17:50:27-05:00
New Revision: fd520e75f173f380de530f101005e16256a6de42

URL: https://github.com/llvm/llvm-project/commit/fd520e75f173f380de530f101005e16256a6de42
DIFF: https://github.com/llvm/llvm-project/commit/fd520e75f173f380de530f101005e16256a6de42.diff

LOG: [Attributor] Verify `checkForAllUses` return value properly

Also do not emit more than one remark after Heap2Stack failed.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 538c37a1985f..98ce286d5139 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -6163,7 +6163,8 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
                       "parameter as `__attribute__((noescape))` to override.";
           };
 
-          if (AI.LibraryFunctionId == LibFunc___kmpc_alloc_shared)
+          if (ValidUsesOnly &&
+              AI.LibraryFunctionId == LibFunc___kmpc_alloc_shared)
             A.emitRemark<OptimizationRemarkMissed>(AI.CB, "OMP113", Remark);
 
           LLVM_DEBUG(dbgs() << "[H2S] Bad user: " << *UserI << "\n");
@@ -6183,7 +6184,8 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
       ValidUsesOnly = false;
       return true;
     };
-    A.checkForAllUses(Pred, *this, *AI.CB);
+    if (!A.checkForAllUses(Pred, *this, *AI.CB))
+      return false;
     return ValidUsesOnly;
   };
 


        


More information about the llvm-commits mailing list