From: Evan Cheng Date: Wed, 15 Nov 2006 20:54:11 +0000 (+0000) Subject: A register def can be partially dead when the whole register has use(s) but a subreg... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9a1956ae6ad2d4892afbc9f1b97d645d220b6d4a;hp=a6c4c1eb90413986519c46f70222539dee39ffe9;p=oota-llvm.git A register def can be partially dead when the whole register has use(s) but a subreg does not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31760 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 730ad239141..03f38602aee 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -575,7 +575,6 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB, // A physical register cannot be live across basic block, so its // lifetime must end somewhere in its defining basic block. DEBUG(std::cerr << "\t\tregister: "; printRegName(interval.reg)); - typedef LiveVariables::killed_iterator KillIter; unsigned baseIndex = MIIdx; unsigned start = getDefIndex(baseIndex); @@ -599,6 +598,14 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB, DEBUG(std::cerr << " killed"); end = getUseIndex(baseIndex) + 1; goto exit; + } else if (lv_->ModifiesRegister(mi, interval.reg)) { + // Another instruction redefines the register before it is ever read. + // Then the register is essentially dead at the instruction that defines + // it. Hence its interval is: + // [defSlot(def), defSlot(def)+1) + DEBUG(std::cerr << " dead"); + end = getDefIndex(start) + 1; + goto exit; } }