Skip to content

Commit

Permalink
Initialize LiveRegs once in BranchFolder::mergeCommonTails
Browse files Browse the repository at this point in the history
llvm-svn: 335365
  • Loading branch information
Krzysztof Parzyszek committed Jun 22, 2018
1 parent 9d3ef8e commit 358a916
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/CodeGen/BranchFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,11 +921,12 @@ void BranchFolder::mergeCommonTails(unsigned commonTailIndex) {
if (UpdateLiveIns) {
LivePhysRegs NewLiveIns(*TRI);
computeLiveIns(NewLiveIns, *MBB);
LiveRegs.init(*TRI);

// The flag merging may lead to some register uses no longer using the
// <undef> flag, add IMPLICIT_DEFs in the predecessors as necessary.
for (MachineBasicBlock *Pred : MBB->predecessors()) {
LiveRegs.init(*TRI);
LiveRegs.clear();
LiveRegs.addLiveOuts(*Pred);
MachineBasicBlock::iterator InsertBefore = Pred->getFirstTerminator();
for (unsigned Reg : NewLiveIns) {
Expand Down

0 comments on commit 358a916

Please sign in to comment.