From: Jay Foad Date: Thu, 27 Apr 2023 15:58:41 +0000 (+0100) Subject: [SimplifyCFG] Remove some unnecessary TTI arguments. NFC. X-Git-Tag: upstream/17.0.6~10170 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee88cd82a9ff716de4ba0e0ffb8036dfef546c2f;p=platform%2Fupstream%2Fllvm.git [SimplifyCFG] Remove some unnecessary TTI arguments. NFC. TTI was already available in the SimplifyCFGOpt class. --- diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index cbfd7b7..4128aac 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -271,10 +271,8 @@ class SimplifyCFGOpt { bool tryToSimplifyUncondBranchWithICmpInIt(ICmpInst *ICI, IRBuilder<> &Builder); - bool HoistThenElseCodeToIf(BranchInst *BI, const TargetTransformInfo &TTI, - bool EqTermsOnly); - bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB, - const TargetTransformInfo &TTI); + bool HoistThenElseCodeToIf(BranchInst *BI, bool EqTermsOnly); + bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB); bool SimplifyTerminatorOnSelect(Instruction *OldTerm, Value *Cond, BasicBlock *TrueBB, BasicBlock *FalseBB, uint32_t TrueWeight, uint32_t FalseWeight); @@ -1491,9 +1489,7 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu /// guarantees that BI's block dominates BB1 and BB2. If EqTermsOnly is given, /// only perform hoisting in case both blocks only contain a terminator. In that /// case, only the original BI will be replaced and selects for PHIs are added. -bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI, - const TargetTransformInfo &TTI, - bool EqTermsOnly) { +bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI, bool EqTermsOnly) { // This does very trivial matching, with limited scanning, to find identical // instructions in the two blocks. In particular, we don't want to get into // O(M*N) situations here where M and N are the sizes of BB1 and BB2. As @@ -2838,8 +2834,8 @@ static bool validateAndCostRequiredSelects(BasicBlock *BB, BasicBlock *ThenBB, /// \endcode /// /// \returns true if the conditional block is removed. -bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB, - const TargetTransformInfo &TTI) { +bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI, + BasicBlock *ThenBB) { // Be conservative for now. FP select instruction can often be expensive. Value *BrCond = BI->getCondition(); if (isa(BrCond)) @@ -7024,8 +7020,7 @@ bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) { // can hoist it up to the branching block. if (BI->getSuccessor(0)->getSinglePredecessor()) { if (BI->getSuccessor(1)->getSinglePredecessor()) { - if (HoistCommon && - HoistThenElseCodeToIf(BI, TTI, !Options.HoistCommonInsts)) + if (HoistCommon && HoistThenElseCodeToIf(BI, !Options.HoistCommonInsts)) return requestResimplify(); } else { // If Successor #1 has multiple preds, we may be able to conditionally @@ -7033,7 +7028,7 @@ bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) { Instruction *Succ0TI = BI->getSuccessor(0)->getTerminator(); if (Succ0TI->getNumSuccessors() == 1 && Succ0TI->getSuccessor(0) == BI->getSuccessor(1)) - if (SpeculativelyExecuteBB(BI, BI->getSuccessor(0), TTI)) + if (SpeculativelyExecuteBB(BI, BI->getSuccessor(0))) return requestResimplify(); } } else if (BI->getSuccessor(1)->getSinglePredecessor()) { @@ -7042,7 +7037,7 @@ bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) { Instruction *Succ1TI = BI->getSuccessor(1)->getTerminator(); if (Succ1TI->getNumSuccessors() == 1 && Succ1TI->getSuccessor(0) == BI->getSuccessor(0)) - if (SpeculativelyExecuteBB(BI, BI->getSuccessor(1), TTI)) + if (SpeculativelyExecuteBB(BI, BI->getSuccessor(1))) return requestResimplify(); }