[llvm] r266216 - Sanity check `opt` options compatibility: can't have module-summary or module-hash when emitting textual IR

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 10:20:11 PDT 2016


Author: mehdi_amini
Date: Wed Apr 13 12:20:10 2016
New Revision: 266216

URL: http://llvm.org/viewvc/llvm-project?rev=266216&view=rev
Log:
Sanity check `opt` options compatibility: can't have module-summary or module-hash when emitting textual IR

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/tools/opt/opt.cpp

Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=266216&r1=266215&r2=266216&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Wed Apr 13 12:20:10 2016
@@ -620,9 +620,13 @@ int main(int argc, char **argv) {
       BOS = make_unique<raw_svector_ostream>(Buffer);
       OS = BOS.get();
     }
-    if (OutputAssembly)
+    if (OutputAssembly) {
+      if (EmitSummaryIndex)
+        report_fatal_error("Text output is incompatible with -module-summary");
+      if (EmitModuleHash)
+        report_fatal_error("Text output is incompatible with -module-hash");
       Passes.add(createPrintModulePass(*OS, "", PreserveAssemblyUseListOrder));
-    else
+    } else
       Passes.add(createBitcodeWriterPass(*OS, PreserveBitcodeUseListOrder,
                                          EmitSummaryIndex, EmitModuleHash));
   }




More information about the llvm-commits mailing list