[llvm] r250885 - Let MachineVerifier be aware of mem-to-mem instructions.
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 00:39:49 PDT 2015
Author: jonpa
Date: Wed Oct 21 02:39:47 2015
New Revision: 250885
URL: http://llvm.org/viewvc/llvm-project?rev=250885&view=rev
Log:
Let MachineVerifier be aware of mem-to-mem instructions.
A mem-to-mem instruction (that both loads and stores), which store to an
FI, cannot pass the verifier since it thinks it is loading from the FI.
For the mem-to-mem instruction, do a looser check in visitMachineOperand()
and only check liveness at the reg-slot while analyzing a frame index operand.
Needed to make CodeGen/SystemZ/xor-01.ll pass with -verify-machineinstrs,
which now runs with this flag.
Reviewed by Evan Cheng and Quentin Colombet.
Modified:
llvm/trunk/lib/CodeGen/MachineVerifier.cpp
llvm/trunk/test/CodeGen/SystemZ/xor-01.ll
Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=250885&r1=250884&r2=250885&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Wed Oct 21 02:39:47 2015
@@ -994,11 +994,17 @@ MachineVerifier::visitMachineOperand(con
LiveInts && !LiveInts->isNotInMIMap(MI)) {
LiveInterval &LI = LiveStks->getInterval(MO->getIndex());
SlotIndex Idx = LiveInts->getInstructionIndex(MI);
- if (MI->mayLoad() && !LI.liveAt(Idx.getRegSlot(true))) {
+
+ // For a memory-to-memory move, we don't know if MI is using
+ // this frame index for loading or storing, so check for
+ // liveness at reg-slot only in the simple load case.
+ bool stores = MI->mayStore();
+ bool simpleLoad = (MI->mayLoad() && !stores);
+ if (simpleLoad && !LI.liveAt(Idx.getRegSlot(true))) {
report("Instruction loads from dead spill slot", MO, MONum);
errs() << "Live stack: " << LI << '\n';
}
- if (MI->mayStore() && !LI.liveAt(Idx.getRegSlot())) {
+ if (stores && !LI.liveAt(Idx.getRegSlot())) {
report("Instruction stores to dead spill slot", MO, MONum);
errs() << "Live stack: " << LI << '\n';
}
Modified: llvm/trunk/test/CodeGen/SystemZ/xor-01.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/xor-01.ll?rev=250885&r1=250884&r2=250885&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/xor-01.ll (original)
+++ llvm/trunk/test/CodeGen/SystemZ/xor-01.ll Wed Oct 21 02:39:47 2015
@@ -1,6 +1,6 @@
; Test 32-bit XORs in which the second operand is variable.
;
-; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
+; RUN: llc < %s -verify-machineinstrs -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
declare i32 @foo()
More information about the llvm-commits
mailing list