[llvm] 7e0a52e - [NFC][MachineFunctionPass] Only lookup pass name if we request printing

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 21:40:12 PDT 2022


Author: Arthur Eubanks
Date: 2022-09-07T21:38:00-07:00
New Revision: 7e0a52e8e9ef6394bb62e0b56e17fa23e7262411

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

LOG: [NFC][MachineFunctionPass] Only lookup pass name if we request printing

Should report the small compile time regression reported in D133055.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineFunctionPass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index b8a58afb88ca3..3a1e1720be9c6 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -75,8 +75,10 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
   // serialized MF to be compared later.
   SmallString<0> BeforeStr, AfterStr;
   StringRef PassID;
-  if (const PassInfo *PI = Pass::lookupPassInfo(getPassID()))
-    PassID = PI->getPassArgument();
+  if (PrintChanged != ChangePrinter::None) {
+    if (const PassInfo *PI = Pass::lookupPassInfo(getPassID()))
+      PassID = PI->getPassArgument();
+  }
   const bool IsInterestingPass = isPassInPrintList(PassID);
   const bool ShouldPrintChanged = PrintChanged != ChangePrinter::None &&
                                   IsInterestingPass &&


        


More information about the llvm-commits mailing list