From 4c95f79cce190a3bc9ad4add2d32a2ae5f035d91 Mon Sep 17 00:00:00 2001 From: Momchil Velikov Date: Wed, 19 Jul 2023 18:31:25 +0100 Subject: [CodeGenPrepare] Refactor optimizeSelectInst (NFC) Refactor to use BasicBlockUtils functions and make life easier for a subsequent patch for updating the dominator tree. Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D154053 --- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp') diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index a28b331..f06ea89 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -1484,6 +1484,19 @@ Instruction *llvm::SplitBlockAndInsertIfThen(Value *Cond, return ThenBlock->getTerminator(); } +Instruction *llvm::SplitBlockAndInsertIfElse(Value *Cond, + Instruction *SplitBefore, + bool Unreachable, + MDNode *BranchWeights, + DomTreeUpdater *DTU, LoopInfo *LI, + BasicBlock *ElseBlock) { + SplitBlockAndInsertIfThenElse( + Cond, SplitBefore, /* ThenBlock */ nullptr, &ElseBlock, + /* UnreachableThen */ false, + /* UnreachableElse */ Unreachable, BranchWeights, DTU, LI); + return ElseBlock->getTerminator(); +} + void llvm::SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore, Instruction **ThenTerm, Instruction **ElseTerm, -- cgit v1.1