summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2010-12-20 03:15:20 +0000
committerCameron Zwarich <zwarich@apple.com>2010-12-20 03:15:20 +0000
commit660bce67f31a1b45eaee55ce0cad440b61ac5b6b (patch)
tree24929b175c7a0074f17283409d0b63fe2729c1fc /llvm/lib/CodeGen/MachineVerifier.cpp
parentbc2461c5f9f01c4f1cbb12aac185f7bf1d9ad4be (diff)
downloadbcm5719-llvm-660bce67f31a1b45eaee55ce0cad440b61ac5b6b.tar.gz
bcm5719-llvm-660bce67f31a1b45eaee55ce0cad440b61ac5b6b.zip
Teach MachineVerifier that early clobber defs begin at USE slots and other defs
begin at DEF slots. Fixes the second half of PR8813. llvm-svn: 122225
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 248bbe1db6f..779fa9e33d9 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1005,11 +1005,6 @@ void MachineVerifier::verifyLiveIntervals() {
}
} else {
// Non-PHI def.
- if (!VNI->def.isDef()) {
- report("Non-PHI def must be at a DEF slot", MF);
- *OS << "Valno #" << VNI->id << " is defined at " << VNI->def
- << " in " << LI << '\n';
- }
const MachineInstr *MI = LiveInts->getInstructionFromIndex(VNI->def);
if (!MI) {
report("No instruction at def index", MF);
@@ -1019,6 +1014,32 @@ void MachineVerifier::verifyLiveIntervals() {
report("Defining instruction does not modify register", MI);
*OS << "Valno #" << VNI->id << " in " << LI << '\n';
}
+
+ bool isEarlyClobber = false;
+ if (MI) {
+ for (MachineInstr::const_mop_iterator MOI = MI->operands_begin(),
+ MOE = MI->operands_end(); MOI != MOE; ++MOI) {
+ if (MOI->isReg() && MOI->getReg() == LI.reg && MOI->isDef() &&
+ MOI->isEarlyClobber()) {
+ isEarlyClobber = true;
+ break;
+ }
+ }
+ }
+
+ // Early clobber defs begin at USE slots, but other defs must begin at
+ // DEF slots.
+ if (isEarlyClobber) {
+ if (!VNI->def.isUse()) {
+ report("Early clobber def must be at a USE slot", MF);
+ *OS << "Valno #" << VNI->id << " is defined at " << VNI->def
+ << " in " << LI << '\n';
+ }
+ } else if (!VNI->def.isDef()) {
+ report("Non-PHI, non-early clobber def must be at a DEF slot", MF);
+ *OS << "Valno #" << VNI->id << " is defined at " << VNI->def
+ << " in " << LI << '\n';
+ }
}
}
OpenPOWER on IntegriCloud