[llvm-branch-commits] [llvm-branch] r92865 - in /llvm/branches/Apple/Zoidberg/lib/CodeGen: CriticalAntiDepBreaker.cpp CriticalAntiDepBreaker.h
Jim Grosbach
grosbach at apple.com
Wed Jan 6 14:22:49 PST 2010
Author: grosbach
Date: Wed Jan 6 16:22:49 2010
New Revision: 92865
URL: http://llvm.org/viewvc/llvm-project?rev=92865&view=rev
Log:
merge 92864
Modified:
llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.cpp
llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.h
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.cpp?rev=92865&r1=92864&r2=92865&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.cpp Wed Jan 6 16:22:49 2010
@@ -285,7 +285,8 @@
}
unsigned
-CriticalAntiDepBreaker::findSuitableFreeRegister(unsigned AntiDepReg,
+CriticalAntiDepBreaker::findSuitableFreeRegister(MachineInstr *MI,
+ unsigned AntiDepReg,
unsigned LastNewReg,
const TargetRegisterClass *RC)
{
@@ -298,6 +299,10 @@
// an anti-dependence with this AntiDepReg, because that would
// re-introduce that anti-dependence.
if (NewReg == LastNewReg) continue;
+ // If the instruction already has a def of the NewReg, it's not suitable.
+ // For example, Instruction with multiple definitions can result in this
+ // condition.
+ if (MI->modifiesRegister(NewReg, TRI)) continue;
// If NewReg is dead and NewReg's most recent def is not before
// AntiDepReg's kill, it's safe to replace AntiDepReg with NewReg.
assert(((KillIndices[AntiDepReg] == ~0u) != (DefIndices[AntiDepReg] == ~0u))
@@ -493,7 +498,7 @@
// TODO: Instead of picking the first free register, consider which might
// be the best.
if (AntiDepReg != 0) {
- if (unsigned NewReg = findSuitableFreeRegister(AntiDepReg,
+ if (unsigned NewReg = findSuitableFreeRegister(MI, AntiDepReg,
LastNewReg[AntiDepReg],
RC)) {
DEBUG(errs() << "Breaking anti-dependence edge on "
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.h?rev=92865&r1=92864&r2=92865&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.h (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/CriticalAntiDepBreaker.h Wed Jan 6 16:22:49 2010
@@ -88,7 +88,8 @@
private:
void PrescanInstruction(MachineInstr *MI);
void ScanInstruction(MachineInstr *MI, unsigned Count);
- unsigned findSuitableFreeRegister(unsigned AntiDepReg,
+ unsigned findSuitableFreeRegister(MachineInstr *MI,
+ unsigned AntiDepReg,
unsigned LastNewReg,
const TargetRegisterClass *);
};
More information about the llvm-branch-commits
mailing list