[llvm-commits] [llvm] r40688 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp
Evan Cheng
evan.cheng at apple.com
Wed Aug 1 13:18:22 PDT 2007
Author: evancheng
Date: Wed Aug 1 15:18:21 2007
New Revision: 40688
URL: http://llvm.org/viewvc/llvm-project?rev=40688&view=rev
Log:
Bugs: missing partial uses and redundant partial defs.
Modified:
llvm/trunk/lib/CodeGen/LiveVariables.cpp
Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=40688&r1=40687&r2=40688&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Aug 1 15:18:21 2007
@@ -281,10 +281,24 @@
PhysRegUsed[SubReg] = true;
}
- // Remember the partial uses.
for (const unsigned *SuperRegs = RegInfo->getSuperRegisters(Reg);
- unsigned SuperReg = *SuperRegs; ++SuperRegs)
- PhysRegPartUse[SuperReg] = MI;
+ unsigned SuperReg = *SuperRegs; ++SuperRegs) {
+ // Remember the partial use of this superreg if it was previously defined.
+ bool HasPrevDef = PhysRegInfo[SuperReg] != NULL;
+ if (!HasPrevDef) {
+ for (const unsigned *SSRegs = RegInfo->getSuperRegisters(SuperReg);
+ unsigned SSReg = *SSRegs; ++SSRegs) {
+ if (PhysRegInfo[SSReg] != NULL) {
+ HasPrevDef = true;
+ break;
+ }
+ }
+ }
+ if (HasPrevDef) {
+ PhysRegInfo[SuperReg] = MI;
+ PhysRegPartUse[SuperReg] = MI;
+ }
+ }
}
bool LiveVariables::HandlePhysRegKill(unsigned Reg, MachineInstr *RefMI,
@@ -342,7 +356,7 @@
addRegisterKilled(Reg, PhysRegPartUse[Reg], true);
}
} else if (PhysRegPartUse[Reg])
- // Add implicit use / kill to last use of a sub-register.
+ // Add implicit use / kill to last partial use.
addRegisterKilled(Reg, PhysRegPartUse[Reg], true);
else
addRegisterDead(Reg, LastRef);
@@ -385,11 +399,13 @@
PhysRegInfo[Reg] = MI;
PhysRegUsed[Reg] = false;
+ PhysRegPartDef[Reg].clear();
PhysRegPartUse[Reg] = NULL;
for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
unsigned SubReg = *SubRegs; ++SubRegs) {
PhysRegInfo[SubReg] = MI;
PhysRegUsed[SubReg] = false;
+ PhysRegPartDef[SubReg].clear();
PhysRegPartUse[SubReg] = NULL;
}
}
More information about the llvm-commits
mailing list