[llvm-commits] [llvm] r110240 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Dan Gohman gohman at apple.com
Wed Aug 4 11:51:09 PDT 2010


Author: djg
Date: Wed Aug  4 13:51:09 2010
New Revision: 110240

URL: http://llvm.org/viewvc/llvm-project?rev=110240&view=rev
Log:
Change this llvm_unreachable to report_fatal_error, since it can
be triggered by valid, if dubious, IR.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=110240&r1=110239&r2=110240&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug  4 13:51:09 2010
@@ -1268,10 +1268,17 @@
           ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
       if (C != CE)
         return LowerConstant(C, AP);
-#ifndef NDEBUG
-    CE->dump();
-#endif
-    llvm_unreachable("FIXME: Don't support this constant expr");
+
+    // Otherwise report the problem to the user.
+    {
+      std::string S;
+      raw_string_ostream OS(S);
+      OS << "Unsupported expression in static initializer: ";
+      WriteAsOperand(OS, CE, /*PrintType=*/false,
+                     !AP.MF ? 0 : AP.MF->getFunction()->getParent());
+      report_fatal_error(OS.str());
+    }
+    return MCConstantExpr::Create(0, Ctx);
   case Instruction::GetElementPtr: {
     const TargetData &TD = *AP.TM.getTargetData();
     // Generate a symbolic expression for the byte address





More information about the llvm-commits mailing list