diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2021-08-15 17:46:20 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-08-16 18:28:18 +0200 |
| commit | 6a454edce908ab2ef204052c4ca5bad29fa9a30e (patch) | |
| tree | 3de24ff7b72474d8e6639a447a0c374144d9a786 /compiler/rustc_codegen_llvm/src | |
| parent | d20e798ad871b25ff5597c837e081fb6b635be57 (diff) | |
| download | rust-6a454edce908ab2ef204052c4ca5bad29fa9a30e.tar.gz rust-6a454edce908ab2ef204052c4ca5bad29fa9a30e.zip | |
Dispose LLVM context after TargetMachine
The TargetMachine may be referencing data in the context. In particular, at least the GlobalISel instruction selector stored in the TM may reference a TrackedMDNode DebugLoc that destruction of the TargetMachine will try to untrack.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index aa4db1622b2..1e6e5252b25 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -352,8 +352,8 @@ impl ModuleLlvm { impl Drop for ModuleLlvm { fn drop(&mut self) { unsafe { - llvm::LLVMContextDispose(&mut *(self.llcx as *mut _)); llvm::LLVMRustDisposeTargetMachine(&mut *(self.tm as *mut _)); + llvm::LLVMContextDispose(&mut *(self.llcx as *mut _)); } } } |
