From c9056b834dd7343204228a93ad54b7e8dda70dab Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 6 Sep 2017 20:45:24 +0000 Subject: Insert IMPLICIT_DEFS for undef uses in tail merging Tail merging can convert an undef use into a normal one when creating a common tail. Doing so can make the register live out from a block which previously contained the undef use. To keep the liveness up-to-date, insert IMPLICIT_DEFs in such blocks when necessary. To enable this patch the computeLiveIns() function which used to compute live-ins for a block and set them immediately is split into new functions: - computeLiveIns() just computes the live-ins in a LivePhysRegs set. - addLiveIns() applies the live-ins to a block live-in list. - computeAndAddLiveIns() is a convenience function combining the other two functions and behaving like computeLiveIns() before this patch. Based on a patch by Krzysztof Parzyszek Differential Revision: https://reviews.llvm.org/D37034 llvm-svn: 312668 --- llvm/lib/CodeGen/BranchRelaxation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/BranchRelaxation.cpp') diff --git a/llvm/lib/CodeGen/BranchRelaxation.cpp b/llvm/lib/CodeGen/BranchRelaxation.cpp index 27ee12c4c5f..cbee43ecd20 100644 --- a/llvm/lib/CodeGen/BranchRelaxation.cpp +++ b/llvm/lib/CodeGen/BranchRelaxation.cpp @@ -259,7 +259,7 @@ MachineBasicBlock *BranchRelaxation::splitBlockBeforeInstr(MachineInstr &MI, // Need to fix live-in lists if we track liveness. if (TRI->trackLivenessAfterRegAlloc(*MF)) - computeLiveIns(LiveRegs, MF->getRegInfo(), *NewBB); + computeAndAddLiveIns(LiveRegs, *NewBB); ++NumSplit; @@ -348,7 +348,7 @@ bool BranchRelaxation::fixupConditionalBranch(MachineInstr &MI) { // Need to fix live-in lists if we track liveness. if (TRI->trackLivenessAfterRegAlloc(*MF)) - computeLiveIns(LiveRegs, MF->getRegInfo(), NewBB); + computeAndAddLiveIns(LiveRegs, NewBB); } // We now have an appropriate fall-through block in place (either naturally or -- cgit v1.2.3