[PATCH] D18104: [Bugpoint] Fix two crashes in miscompilation debugger

Tobias Edler von Koch via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 15:01:48 PST 2016


tobiasvk created this revision.
tobiasvk added a reviewer: rafael.
tobiasvk added a subscriber: llvm-commits.

A while back, a bunch of module pointers were changed to unique_ptrs but the
places where they were used weren't updated correctly. This patch fixes two
crashes I've come across. There may be more.

It's a bit sad that we have no tests for this code path in bugpoint and that
nobody seems to have noticed these until now.

http://reviews.llvm.org/D18104

Files:
  tools/bugpoint/Miscompilation.cpp

Index: tools/bugpoint/Miscompilation.cpp
===================================================================
--- tools/bugpoint/Miscompilation.cpp
+++ tools/bugpoint/Miscompilation.cpp
@@ -327,8 +327,8 @@
     AbstractInterpreter *AI = BD.switchToSafeInterpreter();
     bool Failure;
     std::unique_ptr<Module> New =
-        testMergedProgram(BD, std::move(ToOptimizeLoopExtracted),
-                          std::move(ToNotOptimize), Error, Failure);
+        testMergedProgram(BD, CloneModule(ToOptimizeLoopExtracted.get()),
+                          CloneModule(ToNotOptimize.get()), Error, Failure);
     if (!New)
       return false;
 
@@ -760,7 +760,7 @@
                                      std::unique_ptr<Module> &Test,
                                      Module *Safe) {
   // Clean up the modules, removing extra cruft that we don't need anymore...
-  Test = BD.performFinalCleanups(Test.get());
+  Test = BD.performFinalCleanups(Test.release());
 
   // If we are executing the JIT, we have several nasty issues to take care of.
   if (!BD.isExecutingJIT()) return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18104.50485.patch
Type: text/x-patch
Size: 1088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160311/6e8ab049/attachment.bin>


More information about the llvm-commits mailing list