[PATCH] D111682: [TableGen][PGO] Disable profile instrumentation for printInstruction function

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 14 13:43:01 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21abe2128058: [TableGen][PGO] Disable profile instrumentation for printInstruction function (authored by xur).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111682/new/

https://reviews.llvm.org/D111682

Files:
  llvm/include/llvm/Support/Compiler.h
  llvm/utils/TableGen/AsmWriterEmitter.cpp


Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
===================================================================
--- llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -457,9 +457,14 @@
   StringRef ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
   bool PassSubtarget = AsmWriter->getValueAsInt("PassSubtarget");
 
+  // This function has some huge switch statements that causing excessive
+  // compile time in LLVM profile instrumenation build. This print function
+  // usually is not frequently called in compilation. Here we disable the
+  // profile instrumenation for this function.
   O << "/// printInstruction - This method is automatically generated by "
        "tablegen\n"
        "/// from the instruction set description.\n"
+       "LLVM_NO_PROFILE_INSTRUMENT_FUNCTION\n"
        "void "
     << Target.getName() << ClassName
     << "::printInstruction(const MCInst *MI, uint64_t Address, "
Index: llvm/include/llvm/Support/Compiler.h
===================================================================
--- llvm/include/llvm/Support/Compiler.h
+++ llvm/include/llvm/Support/Compiler.h
@@ -556,4 +556,13 @@
 #define LLVM_ENABLE_EXCEPTIONS 1
 #endif
 
+/// \macro LLVM_NO_PROFILE_INSTRUMENT_FUNCTION
+/// Disable the profile instrument for a function.
+#if __has_attribute(no_profile_instrument_function)
+#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION                                    \
+  __attribute__((no_profile_instrument_function))
+#else
+#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION
+#endif
+
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111682.379828.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211014/63ddeb6f/attachment.bin>


More information about the llvm-commits mailing list