[Mlir-commits] [mlir] b557f07 - [mlir][tosa] Use optnone for compliance initialization under MSan (NFC) (#223586)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 14 20:51:47 PDT 2026
Author: Vitaly Buka
Date: 2026-09-14T20:51:42-07:00
New Revision: b557f073f1ea9fab14102cfc93edb40285599670
URL: https://github.com/llvm/llvm-project/commit/b557f073f1ea9fab14102cfc93edb40285599670
DIFF: https://github.com/llvm/llvm-project/commit/b557f073f1ea9fab14102cfc93edb40285599670.diff
LOG: [mlir][tosa] Use optnone for compliance initialization under MSan (NFC) (#223586)
The compliance-map constructor includes a ~5,000-line generated
initializer.
Under MemorySanitizer, shadow and origin tracking instrumentation on
this single mega-function causes extreme compilation times (>3.5
minutes),
dominated by InstCombine (~68s) and greedy register allocation (~71s).
Recently, LLVM_ATTRIBUTE_MINSIZE was added to optimize for size, but
MSan
instrumentation still inflates the function enough to trigger severe
slowdowns in the backend.
Mark the constructor with optnone under LLVM_MEMORY_SANITIZER_BUILD to
skip
expensive optimization and register allocation passes, bringing
compilation
time under MSan down from 3m38s to ~30s.
This is done to fix
http://lab.llvm.org/buildbot/#/builders/aarch64-linux-msan,
though it is very slow on x86_64 as well.
Assisted-by: Gemini
Added:
Modified:
mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
index 81b9ed7b8cd90..3c81be49cbd9a 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
@@ -14,7 +14,16 @@
using namespace mlir;
using namespace mlir::tosa;
-LLVM_ATTRIBUTE_MINSIZE TosaProfileCompliance::TosaProfileCompliance() {
+// Building this ~5,000-line generated initializer map under MemorySanitizer
+// leads to extreme compile times (>3.5 minutes) during InstCombine and greedy
+// register allocation due to shadow/origin instrumentation overhead. Disable
+// optimization under MSan to keep build times manageable.
+#if LLVM_MEMORY_SANITIZER_BUILD
+__attribute__((optnone))
+#else
+LLVM_ATTRIBUTE_MINSIZE
+#endif
+TosaProfileCompliance::TosaProfileCompliance() {
const TypeInfo boolT = {mlir::IntegerType::getTypeID(), 1};
const TypeInfo i4T = {mlir::IntegerType::getTypeID(), 4};
const TypeInfo i8T = {mlir::IntegerType::getTypeID(), 8};
More information about the Mlir-commits
mailing list