[llvm] 0f37afc - Destroy ValueNames after all unique_ptr<Value>
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 21:22:25 PDT 2022
Author: Vitaly Buka
Date: 2022-03-31T21:22:07-07:00
New Revision: 0f37afc60f0200adc09328b82372e2c7df8810cd
URL: https://github.com/llvm/llvm-project/commit/0f37afc60f0200adc09328b82372e2c7df8810cd
DIFF: https://github.com/llvm/llvm-project/commit/0f37afc60f0200adc09328b82372e2c7df8810cd.diff
LOG: Destroy ValueNames after all unique_ptr<Value>
This UB detected by -fsanitize-memory-use-after-dtor in tensorflow/MLIR.
Added:
Modified:
llvm/lib/IR/LLVMContextImpl.h
Removed:
################################################################################
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index b87d2853ad76f..50fca3a40addb 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1386,6 +1386,8 @@ class LLVMContextImpl {
LLVMContext::YieldCallbackTy YieldCallback = nullptr;
void *YieldOpaqueHandle = nullptr;
+ DenseMap<const Value *, ValueName *> ValueNames;
+
using IntMapTy =
DenseMap<APInt, std::unique_ptr<ConstantInt>, DenseMapAPIntKeyInfo>;
IntMapTy IntConstants;
@@ -1402,8 +1404,6 @@ class LLVMContextImpl {
DenseMap<Value *, ValueAsMetadata *> ValuesAsMetadata;
DenseMap<Metadata *, MetadataAsValue *> MetadataAsValues;
- DenseMap<const Value *, ValueName *> ValueNames;
-
#define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \
DenseSet<CLASS *, CLASS##Info> CLASS##s;
#include "llvm/IR/Metadata.def"
More information about the llvm-commits
mailing list