[llvm] 2bc51d3 - [Attributor][NFC] Add helpful debug outputs

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sun May 23 20:08:37 PDT 2021


Author: Johannes Doerfert
Date: 2021-05-23T20:47:05-05:00
New Revision: 2bc51d39db7a997af24776fbef3c0d552aa91ef8

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

LOG: [Attributor][NFC] Add helpful debug outputs

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index fc025ea12407..0d48e9409332 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1354,6 +1354,13 @@ ChangeStatus Attributor::cleanupIR() {
   LLVM_DEBUG(dbgs() << "[Attributor] DeadInsts size: " << DeadInsts.size()
                     << "\n");
 
+  LLVM_DEBUG({
+    dbgs() << "[Attributor] DeadInsts size: " << DeadInsts.size() << "\n";
+    for (auto &I : DeadInsts)
+      if (I)
+        dbgs() << "  - " << *I << "\n";
+  });
+
   RecursivelyDeleteTriviallyDeadInstructions(DeadInsts);
 
   if (unsigned NumDeadBlocks = ToBeDeletedBlocks.size()) {
@@ -2330,8 +2337,12 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
   if (Functions.empty())
     return false;
 
-  LLVM_DEBUG(dbgs() << "[Attributor] Run on module with " << Functions.size()
-                    << " functions.\n");
+  LLVM_DEBUG({
+    dbgs() << "[Attributor] Run on module with " << Functions.size()
+           << " functions:\n";
+    for (Function *Fn : Functions)
+      dbgs() << "  - " << Fn->getName() << "\n";
+  });
 
   // Create an Attributor and initially empty information cache that is filled
   // while we identify default attribute opportunities.

diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 7504f2a4d911..c66ba600f6b1 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -4537,6 +4537,11 @@ struct AAValueSimplifyImpl : AAValueSimplify {
 
   /// See AbstractAttribute::getAsStr().
   const std::string getAsStr() const override {
+    LLVM_DEBUG({
+      errs() << "SAV: " << SimplifiedAssociatedValue << " ";
+      if (SimplifiedAssociatedValue)
+        errs() << "SAV: " << **SimplifiedAssociatedValue << " ";
+    });
     return getAssumed() ? (getKnown() ? "simplified" : "maybe-simple")
                         : "not-simple";
   }


        


More information about the llvm-commits mailing list