diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-12-11 06:01:00 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-12-11 06:01:00 +0000 |
commit | ac94863a1c090f2221ff2e21b7ee5480bd1db594 (patch) | |
tree | a86c54866585f34a3b6ee247d29bc50b65ed6bbd /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | 64bdde2093f461f10c095d08d53dc57c6612ce69 (diff) | |
download | external_llvm-ac94863a1c090f2221ff2e21b7ee5480bd1db594.zip external_llvm-ac94863a1c090f2221ff2e21b7ee5480bd1db594.tar.gz external_llvm-ac94863a1c090f2221ff2e21b7ee5480bd1db594.tar.bz2 |
Coalesce insert_subreg undef, x first to avoid phase ordering issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 4d73b50..8806439 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -745,8 +745,16 @@ unsigned LiveIntervals::getVNInfoSourceReg(const VNInfo *VNI) const { if (VNI->getCopy()->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { // If it's extracting out of a physical register, return the sub-register. unsigned Reg = VNI->getCopy()->getOperand(1).getReg(); - if (TargetRegisterInfo::isPhysicalRegister(Reg)) + if (TargetRegisterInfo::isPhysicalRegister(Reg)) { + unsigned SrcSubReg = VNI->getCopy()->getOperand(2).getImm(); + unsigned DstSubReg = VNI->getCopy()->getOperand(0).getSubReg(); + if (SrcSubReg == DstSubReg) + // %reg1034:3<def> = EXTRACT_SUBREG %EDX, 3 + // reg1034 can still be coalesced to EDX. + return Reg; + assert(DstSubReg == 0); Reg = tri_->getSubReg(Reg, VNI->getCopy()->getOperand(2).getImm()); + } return Reg; } else if (VNI->getCopy()->getOpcode() == TargetInstrInfo::INSERT_SUBREG || VNI->getCopy()->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) |