[llvm] 3f8b1d0 - [LICM] Add some debug output to scalar promotion (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 05:46:43 PDT 2022


Author: Nikita Popov
Date: 2022-09-01T14:46:30+02:00
New Revision: 3f8b1d0f1595d90c3eba7a9828b96f0a1746bdfe

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

LOG: [LICM] Add some debug output to scalar promotion (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LICM.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index d0c6cf8df4bb..550cecac0bce 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1910,6 +1910,12 @@ bool llvm::promoteLoopAccessesToScalars(
          SafetyInfo != nullptr &&
          "Unexpected Input to promoteLoopAccessesToScalars");
 
+  LLVM_DEBUG({
+    dbgs() << "Trying to promote set of must-aliased pointers:\n";
+    for (Value *Ptr : PointerMustAliases)
+      dbgs() << "  " << *Ptr << "\n";
+  });
+
   Value *SomePtr = *PointerMustAliases.begin();
   BasicBlock *Preheader = CurLoop->getLoopPreheader();
 
@@ -2097,8 +2103,10 @@ bool llvm::promoteLoopAccessesToScalars(
     return false;
 
   // If we couldn't prove we can hoist the load, bail.
-  if (!DereferenceableInPH)
+  if (!DereferenceableInPH) {
+    LLVM_DEBUG(dbgs() << "Not promoting: Not dereferenceable in preheader\n");
     return false;
+  }
 
   // We know we can hoist the load, but don't have a guaranteed store.
   // Check whether the location is thread-local. If it is, then we can insert


        


More information about the llvm-commits mailing list