In the case that we come across an error related to inline assembly, simply
terminate at that point.  There is no recovery path at this point.  In the best
case scenario, we will fail later on in assertions, and in the worst case, we
would lose the instruction in selection entirely.

Formulating a test for this is difficult as it relies on generating instructions
which may assert during lowering in SelDAG and other paths which don't which
seems rather fragile.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6838

Files:
  lib/CodeGen/CodeGenAction.cpp

Index: lib/CodeGen/CodeGenAction.cpp
===================================================================
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -519,8 +519,15 @@
   // Get the diagnostic ID based.
   switch (DI.getKind()) {
   case llvm::DK_InlineAsm:
-    if (InlineAsmDiagHandler(cast<DiagnosticInfoInlineAsm>(DI)))
-      return;
+    if (InlineAsmDiagHandler(cast<DiagnosticInfoInlineAsm>(DI))) {
+      if (Severity != llvm::DS_Error)
+        return;
+      // If there was an error with inline asm, the BB may actually be
+      // incomplete and may fail later in the best scenario, or simply miss the
+      // entire block of inline assembly in the worst case.  Terminate the
+      // process at this point, we can no longer recover.
+      exit(1);
+    }
     ComputeDiagID(Severity, inline_asm, DiagID);
     break;
   case llvm::DK_StackSize:

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/CodeGen/CodeGenAction.cpp
===================================================================
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -519,8 +519,15 @@
   // Get the diagnostic ID based.
   switch (DI.getKind()) {
   case llvm::DK_InlineAsm:
-    if (InlineAsmDiagHandler(cast<DiagnosticInfoInlineAsm>(DI)))
-      return;
+    if (InlineAsmDiagHandler(cast<DiagnosticInfoInlineAsm>(DI))) {
+      if (Severity != llvm::DS_Error)
+        return;
+      // If there was an error with inline asm, the BB may actually be
+      // incomplete and may fail later in the best scenario, or simply miss the
+      // entire block of inline assembly in the worst case.  Terminate the
+      // process at this point, we can no longer recover.
+      exit(1);
+    }
     ComputeDiagID(Severity, inline_asm, DiagID);
     break;
   case llvm::DK_StackSize:
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to