diff options
author | Charles Saternos <charles.saternos@gmail.com> | 2017-08-15 22:23:44 +0000 |
---|---|---|
committer | Charles Saternos <charles.saternos@gmail.com> | 2017-08-15 22:23:44 +0000 |
commit | 55d93e79df71de02dd9cc057a205038476b29856 (patch) | |
tree | c23cb9ac52b9bce91a156559d4521e3f222b574f /llvm/tools/llvm-dis/llvm-dis.cpp | |
parent | 255387650a8222a04273feffc74f8870a5548113 (diff) | |
download | bcm5719-llvm-55d93e79df71de02dd9cc057a205038476b29856.tar.gz bcm5719-llvm-55d93e79df71de02dd9cc057a205038476b29856.zip |
[ThinLTO] Fix ThinLTO crash while destroying context
Fix for PR32763
An assert that checks if a Ref was untracked fails during ThinLTO context cleanup. The issue is because lazy loading temporary nodes didn't properly track ValueAsMetadata nodes. This patch ensures that the temporary nodes are properly tracked when they're replaced with the value.
llvm-svn: 310967
Diffstat (limited to 'llvm/tools/llvm-dis/llvm-dis.cpp')
-rw-r--r-- | llvm/tools/llvm-dis/llvm-dis.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp index 0c1d723a7b1..82dbaa5e3c6 100644 --- a/llvm/tools/llvm-dis/llvm-dis.cpp +++ b/llvm/tools/llvm-dis/llvm-dis.cpp @@ -51,8 +51,13 @@ static cl::opt<bool> DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden); static cl::opt<bool> -ShowAnnotations("show-annotations", - cl::desc("Add informational comments to the .ll file")); + SetImporting("set-importing", + cl::desc("Set lazy loading to pretend to import a module"), + cl::Hidden); + +static cl::opt<bool> + ShowAnnotations("show-annotations", + cl::desc("Add informational comments to the .ll file")); static cl::opt<bool> PreserveAssemblyUseListOrder( "preserve-ll-uselistorder", @@ -142,9 +147,9 @@ static ExitOnError ExitOnErr; static std::unique_ptr<Module> openInputFile(LLVMContext &Context) { std::unique_ptr<MemoryBuffer> MB = ExitOnErr(errorOrToExpected(MemoryBuffer::getFileOrSTDIN(InputFilename))); - std::unique_ptr<Module> M = - ExitOnErr(getOwningLazyBitcodeModule(std::move(MB), Context, - /*ShouldLazyLoadMetadata=*/true)); + std::unique_ptr<Module> M = ExitOnErr(getOwningLazyBitcodeModule( + std::move(MB), Context, + /*ShouldLazyLoadMetadata=*/true, SetImporting)); if (MaterializeMetadata) ExitOnErr(M->materializeMetadata()); else |