aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-09-06 16:06:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-09-06 16:06:37 +0000
commit211f2e5c6be1d7579f70b47527e674caf7530fc7 (patch)
tree5d4f0f653dd8fdd1dc4d5aa8760267be9796f502 /contrib/llvm/lib/CodeGen/IfConversion.cpp
parentf6668e9f56bbdf7973296a85bbf2539a9c5c6b20 (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib/CodeGen/IfConversion.cpp')
-rw-r--r--contrib/llvm/lib/CodeGen/IfConversion.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/llvm/lib/CodeGen/IfConversion.cpp b/contrib/llvm/lib/CodeGen/IfConversion.cpp
index ceeba639ee09..244ce0f8494f 100644
--- a/contrib/llvm/lib/CodeGen/IfConversion.cpp
+++ b/contrib/llvm/lib/CodeGen/IfConversion.cpp
@@ -1759,9 +1759,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.