From 4ea24e993f179113a9bb76ee152cc490e738c936 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 15 Sep 2011 04:52:06 +0000 Subject: It is safe to remat a value killed by phis. The source live range is recomputed using shrinkToUses() which does handle phis correctly. The hasPHIKill() condition was relevant in the old days when ReMaterializeTrivialDef() tried to recompute the live range itself. The shrinkToUses() function will mark the original def as dead when no more uses and phi kills remain. It is then removed by runOnMachineFunction(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139781 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegisterCoalescer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/CodeGen') diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index f3b8ae33c6..674d075c4f 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -805,9 +805,7 @@ bool RegisterCoalescer::ReMaterializeTrivialDef(LiveInterval &SrcInt, LiveInterval::iterator SrcLR = SrcInt.FindLiveRangeContaining(CopyIdx); assert(SrcLR != SrcInt.end() && "Live range not found!"); VNInfo *ValNo = SrcLR->valno; - // If other defs can reach uses of this def, then it's not safe to perform - // the optimization. - if (ValNo->isPHIDef() || ValNo->isUnused() || ValNo->hasPHIKill()) + if (ValNo->isPHIDef() || ValNo->isUnused()) return false; MachineInstr *DefMI = LIS->getInstructionFromIndex(ValNo->def); if (!DefMI) -- cgit v1.2.3