diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-09-19 17:17:29 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-09-19 17:17:29 +0000 |
| commit | 384a2c76d444a9f4281b56102ea33a997d7552d5 (patch) | |
| tree | e62297f85d35a0a4d7712856dbb21eb7bd046d9c /lib/CodeGen/IfConversion.cpp | |
| parent | 20e25d0be204a896c3eee91b1643097043e6b5d1 (diff) | |
Vendor import of llvm 9.0.0 release r372316:vendor/llvm/llvm-release_900-r372316vendor/llvm-90
Notes
svn path=/vendor/llvm/dist-release_90/; revision=352522
svn path=/vendor/llvm/llvm-release_900-r372316/; revision=352523; tag=vendor/llvm/llvm-release_900-r372316
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
| -rw-r--r-- | lib/CodeGen/IfConversion.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index b17a253fe23f..af556e2c856e 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -912,6 +912,12 @@ void IfConverter::AnalyzeBranches(BBInfo &BBI) { BBI.BrCond.clear(); BBI.IsBrAnalyzable = !TII->analyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); + if (!BBI.IsBrAnalyzable) { + BBI.TrueBB = nullptr; + BBI.FalseBB = nullptr; + BBI.BrCond.clear(); + } + SmallVector<MachineOperand, 4> RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); BBI.IsBrReversible = (RevCond.size() == 0) || !TII->reverseBranchCondition(RevCond); @@ -1758,9 +1764,15 @@ bool IfConverter::IfConvertDiamondCommon( if (!BBI1->IsBrAnalyzable) verifySameBranchInstructions(&MBB1, &MBB2); #endif - BBI1->NonPredSize -= TII->removeBranch(*BBI1->BB); - // Remove duplicated instructions. + // Remove duplicated instructions from the tail of MBB1: any branch + // instructions, and the common instructions counted by NumDups2. DI1 = MBB1.end(); + while (DI1 != MBB1.begin()) { + MachineBasicBlock::iterator Prev = std::prev(DI1); + if (!Prev->isBranch() && !Prev->isDebugInstr()) + break; + DI1 = Prev; + } for (unsigned i = 0; i != NumDups2; ) { // NumDups2 only counted non-dbg_value instructions, so this won't // run off the head of the list. |
