r338689 | dim | 2018-09-14 21:25:23 +0200 (Fri, 14 Sep 2018) | 12 lines Pull in r335365 from upstream llvm trunk (by Krzysztof Parzyszek): Initialize LiveRegs once in BranchFolder::mergeCommonTails This should fix '(TRI && "LivePhysRegs is not initialized."' assertions when building the lang/qt5-qml port in certain configurations. Approved by: re (kib) Reported by: Piotr Kubaj PR: 231355 MFC after: 3 days Index: lib/CodeGen/BranchFolding.cpp =================================================================== --- lib/CodeGen/BranchFolding.cpp (revision 338688) +++ lib/CodeGen/BranchFolding.cpp (revision 338689) @@ -884,11 +884,12 @@ void BranchFolder::mergeCommonTails(unsigned commo if (UpdateLiveIns) { LivePhysRegs NewLiveIns(*TRI); computeLiveIns(NewLiveIns, *MBB); + LiveRegs.init(*TRI); // The flag merging may lead to some register uses no longer using the // 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) {