+// XXX-update: Returns whether we can remove a conditional branch instruction.
+// If it's one that is mannually added by us, then don't remove it (return
+// false). All their successors are the same.
+static bool shouldRemoveConditionalBranch(MachineInstr* I) {
+ auto* MBB = I->getParent();
+ assert(isCondBranchOpcode(I->getOpcode()));
+ bool SameSuccessor = true;
+ MachineBasicBlock* BB = nullptr;
+ for (auto* Succ : MBB->successors()) {
+ if (!BB) {
+ BB = Succ;
+ }
+ if (BB != Succ) {
+ SameSuccessor = false;
+ }
+ }
+ return !SameSuccessor;
+}
+