This is an archive of the discontinued LLVM Phabricator instance.

[X86][ASM] Fixed assertion crash with inline asm (PR14393)
Needs ReviewPublic

Authored by kbelochapka on Jul 18 2017, 4:19 PM.

Details

Summary

Fixed assertion crash when inline assembler input parameter has floating point constraint but requires conversion from anything but floating point entity.

Diff Detail

Event Timeline

kbelochapka created this revision.Jul 18 2017, 4:19 PM
RKSimon added subscribers: llvm-commits, RKSimon.

Please don't forget to include llvm-commits as a subscriber otherwise your patch is likely to be missed

RKSimon edited edge metadata.Jul 31 2017, 6:24 AM

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.

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
286

(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);
}
465

ValueVT = PartVT?

469

newline

490–491

Add assertion message

598

ValueVT =PartVT?

test/CodeGen/X86/asm-inconsistent-operand-constraints-fpreg-integer.ll
17

drop this

19

Remove these and add to the command line as -mtriple=x86_64-unknown-linux-gnu

test/CodeGen/X86/asm-inconsistent-operand-constraints-fpreg-vector.ll
27

drop this

29

Remove these and add to the command line as -mtriple=x86_64-unknown-linux-gnu

limit showing error message only to the cases that require copy of non floating point datum into MVT::f80 container.

RKSimon added a reviewer: coby.Aug 8 2017, 3:33 AM

Simon, can you please take a second look at this one when you have a chance.

espindola edited reviewers, added: espindola; removed: rafael.Mar 15 2018, 9:28 AM