diff options
| author | Lang Hames <lhames@gmail.com> | 2009-09-03 02:52:02 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2009-09-03 02:52:02 +0000 |
| commit | 0b3720b3c383d7470451d96b0dc2f1882aa9c5f4 (patch) | |
| tree | 4beec1e665ebe12111ea3839fd4b68a8ac2b6623 | |
| parent | 2d60e1ec0ca2977910c4d8bf3652039d20139eaa (diff) | |
| download | bcm5719-llvm-0b3720b3c383d7470451d96b0dc2f1882aa9c5f4.tar.gz bcm5719-llvm-0b3720b3c383d7470451d96b0dc2f1882aa9c5f4.zip | |
Fixed a test that ensures the LocalRewriter does not attempt to
avoid reloads by reusing clobbered registers.
This was causing issues in 256.bzip2 when compiled with PIC for
a while (starting at r78217), though the problem has since been masked.
llvm-svn: 80872
| -rw-r--r-- | llvm/include/llvm/Target/TargetRegisterInfo.h | 24 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocPBQP.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/VirtRegRewriter.cpp | 2 |
3 files changed, 12 insertions, 16 deletions
diff --git a/llvm/include/llvm/Target/TargetRegisterInfo.h b/llvm/include/llvm/Target/TargetRegisterInfo.h index 1673c9a5597..421d0bbd281 100644 --- a/llvm/include/llvm/Target/TargetRegisterInfo.h +++ b/llvm/include/llvm/Target/TargetRegisterInfo.h @@ -386,9 +386,16 @@ public: return NumRegs; } - /// areAliases - Returns true if the two registers alias each other, false - /// otherwise - bool areAliases(unsigned regA, unsigned regB) const { + /// regsOverlap - Returns true if the two registers are equal or alias each + /// other. The registers may be virtual register. + bool regsOverlap(unsigned regA, unsigned regB) const { + if (regA == regB) + return true; + + if (isVirtualRegister(regA) || isVirtualRegister(regB)) + return false; + + // regA and regB are distinct physical registers. Do they alias? size_t index = (regA + regB * 37) & (AliasesHashSize-1); unsigned ProbeAmt = 0; while (AliasesHash[index*2] != 0 && @@ -403,17 +410,6 @@ public: return false; } - /// regsOverlap - Returns true if the two registers are equal or alias each - /// other. The registers may be virtual register. - bool regsOverlap(unsigned regA, unsigned regB) const { - if (regA == regB) - return true; - - if (isVirtualRegister(regA) || isVirtualRegister(regB)) - return false; - return areAliases(regA, regB); - } - /// isSubRegister - Returns true if regB is a sub-register of regA. /// bool isSubRegister(unsigned regA, unsigned regB) const { diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp index 853192ca9d2..e85a5ac7043 100644 --- a/llvm/lib/CodeGen/RegAllocPBQP.cpp +++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp @@ -269,7 +269,7 @@ PBQP::Matrix* PBQPRegAlloc::buildInterferenceMatrix( unsigned reg2 = *a2Itr; // If the row/column regs are identical or alias insert an infinity. - if ((reg1 == reg2) || tri->areAliases(reg1, reg2)) { + if (tri->regsOverlap(reg1, reg2)) { (*m)[ri][ci] = std::numeric_limits<PBQP::PBQPNum>::infinity(); isZeroMatrix = false; } diff --git a/llvm/lib/CodeGen/VirtRegRewriter.cpp b/llvm/lib/CodeGen/VirtRegRewriter.cpp index 6da6a9b9f06..79b366ca8d0 100644 --- a/llvm/lib/CodeGen/VirtRegRewriter.cpp +++ b/llvm/lib/CodeGen/VirtRegRewriter.cpp @@ -797,7 +797,7 @@ unsigned ReuseInfo::GetRegForReload(const TargetRegisterClass *RC, // value aliases the new register. If so, codegen the previous reload // and use this one. unsigned PRRU = Op.PhysRegReused; - if (TRI->areAliases(PRRU, PhysReg)) { + if (TRI->regsOverlap(PRRU, PhysReg)) { // Okay, we found out that an alias of a reused register // was used. This isn't good because it means we have // to undo a previous reuse. |

