Fix crashing on invalid inline asm with matching constraints.
authorEric Christopher <echristo@gmail.com>
Wed, 31 Jul 2013 01:26:24 +0000 (01:26 +0000)
committerEric Christopher <echristo@gmail.com>
Wed, 31 Jul 2013 01:26:24 +0000 (01:26 +0000)
commite6656ac870cd76465a544d44489b27a552b24e5d
treeaa58321efc990b7211b75ad9fbd4829e0e1272c6
parentd6445686a9a723e02b0584dc00951e16512e7484
Fix crashing on invalid inline asm with matching constraints.

For a testcase like the following:

 typedef unsigned long uint64_t;

 typedef struct {
   uint64_t lo;
   uint64_t hi;
 } blob128_t;

 void add_128_to_128(const blob128_t *in, blob128_t *res) {
   asm ("PAND %1, %0" : "+Q"(*res) : "Q"(*in));
 }

where we'll fail to allocate the register for the output constraint,
our matching input constraint will not find a register to match,
and could try to search past the end of the current operands array.

On the idea that we'd like to attempt to keep compilation going
to find more errors in the module, change the error cases when
we're visiting inline asm IR to return immediately and avoid
trying to create a node in the DAG. This leaves us with only
a single error message per inline asm instruction, but allows us
to safely keep going in the general case.

llvm-svn: 187470
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp