Changes in directory llvm/lib/CodeGen:
RegAllocLocal.cpp updated: 1.87 -> 1.88 --- Log message: Fix Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll on X86. Just because an alias of a register is available, it doesn't mean that we can arbitrarily evict the register. --- Diffs of the changes: (+11 -6) RegAllocLocal.cpp | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.87 llvm/lib/CodeGen/RegAllocLocal.cpp:1.88 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.87 Sat Sep 2 19:06:08 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Sun Sep 3 02:15:37 2006 @@ -103,8 +103,8 @@ } void MarkPhysRegRecentlyUsed(unsigned Reg) { - if(PhysRegsUseOrder.empty() || - PhysRegsUseOrder.back() == Reg) return; // Already most recently used + if (PhysRegsUseOrder.empty() || + PhysRegsUseOrder.back() == Reg) return; // Already most recently used for (unsigned i = PhysRegsUseOrder.size(); i != 0; --i) if (areRegsEqual(Reg, PhysRegsUseOrder[i-1])) { @@ -408,10 +408,15 @@ } else { // If one of the registers aliased to the current register is // compatible, use it. - for (const unsigned *AliasSet = RegInfo->getAliasSet(R); - *AliasSet; ++AliasSet) { - if (RC->contains(*AliasSet)) { - PhysReg = *AliasSet; // Take an aliased register + for (const unsigned *AliasIt = RegInfo->getAliasSet(R); + *AliasIt; ++AliasIt) { + if (RC->contains(*AliasIt) && + // If this is pinned down for some reason, don't use it. For + // example, if CL is pinned, and we run across CH, don't use + // CH as justification for using scavenging ECX (which will + // fail). + PhysRegsUsed[*AliasIt] != 0) { + PhysReg = *AliasIt; // Take an aliased register break; } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits