|
@@ -207,7 +207,7 @@ namespace {
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
- bool ReverseBranchCondition(BBInfo &BBI) const;
|
|
|
+ bool reverseBranchCondition(BBInfo &BBI) const;
|
|
|
bool ValidSimple(BBInfo &TrueBBI, unsigned &Dups,
|
|
|
BranchProbability Prediction) const;
|
|
|
bool ValidTriangle(BBInfo &TrueBBI, BBInfo &FalseBBI,
|
|
@@ -501,10 +501,10 @@ static MachineBasicBlock *findFalseBlock(MachineBasicBlock *BB,
|
|
|
|
|
|
/// Reverse the condition of the end of the block branch. Swap block's 'true'
|
|
|
/// and 'false' successors.
|
|
|
-bool IfConverter::ReverseBranchCondition(BBInfo &BBI) const {
|
|
|
+bool IfConverter::reverseBranchCondition(BBInfo &BBI) const {
|
|
|
DebugLoc dl; // FIXME: this is nowhere
|
|
|
- if (!TII->ReverseBranchCondition(BBI.BrCond)) {
|
|
|
- TII->RemoveBranch(*BBI.BB);
|
|
|
+ if (!TII->reverseBranchCondition(BBI.BrCond)) {
|
|
|
+ TII->removeBranch(*BBI.BB);
|
|
|
TII->insertBranch(*BBI.BB, BBI.FalseBB, BBI.TrueBB, BBI.BrCond, dl);
|
|
|
std::swap(BBI.TrueBB, BBI.FalseBB);
|
|
|
return true;
|
|
@@ -857,11 +857,11 @@ bool IfConverter::ValidForkedDiamond(
|
|
|
if (!FalseBBI.IsBrReversible)
|
|
|
return false;
|
|
|
FalseReversed = true;
|
|
|
- ReverseBranchCondition(FalseBBI);
|
|
|
+ reverseBranchCondition(FalseBBI);
|
|
|
}
|
|
|
auto UnReverseOnExit = make_scope_exit([&]() {
|
|
|
if (FalseReversed)
|
|
|
- ReverseBranchCondition(FalseBBI);
|
|
|
+ reverseBranchCondition(FalseBBI);
|
|
|
});
|
|
|
|
|
|
// Count duplicate instructions at the beginning of the true and false blocks.
|
|
@@ -955,7 +955,7 @@ void IfConverter::AnalyzeBranches(BBInfo &BBI) {
|
|
|
!TII->analyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond);
|
|
|
SmallVector<MachineOperand, 4> RevCond(BBI.BrCond.begin(), BBI.BrCond.end());
|
|
|
BBI.IsBrReversible = (RevCond.size() == 0) ||
|
|
|
- !TII->ReverseBranchCondition(RevCond);
|
|
|
+ !TII->reverseBranchCondition(RevCond);
|
|
|
BBI.HasFallThrough = BBI.IsBrAnalyzable && BBI.FalseBB == nullptr;
|
|
|
|
|
|
if (BBI.BrCond.size()) {
|
|
@@ -1113,10 +1113,10 @@ bool IfConverter::FeasibilityAnalysis(BBInfo &BBI,
|
|
|
SmallVector<MachineOperand, 4> RevPred(Pred.begin(), Pred.end());
|
|
|
SmallVector<MachineOperand, 4> Cond(BBI.BrCond.begin(), BBI.BrCond.end());
|
|
|
if (RevBranch) {
|
|
|
- if (TII->ReverseBranchCondition(Cond))
|
|
|
+ if (TII->reverseBranchCondition(Cond))
|
|
|
return false;
|
|
|
}
|
|
|
- if (TII->ReverseBranchCondition(RevPred) ||
|
|
|
+ if (TII->reverseBranchCondition(RevPred) ||
|
|
|
!TII->SubsumesPredicate(Cond, RevPred))
|
|
|
return false;
|
|
|
}
|
|
@@ -1202,7 +1202,7 @@ void IfConverter::AnalyzeBlock(
|
|
|
|
|
|
SmallVector<MachineOperand, 4>
|
|
|
RevCond(BBI.BrCond.begin(), BBI.BrCond.end());
|
|
|
- bool CanRevCond = !TII->ReverseBranchCondition(RevCond);
|
|
|
+ bool CanRevCond = !TII->reverseBranchCondition(RevCond);
|
|
|
|
|
|
unsigned Dups = 0;
|
|
|
unsigned Dups2 = 0;
|
|
@@ -1502,7 +1502,7 @@ bool IfConverter::IfConvertSimple(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
return false;
|
|
|
|
|
|
if (Kind == ICSimpleFalse)
|
|
|
- if (TII->ReverseBranchCondition(Cond))
|
|
|
+ if (TII->reverseBranchCondition(Cond))
|
|
|
llvm_unreachable("Unable to reverse branch condition!");
|
|
|
|
|
|
// Initialize liveins to the first BB. These are potentiall redefined by
|
|
@@ -1517,7 +1517,7 @@ bool IfConverter::IfConvertSimple(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
DontKill.addLiveIns(NextMBB);
|
|
|
|
|
|
if (CvtMBB.pred_size() > 1) {
|
|
|
- BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB);
|
|
|
+ BBI.NonPredSize -= TII->removeBranch(*BBI.BB);
|
|
|
// Copy instructions in the true block, predicate them, and add them to
|
|
|
// the entry block.
|
|
|
CopyAndPredicateBlock(BBI, *CvtBBI, Cond);
|
|
@@ -1530,7 +1530,7 @@ bool IfConverter::IfConvertSimple(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
PredicateBlock(*CvtBBI, CvtMBB.end(), Cond);
|
|
|
|
|
|
// Merge converted block into entry block.
|
|
|
- BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB);
|
|
|
+ BBI.NonPredSize -= TII->removeBranch(*BBI.BB);
|
|
|
MergeBlocks(BBI, *CvtBBI);
|
|
|
}
|
|
|
|
|
@@ -1590,11 +1590,11 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
return false;
|
|
|
|
|
|
if (Kind == ICTriangleFalse || Kind == ICTriangleFRev)
|
|
|
- if (TII->ReverseBranchCondition(Cond))
|
|
|
+ if (TII->reverseBranchCondition(Cond))
|
|
|
llvm_unreachable("Unable to reverse branch condition!");
|
|
|
|
|
|
if (Kind == ICTriangleRev || Kind == ICTriangleFRev) {
|
|
|
- if (ReverseBranchCondition(*CvtBBI)) {
|
|
|
+ if (reverseBranchCondition(*CvtBBI)) {
|
|
|
// BB has been changed, modify its predecessors (except for this
|
|
|
// one) so they don't get ifcvt'ed based on bad intel.
|
|
|
for (MachineBasicBlock *PBB : CvtMBB.predecessors()) {
|
|
@@ -1629,7 +1629,7 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
}
|
|
|
|
|
|
if (CvtMBB.pred_size() > 1) {
|
|
|
- BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB);
|
|
|
+ BBI.NonPredSize -= TII->removeBranch(*BBI.BB);
|
|
|
// Copy instructions in the true block, predicate them, and add them to
|
|
|
// the entry block.
|
|
|
CopyAndPredicateBlock(BBI, *CvtBBI, Cond, true);
|
|
@@ -1639,11 +1639,11 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
BBI.BB->removeSuccessor(&CvtMBB, true);
|
|
|
} else {
|
|
|
// Predicate the 'true' block after removing its branch.
|
|
|
- CvtBBI->NonPredSize -= TII->RemoveBranch(CvtMBB);
|
|
|
+ CvtBBI->NonPredSize -= TII->removeBranch(CvtMBB);
|
|
|
PredicateBlock(*CvtBBI, CvtMBB.end(), Cond);
|
|
|
|
|
|
// Now merge the entry of the triangle with the true block.
|
|
|
- BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB);
|
|
|
+ BBI.NonPredSize -= TII->removeBranch(*BBI.BB);
|
|
|
MergeBlocks(BBI, *CvtBBI, false);
|
|
|
}
|
|
|
|
|
@@ -1651,7 +1651,7 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) {
|
|
|
if (HasEarlyExit) {
|
|
|
SmallVector<MachineOperand, 4> RevCond(CvtBBI->BrCond.begin(),
|
|
|
CvtBBI->BrCond.end());
|
|
|
- if (TII->ReverseBranchCondition(RevCond))
|
|
|
+ if (TII->reverseBranchCondition(RevCond))
|
|
|
llvm_unreachable("Unable to reverse branch condition!");
|
|
|
|
|
|
// Update the edge probability for both CvtBBI->FalseBB and NextBBI.
|
|
@@ -1744,7 +1744,7 @@ bool IfConverter::IfConvertDiamondCommon(
|
|
|
BBInfo *BBI1 = &TrueBBI;
|
|
|
BBInfo *BBI2 = &FalseBBI;
|
|
|
SmallVector<MachineOperand, 4> RevCond(BBI.BrCond.begin(), BBI.BrCond.end());
|
|
|
- if (TII->ReverseBranchCondition(RevCond))
|
|
|
+ if (TII->reverseBranchCondition(RevCond))
|
|
|
llvm_unreachable("Unable to reverse branch condition!");
|
|
|
SmallVector<MachineOperand, 4> *Cond1 = &BBI.BrCond;
|
|
|
SmallVector<MachineOperand, 4> *Cond2 = &RevCond;
|
|
@@ -1764,7 +1764,7 @@ bool IfConverter::IfConvertDiamondCommon(
|
|
|
}
|
|
|
|
|
|
// Remove the conditional branch from entry to the blocks.
|
|
|
- BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB);
|
|
|
+ BBI.NonPredSize -= TII->removeBranch(*BBI.BB);
|
|
|
|
|
|
MachineBasicBlock &MBB1 = *BBI1->BB;
|
|
|
MachineBasicBlock &MBB2 = *BBI2->BB;
|
|
@@ -1819,7 +1819,7 @@ bool IfConverter::IfConvertDiamondCommon(
|
|
|
if (!BBI1->IsBrAnalyzable)
|
|
|
verifySameBranchInstructions(&MBB1, &MBB2);
|
|
|
#endif
|
|
|
- BBI1->NonPredSize -= TII->RemoveBranch(*BBI1->BB);
|
|
|
+ BBI1->NonPredSize -= TII->removeBranch(*BBI1->BB);
|
|
|
// Remove duplicated instructions.
|
|
|
DI1 = MBB1.end();
|
|
|
for (unsigned i = 0; i != NumDups2; ) {
|
|
@@ -1841,7 +1841,7 @@ bool IfConverter::IfConvertDiamondCommon(
|
|
|
// The branches have been checked to match. Skip over the branch in the false
|
|
|
// block so that we don't try to predicate it.
|
|
|
if (RemoveBranch)
|
|
|
- BBI2->NonPredSize -= TII->RemoveBranch(*BBI2->BB);
|
|
|
+ BBI2->NonPredSize -= TII->removeBranch(*BBI2->BB);
|
|
|
else {
|
|
|
do {
|
|
|
assert(DI2 != MBB2.begin());
|