[llvm] [Darwin][MTE] bugfix: Only instrument stack history buffer if there are instrumented allocas in the function (PR #178770)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 29 14:55:43 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Usama Hameed (usama54321)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/178770.diff


1 Files Affected:

- (modified) llvm/lib/Target/AArch64/AArch64StackTagging.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 215f33672b79e..4ae73d73b2a86 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -456,7 +456,7 @@ static Value *getSlotPtr(IRBuilder<> &IRB, const Triple &TargetTriple,
         !TargetTriple.isAndroidVersionLT(35) && HasInstrumentedAllocas)
       return memtag::getAndroidSlotPtr(IRB, -3);
     if (TargetTriple.isOSDarwin() && TargetTriple.isAArch64() &&
-        !TargetTriple.isSimulatorEnvironment())
+        !TargetTriple.isSimulatorEnvironment() && HasInstrumentedAllocas)
       return memtag::getDarwinSlotPtr(IRB, 231);
   }
   return nullptr;

``````````

</details>


https://github.com/llvm/llvm-project/pull/178770


More information about the llvm-commits mailing list