MIR Parser: Report an error when parsing large immediate operands.

llvm-svn: 244100
This commit is contained in:
Alex Lorenz 2015-08-05 19:03:42 +00:00
parent b6804dbf43
commit 3f2058da16
2 changed files with 21 additions and 2 deletions

View File

@ -552,8 +552,7 @@ bool MIParser::parseImmediateOperand(MachineOperand &Dest) {
assert(Token.is(MIToken::IntegerLiteral));
const APSInt &Int = Token.integerValue();
if (Int.getMinSignedBits() > 64)
// TODO: Replace this with an error when we can parse CIMM Machine Operands.
llvm_unreachable("Can't parse large integer literals yet!");
return error("integer literal is too large to be an immediate operand");
Dest = MachineOperand::CreateImm(Int.getExtValue());
lex();
return false;

View File

@ -0,0 +1,20 @@
# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
--- |
define i32 @foo() {
entry:
ret i32 42
}
...
---
name: foo
body:
- id: 0
name: entry
instructions:
# CHECK: [[@LINE+1]]:24: integer literal is too large to be an immediate operand
- '%eax = MOV32ri 12346127502983478823754212949184914'
- 'RETQ %eax'
...