From 32c6e162462bbca3beb2259b90cc922a7419ba2c Mon Sep 17 00:00:00 2001 From: Antonio Frighetto Date: Wed, 24 Sep 2025 15:59:32 +0200 Subject: [IR] Introduce `llvm.errno.tbaa` metadata for errno alias disambiguation Add a new named module-level frontend-annotated metadata that specifies the TBAA node for an integer access, for which, C/C++ `errno` accesses are guaranteed to use (under strict aliasing). This should allow LLVM to prove the involved memory location/ accesses may not alias `errno`; thus, to perform optimizations around errno-writing libcalls (store-to-load forwarding amongst others). Previous discussion: https://discourse.llvm.org/t/rfc-modelling-errno-memory-effects/82972. --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 22a0d0f..832aa9f 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -7024,7 +7024,7 @@ Error BitcodeReader::materialize(GlobalValue *GV) { if (!MDLoader->isStrippingTBAA()) { for (auto &I : instructions(F)) { MDNode *TBAA = I.getMetadata(LLVMContext::MD_tbaa); - if (!TBAA || TBAAVerifyHelper.visitTBAAMetadata(I, TBAA)) + if (!TBAA || TBAAVerifyHelper.visitTBAAMetadata(&I, TBAA)) continue; MDLoader->setStripTBAA(true); stripTBAA(F->getParent()); -- cgit v1.1