[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 11:04:52 PDT 2021


xur added inline comments.


================
Comment at: llvm/include/llvm/Support/Compiler.h:560
+/// Disable the profile instrument for a function.
+#if __has_attribute(no_profile_instrument_function) && defined(__GNUC__)
+#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION                                    \
----------------
rnk wrote:
> Is the `&& defined(__GNUC__)` necessary? There are two ways to get clang to not define `__GNUC__`: target MSVC (clang-cl) or pass `-fgnuc-version=0`. In both cases, we would probably want to disable PGO instrumentation for printInstruction. I think `__has_attribute` is sufficient.
I add "&& defined(__GNUC__) to exclude MSVC target, because I thought __has_attribute(no_profile_instrument_function) return true for MSVC also. 
In that case, I need  to use GNUC. (As like you noticed,  __attribute__ is not available in MSVC)

Are you saying __has_attribute(no_profile_instrument_function) return false for MSVC?

I don't know the macro to disable instrumentation in MSVC? I cannot find in MSVC documents. 




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

https://reviews.llvm.org/D111682



More information about the llvm-commits mailing list