OSDN Git Service

Initialize LiveRegs once in BranchFolder::mergeCommonTails
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 22 Jun 2018 16:38:38 +0000 (16:38 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 22 Jun 2018 16:38:38 +0000 (16:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335365 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BranchFolding.cpp

index 0787ca5..c7a0c64 100644 (file)
@@ -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) {