aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-09-09 19:58:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-09-09 19:58:46 +0000
commitf993ed2fbd3c307200ed9a6351e649f0904b39c5 (patch)
tree0b2e3ac75f2bfe21c4cd09569748957566ab92d9 /contrib/llvm/lib
parente008cf3eb58f57efc484c8aaef1fbc9f8f146036 (diff)
parent209002976934ad70cc924b01d261832c796f503a (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib')
-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 b17a253fe23f..fde3c152e9d9 100644
--- a/contrib/llvm/lib/CodeGen/IfConversion.cpp
+++ b/contrib/llvm/lib/CodeGen/IfConversion.cpp
@@ -1758,9 +1758,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.