diff options
author | Chris Lattner <sabre@nondot.org> | 2004-10-15 03:19:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-10-15 03:19:31 +0000 |
commit | 47eb6567e22ecf87ebeabc566fac6c02c975a9a4 (patch) | |
tree | a847eb309a4f92b0db61adf295b0ba830f4c759b | |
parent | 8df6a594d2781777cd25fe2d00818419a8b10e5c (diff) | |
download | external_llvm-47eb6567e22ecf87ebeabc566fac6c02c975a9a4.zip external_llvm-47eb6567e22ecf87ebeabc566fac6c02c975a9a4.tar.gz external_llvm-47eb6567e22ecf87ebeabc566fac6c02c975a9a4.tar.bz2 |
This patch fixes the nasty bug that caused 175.vpr to fail for X86 last night.
The problem occurred when trying to reload this instruction:
MOV32mr %reg2326, 8, %reg2297, 4, %reg2295
The value of reg2326 was available in EBX, so it was reused from there, instead
of reloading it into EDX.
The value of reg2297 was available in EDX, so it was reused from there, instead
of reloading it into EDI.
The value of reg2295 was not available, so we tried reloading it into EBX, its
assigned register. However, we checked and saw that we already reloaded
something into EBX, so we chose what reg2326 was assigned to (EDX) and reloaded
into that register instead.
Unfortunately EDX had already been used by reg2297, so reloading into EDX
clobbered the value used by the reg2326 operand, breaking the program.
The fix for this is to check that the newly picked register is ok. In this
case we now find that EDX is already used and try using EDI, which succeeds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17006 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/VirtRegMap.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index dd8eb87..49cebe8 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -352,6 +352,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) { // Otherwise, reload it and remember that we have it. PhysReg = VRM.getPhys(VirtReg); + RecheckRegister: // Note that, if we reused a register for a previous operand, the // register we want to reload into might not actually be // available. If this occurs, use the register indicated by the @@ -361,7 +362,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) { if (ReusedOperands[ro].PhysRegReused == PhysReg) { // Yup, use the reload register that we didn't use before. PhysReg = ReusedOperands[ro].AssignedPhysReg; - break; + goto RecheckRegister; } else { ReusedOp &Op = ReusedOperands[ro]; unsigned PRRU = Op.PhysRegReused; |