forked from OSchip/llvm-project
[X86] Don't crash on bad operand modifiers in inline assembly
Summary: Previously if a modifer was placed on a non-GPR register class we would hit an assert or crash. Reviewers: echristo Reviewed By: echristo Subscribers: eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D45751 llvm-svn: 330238
This commit is contained in:
parent
aea15131db
commit
8704612481
|
@ -372,6 +372,12 @@ static bool printAsmMRegister(X86AsmPrinter &P, const MachineOperand &MO,
|
|||
unsigned Reg = MO.getReg();
|
||||
bool EmitPercent = true;
|
||||
|
||||
if (!X86::GR8RegClass.contains(Reg) &&
|
||||
!X86::GR16RegClass.contains(Reg) &&
|
||||
!X86::GR32RegClass.contains(Reg) &&
|
||||
!X86::GR64RegClass.contains(Reg))
|
||||
return true;
|
||||
|
||||
switch (Mode) {
|
||||
default: return true; // Unknown mode.
|
||||
case 'b': // Print QImode register
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
; RUN: not llc -mtriple=x86_64-- < %s 2>&1 | FileCheck %s
|
||||
|
||||
;CHECK: error: invalid operand in inline asm: 'vmovd ${1:x}, $0'
|
||||
define i32 @foo() {
|
||||
entry:
|
||||
%0 = tail call i32 asm sideeffect "vmovd ${1:x}, $0", "=r,x,~{dirflag},~{fpsr},~{flags}"(<2 x i64> <i64 240518168632, i64 240518168632>)
|
||||
ret i32 %0
|
||||
}
|
Loading…
Reference in New Issue