[llvm] 33c5d8f - [msan] Disable assert with msan

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 16:57:53 PDT 2022


Author: Vitaly Buka
Date: 2022-04-19T16:42:05-07:00
New Revision: 33c5d8f9398a995177bdef86dbbfb9321ba5ef2a

URL: https://github.com/llvm/llvm-project/commit/33c5d8f9398a995177bdef86dbbfb9321ba5ef2a
DIFF: https://github.com/llvm/llvm-project/commit/33c5d8f9398a995177bdef86dbbfb9321ba5ef2a.diff

LOG: [msan] Disable assert with msan

The assert uses data from just destroyed BasicBlock.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineModuleInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 094d2f032569c..cbcef3eeda301 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -24,6 +24,7 @@
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetMachine.h"
@@ -145,8 +146,11 @@ void MMIAddrLabelMap::UpdateForDeletedBlock(BasicBlock *BB) {
   assert(!Entry.Symbols.empty() && "Didn't have a symbol, why a callback?");
   BBCallbacks[Entry.Index] = nullptr;  // Clear the callback.
 
+#if !LLVM_MEMORY_SANITIZER_BUILD
+  // BasicBlock is destroyed already, so this access is UB detectable by msan.
   assert((BB->getParent() == nullptr || BB->getParent() == Entry.Fn) &&
          "Block/parent mismatch");
+#endif
 
   for (MCSymbol *Sym : Entry.Symbols) {
     if (Sym->isDefined())


        


More information about the llvm-commits mailing list