diff options
| author | Jim Grosbach <grosbach@apple.com> | 2010-01-06 22:21:25 +0000 |
|---|---|---|
| committer | Jim Grosbach <grosbach@apple.com> | 2010-01-06 22:21:25 +0000 |
| commit | a7cef4fab53c13d477d50948cefb208086391c69 (patch) | |
| tree | f5a4da9c7325a377fed09b4c2c72b34ab7d9bb47 /llvm/lib/CodeGen | |
| parent | b3d8deecbfd2462e249f81b2f9a077abaffd4c7f (diff) | |
| download | bcm5719-llvm-a7cef4fab53c13d477d50948cefb208086391c69.tar.gz bcm5719-llvm-a7cef4fab53c13d477d50948cefb208086391c69.zip | |
Anti-dependency breaking needs to be careful regarding instructions with
multiple register definitions.
llvm-svn: 92864
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/CriticalAntiDepBreaker.h | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp b/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp index e5d68a6cb81..056e2d5b01e 100644 --- a/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp +++ b/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp @@ -288,7 +288,8 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr *MI, } unsigned -CriticalAntiDepBreaker::findSuitableFreeRegister(unsigned AntiDepReg, +CriticalAntiDepBreaker::findSuitableFreeRegister(MachineInstr *MI, + unsigned AntiDepReg, unsigned LastNewReg, const TargetRegisterClass *RC) { @@ -301,6 +302,10 @@ CriticalAntiDepBreaker::findSuitableFreeRegister(unsigned AntiDepReg, // 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)) @@ -496,7 +501,7 @@ BreakAntiDependencies(std::vector<SUnit>& SUnits, // 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(dbgs() << "Breaking anti-dependence edge on " diff --git a/llvm/lib/CodeGen/CriticalAntiDepBreaker.h b/llvm/lib/CodeGen/CriticalAntiDepBreaker.h index 37406671938..9e8db022621 100644 --- a/llvm/lib/CodeGen/CriticalAntiDepBreaker.h +++ b/llvm/lib/CodeGen/CriticalAntiDepBreaker.h @@ -88,7 +88,8 @@ namespace llvm { 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 *); }; |

