diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2021-07-23 22:29:04 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2021-07-24 00:18:26 +0300 |
commit | 2aa2fdeed9dc8af922e424545eae56d81c10599f (patch) | |
tree | d790de9dbaa661b6ab85711d511be0dc4474e606 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | c45e17f11f508d1aea97eded3f1bda2a448f2032 (diff) | |
download | llvm-2aa2fdeed9dc8af922e424545eae56d81c10599f.zip llvm-2aa2fdeed9dc8af922e424545eae56d81c10599f.tar.gz llvm-2aa2fdeed9dc8af922e424545eae56d81c10599f.tar.bz2 |
[NFC][BasicBlockUtils] Refactor GetIfCondition() to return the branch, not it's condition
Otherwise e.g. the FoldTwoEntryPHINode() has to do a lot of legwork
to re-deduce what is the dominant block (i.e. for which block
is this branch the terminator).
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index def695e..ee933b6 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -1456,8 +1456,8 @@ void llvm::SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore, ReplaceInstWithInst(HeadOldTerm, HeadNewTerm); } -Value *llvm::GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, - BasicBlock *&IfFalse) { +BranchInst *llvm::GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, + BasicBlock *&IfFalse) { PHINode *SomePHI = dyn_cast<PHINode>(BB->begin()); BasicBlock *Pred1 = nullptr; BasicBlock *Pred2 = nullptr; @@ -1523,7 +1523,7 @@ Value *llvm::GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, return nullptr; } - return Pred1Br->getCondition(); + return Pred1Br; } // Ok, if we got here, both predecessors end with an unconditional branch to @@ -1545,7 +1545,7 @@ Value *llvm::GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, IfTrue = Pred2; IfFalse = Pred1; } - return BI->getCondition(); + return BI; } // After creating a control flow hub, the operands of PHINodes in an outgoing |