From: Jakob Stoklund Olesen Date: Wed, 20 Oct 2010 18:45:55 +0000 (+0000) Subject: When SimpleRegisterCoalescing is trimming kill flags on a physical register X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9b259404740cb48313615d2cfd88a6b1045560bf;p=oota-llvm.git When SimpleRegisterCoalescing is trimming kill flags on a physical register operand, also check if subregisters are killed. Add operands for subregisters that remain alive after a super register is killed. I don't have a testcase for this that reproduces on trunk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116940 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index 41be8d551f5..2f73551aa6d 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -1767,8 +1767,18 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) { if (!MO.isReg() || !MO.isKill()) continue; unsigned reg = MO.getReg(); if (!reg || !li_->hasInterval(reg)) continue; - if (!li_->getInterval(reg).killedAt(DefIdx)) + if (!li_->getInterval(reg).killedAt(DefIdx)) { MO.setIsKill(false); + continue; + } + // When leaving a kill flag on a physreg, check if any subregs should + // remain alive. + if (!TargetRegisterInfo::isPhysicalRegister(reg)) + continue; + for (const unsigned *SR = tri_->getSubRegisters(reg); + unsigned S = *SR; ++SR) + if (li_->hasInterval(S) && li_->getInterval(S).liveAt(DefIdx)) + MI->addRegisterDefined(S, tri_); } } }