[PATCH] D33140: LTO: Don't verify modules twice in verifyMergedModuleOnce

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 10:29:20 PDT 2017


aprantl created this revision.
Herald added subscribers: inglorion, mehdi_amini.

There's a logic bug that causes the function to run the verifier twice if LTOStripInvalidDebugInfo is true.


Repository:
  rL LLVM

https://reviews.llvm.org/D33140

Files:
  lib/LTO/LTOCodeGenerator.cpp


Index: lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- lib/LTO/LTOCodeGenerator.cpp
+++ lib/LTO/LTOCodeGenerator.cpp
@@ -495,17 +495,14 @@
     return;
   HasVerifiedInput = true;
 
-  if (LTOStripInvalidDebugInfo) {
-    bool BrokenDebugInfo = false;
-    if (verifyModule(*MergedModule, &dbgs(), &BrokenDebugInfo))
-      report_fatal_error("Broken module found, compilation aborted!");
-    if (BrokenDebugInfo) {
-      emitWarning("Invalid debug info found, debug info will be stripped");
-      StripDebugInfo(*MergedModule);
-    }
-  }
-  if (verifyModule(*MergedModule, &dbgs()))
+  bool BrokenDebugInfo = false;
+  if (verifyModule(*MergedModule, &dbgs(),
+                   LTOStripInvalidDebugInfo ? &BrokenDebugInfo : nullptr))
     report_fatal_error("Broken module found, compilation aborted!");
+  if (BrokenDebugInfo) {
+    emitWarning("Invalid debug info found, debug info will be stripped");
+    StripDebugInfo(*MergedModule);
+  }
 }
 
 void LTOCodeGenerator::finishOptimizationRemarks() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33140.98797.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170512/a2636a53/attachment.bin>


More information about the llvm-commits mailing list