[PATCH] D74161: Fix MSAN failure on Function destruction
Antonio Maiorano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 6 14:54:33 PST 2020
amaiorano updated this revision to Diff 243017.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74161/new/
https://reviews.llvm.org/D74161
Files:
llvm/lib/IR/Value.cpp
Index: llvm/lib/IR/Value.cpp
===================================================================
--- llvm/lib/IR/Value.cpp
+++ llvm/lib/IR/Value.cpp
@@ -83,13 +83,17 @@
// reference and something is wrong. This code is here to print out where
// the value is still being referenced.
//
- if (!use_empty()) {
+ // Note that use_empty() cannot be called here, as it eventually downcasts
+ // 'this' to GlobalValue (derived class of Value), but GlobalValue has already
+ // been destructed, so accessing it is UB.
+ //
+ if (!materialized_use_empty()) {
dbgs() << "While deleting: " << *VTy << " %" << getName() << "\n";
for (auto *U : users())
dbgs() << "Use still stuck around after Def is destroyed:" << *U << "\n";
}
#endif
- assert(use_empty() && "Uses remain when a value is destroyed!");
+ assert(materialized_use_empty() && "Uses remain when a value is destroyed!");
// If this value is named, destroy the name. This should not be in a symtab
// at this point.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74161.243017.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/71dac1bd/attachment.bin>
More information about the llvm-commits
mailing list