[llvm] r243128 - MIR Parser: Run the machine verifier after initializing machine functions.
Alex Lorenz
arphaman at gmail.com
Fri Jul 24 10:44:50 PDT 2015
Author: arphaman
Date: Fri Jul 24 12:44:49 2015
New Revision: 243128
URL: http://llvm.org/viewvc/llvm-project?rev=243128&view=rev
Log:
MIR Parser: Run the machine verifier after initializing machine functions.
Added:
llvm/trunk/test/CodeGen/MIR/X86/machine-verifier.mir
Modified:
llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/trunk/test/CodeGen/MIR/X86/machine-instructions.mir
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp?rev=243128&r1=243127&r2=243128&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp Fri Jul 24 12:44:49 2015
@@ -325,6 +325,10 @@ bool MIRParserImpl::initializeMachineFun
PFS))
return true;
}
+ // FIXME: This is a temporary workaround until the reserved registers can be
+ // serialized.
+ MF.getRegInfo().freezeReservedRegs(MF);
+ MF.verify();
return false;
}
Modified: llvm/trunk/test/CodeGen/MIR/X86/machine-instructions.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/machine-instructions.mir?rev=243128&r1=243127&r2=243128&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/machine-instructions.mir (original)
+++ llvm/trunk/test/CodeGen/MIR/X86/machine-instructions.mir Fri Jul 24 12:44:49 2015
@@ -18,8 +18,8 @@ body:
- id: 0
name: entry
instructions:
- # CHECK: - MOV32rr
- # CHECK-NEXT: - RETQ
- - MOV32rr
- - ' RETQ '
+ # CHECK: MOV32rr
+ # CHECK-NEXT: RETQ
+ - '%eax = MOV32rr %eax'
+ - ' RETQ %eax'
...
Added: llvm/trunk/test/CodeGen/MIR/X86/machine-verifier.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/machine-verifier.mir?rev=243128&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/machine-verifier.mir (added)
+++ llvm/trunk/test/CodeGen/MIR/X86/machine-verifier.mir Fri Jul 24 12:44:49 2015
@@ -0,0 +1,23 @@
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
+# This test ensures that the MIR parser runs the machine verifier after parsing.
+
+--- |
+
+ define i32 @inc(i32 %a) {
+ entry:
+ ret i32 %a
+ }
+
+...
+---
+name: inc
+body:
+ - id: 0
+ name: entry
+ liveins: [ '%edi' ]
+ instructions:
+ # CHECK: *** Bad machine code: Too few operands ***
+ # CHECK: instruction: COPY2 operands expected, but 0 given.
+ - 'COPY'
+ - 'RETQ'
+...
More information about the llvm-commits
mailing list