[Mlir-commits] [mlir] [mlir][tosa] Use optnone for compliance initialization under MSan (NFC) (PR #223586)
Vitaly Buka
llvmlistbot at llvm.org
Mon Sep 14 19:46:52 PDT 2026
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/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
>From fcb9b75d8c5c1cdaf904df755c1755f8fe1ed0b6 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Tue, 15 Sep 2026 02:46:39 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
.../Dialect/Tosa/Transforms/TosaProfileCompliance.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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