[llvm] 945f6e6 - Wrap debug code with the LLVM_DEBUG macro; NFC

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 12:55:48 PDT 2023


Author: Aaron Ballman
Date: 2023-05-09T15:53:24-04:00
New Revision: 945f6e65be0d20b3446e7c1537c64151de618af4

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

LOG: Wrap debug code with the LLVM_DEBUG macro; NFC

While investigating a bug in Clang, I noticed that -Wframe-larger-than
was emitting extra debug information along with the diagnostic. It
turns out that 2e1e2f52f357768186ecfcc5ac53d5fa53d1b094 fixed an issue
with the diagnostic, but accidentally left in some debug code that was
exposed in all builds.

So now we no longer emit things like:
8/4294967304 (0.00%) spills, 4294967296/4294967304 (100.00%) variables
along with the diagnostic

Added: 
    

Modified: 
    llvm/lib/CodeGen/PrologEpilogInserter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index b696b7de7bcf..e68c30a0aff3 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -313,15 +313,16 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
         static_cast<float>(SpillSize) / static_cast<float>(StackSize);
     float VarPct = 1.0f - SpillPct;
     int64_t VariableSize = StackSize - SpillSize;
-    dbgs() << formatv("{0}/{1} ({3:P}) spills, {2}/{1} ({4:P}) variables",
-                      SpillSize, StackSize, VariableSize, SpillPct, VarPct);
+    LLVM_DEBUG(dbgs() << formatv(
+                   "{0}/{1} ({3:P}) spills, {2}/{1} ({4:P}) variables",
+                   SpillSize, StackSize, VariableSize, SpillPct, VarPct));
     if (UnsafeStackSize != 0) {
       float UnsafePct =
           static_cast<float>(UnsafeStackSize) / static_cast<float>(StackSize);
-      dbgs() << formatv(", {0}/{2} ({1:P}) unsafe stack", UnsafeStackSize,
-                        UnsafePct, StackSize);
+      LLVM_DEBUG(dbgs() << formatv(", {0}/{2} ({1:P}) unsafe stack",
+                                   UnsafeStackSize, UnsafePct, StackSize));
     }
-    dbgs() << "\n";
+    LLVM_DEBUG(dbgs() << "\n");
   }
 
   ORE->emit([&]() {


        


More information about the llvm-commits mailing list