From 11ad4e057e8620be0b67c9c4710ac768cae2dd10 Mon Sep 17 00:00:00 2001 From: "Meszaros, Gergely" Date: Mon, 22 Sep 2025 12:58:59 +0000 Subject: [PATCH] [ESIMD] Don't always dump entry points if LLVM_ENABLE_DUMP=ON Starting from https://github.com/intel/llvm/pull/18684 in debug/release with asserts builds entry points are always dumped in ESIMDPostSplitProcessing. This is meant to be a debugging tool, but now it is spamming build logs. https://github.com/intel/llvm/pull/18684 is marked as NFC, so my assumption is that this was unintentional. Guard the dump with a variable (disabled by default) so that it can be enabled for debugging, the same way as it was in sycl-post-link.cpp prior to the code move. FYI: `LLVM_ENABLE_DUMP` is an option documented to > Enable dump functions even when assertions are disabled (from [llvm/CMakeLists.txt:698](https://github.com/llvm/llvm-project/blob/32b1f167fbee28debc7527b939a6764575c854a4/llvm/CMakeLists.txt#L698)) and its typical usage is to guard the definitions of dump functions, e.g.: ```cpp class Foo { // ... void dump() const; } ``` and not to guard **calls** to such functions. --- .../SYCLPostLink/ESIMDPostSplitProcessing.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/llvm/lib/SYCLPostLink/ESIMDPostSplitProcessing.cpp b/llvm/lib/SYCLPostLink/ESIMDPostSplitProcessing.cpp index c2394129cc9d4..10b1c66bbe044 100644 --- a/llvm/lib/SYCLPostLink/ESIMDPostSplitProcessing.cpp +++ b/llvm/lib/SYCLPostLink/ESIMDPostSplitProcessing.cpp @@ -27,6 +27,17 @@ #include #include +#ifdef NDEBUG +#define DUMP_ENTRY_POINTS(...) +#else +constexpr int DebugESIMDPostSplit = 0; + +#define DUMP_ENTRY_POINTS(...) \ + if (DebugESIMDPostSplit > 0) { \ + llvm::module_split::dumpEntryPoints(__VA_ARGS__); \ + } +#endif // NDEBUG + using namespace llvm; using namespace llvm::module_split; @@ -124,9 +135,7 @@ llvm::sycl::handleESIMD(ModuleDesc MDesc, SplitOccurred |= Result.size() > 1; for (ModuleDesc &MD : Result) { -#ifdef LLVM_ENABLE_DUMP - dumpEntryPoints(MD.entries(), MD.Name.c_str(), 4); -#endif // LLVM_ENABLE_DUMP + DUMP_ENTRY_POINTS(MD.entries(), MD.Name.c_str(), 4); if (Options.LowerESIMD && MD.isESIMD()) Modified |= lowerESIMDConstructs(MD, Options); } @@ -155,9 +164,7 @@ llvm::sycl::handleESIMD(ModuleDesc MDesc, Linked.rebuildEntryPoints(Names); Result.clear(); Result.emplace_back(std::move(Linked)); -#ifdef LLVM_ENABLE_DUMP - dumpEntryPoints(Result.back().entries(), Result.back().Name.c_str(), 4); -#endif // LLVM_ENABLE_DUMP + DUMP_ENTRY_POINTS(Result.back().entries(), Result.back().Name.c_str(), 4); Modified = true; return std::move(Result);