diff options
-rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.cpp | 10 | ||||
-rw-r--r-- | llvm/test/CodeGen/Mips/constraint-empty.ll | 14 |
2 files changed, 20 insertions, 4 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 906c9a9555f..eb460ca3797 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -4008,11 +4008,13 @@ MipsTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, } } - std::pair<unsigned, const TargetRegisterClass *> R; - R = parseRegForInlineAsmConstraint(Constraint, VT); + if (!Constraint.empty()) { + std::pair<unsigned, const TargetRegisterClass *> R; + R = parseRegForInlineAsmConstraint(Constraint, VT); - if (R.second) - return R; + if (R.second) + return R; + } return TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT); } diff --git a/llvm/test/CodeGen/Mips/constraint-empty.ll b/llvm/test/CodeGen/Mips/constraint-empty.ll new file mode 100644 index 00000000000..65b5d436457 --- /dev/null +++ b/llvm/test/CodeGen/Mips/constraint-empty.ll @@ -0,0 +1,14 @@ +; Check that `getRegForInlineAsmConstraint` does not crash on empty Constraint. +; RUN: llc -march=mips64 < %s | FileCheck %s + +define void @foo() { +entry: + %s = alloca i32, align 4 + %x = alloca i32, align 4 + call void asm "", "=*imr,=*m,0,*m,~{$1}"(i32* %x, i32* %s, i32* %x, i32* %s) + +; CHECK: #APP +; CHECK: #NO_APP + + ret void +} |