aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2022-04-19 16:26:17 -0700
committerVitaly Buka <vitalybuka@google.com>2022-04-19 16:42:05 -0700
commit33c5d8f9398a995177bdef86dbbfb9321ba5ef2a (patch)
treef22b9c4a08024755ec6d06cd8cbcfd44ec7cdfb4 /llvm/lib/CodeGen/MachineModuleInfo.cpp
parent0d0a99cb96183027af8212d0b8545356b65be0d3 (diff)
downloadllvm-33c5d8f9398a995177bdef86dbbfb9321ba5ef2a.zip
llvm-33c5d8f9398a995177bdef86dbbfb9321ba5ef2a.tar.gz
llvm-33c5d8f9398a995177bdef86dbbfb9321ba5ef2a.tar.bz2
[msan] Disable assert with msan
The assert uses data from just destroyed BasicBlock.
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 094d2f0..cbcef3e 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())