[PATCH] D35587: [X86][ASM] Fixed assertion crash with inline asm (PR14393)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 06:27:41 PDT 2017


RKSimon added a comment.

The test files need to be simplified as much as possible - many of the attributes (e.g. all the debug srcloc) and meta data can be dropped and the remaining moved into the command line.



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:265
+    return Ctx.emitError(I, ErrMsg);
+  }
+  return Ctx.emitError(ErrMsg);
----------------
(style) You should be able remove most braces, also cast/dyn_cast calls can use auto:
```
  if (auto *I = dyn_cast_or_null<Instruction>(V)) {
    if (auto *CI = dyn_cast<CallInst>(I))
      if (isa<InlineAsm>(CI->getCalledValue()))
        return Ctx.emitError(CI, ErrMsg + ", in an __asm__");
    return Ctx.emitError(I, ErrMsg);
  }
```


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:446
+                                 "Inconsistent operand constraints");
+      ValueVT = Val.getValueType();
+    }
----------------
ValueVT = PartVT?


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:449
+  }
   if (NumParts * PartBits > ValueVT.getSizeInBits()) {
     // If the parts cover more bits than the value has, promote the value.
----------------
newline


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:471
     // Different types of the same size.
-    assert(NumParts == 1 && PartEVT != ValueVT);
+    assert(NumParts == 1);
     Val = DAG.getNode(ISD::BITCAST, DL, PartVT, Val);
----------------
Add assertion message


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:568
+                                 "Inconsistent operand constraints");
+      ValueVT = Val.getValueType();
+    }
----------------
ValueVT =PartVT?


================
Comment at: test/CodeGen/X86/asm-inconsistent-operand-constraints-fpreg-integer.ll:16
+; ModuleID = 'asm-inconsistent-operand-constraints-fpreg-integer.c'
+source_filename = "asm-inconsistent-operand-constraints-fpreg-integer.c"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
----------------
drop this


================
Comment at: test/CodeGen/X86/asm-inconsistent-operand-constraints-fpreg-integer.ll:18
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
----------------
Remove these and add to the command line as -mtriple=x86_64-unknown-linux-gnu


================
Comment at: test/CodeGen/X86/asm-inconsistent-operand-constraints-fpreg-vector.ll:26
+; ModuleID = 'asm-inconsistent-operand-constraints-fpreg-vector.c'
+source_filename = "asm-inconsistent-operand-constraints-fpreg-vector.c"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
----------------
drop this


================
Comment at: test/CodeGen/X86/asm-inconsistent-operand-constraints-fpreg-vector.ll:28
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
----------------
Remove these and add to the command line as -mtriple=x86_64-unknown-linux-gnu


https://reviews.llvm.org/D35587





More information about the llvm-commits mailing list