diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-09 13:28:42 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-09 13:28:42 +0000 |
| commit | b1c73532ee8997fe5dfbeb7d223027bdf99758a0 (patch) | |
| tree | 7d6e51c294ab6719475d660217aa0c0ad0526292 /llvm/lib/CodeGen/SelectOptimize.cpp | |
| parent | 7fa27ce4a07f19b07799a767fc29416f3b625afb (diff) | |
Diffstat (limited to 'llvm/lib/CodeGen/SelectOptimize.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectOptimize.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index 30d959704745..05413fb5d758 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -39,7 +39,6 @@ #include <memory> #include <queue> #include <stack> -#include <string> using namespace llvm; @@ -425,7 +424,7 @@ void SelectOptimize::convertProfitableSIGroups(SelectGroups &ProfSIGroups) { BasicBlock *StartBlock = SI->getParent(); BasicBlock::iterator SplitPt = ++(BasicBlock::iterator(LastSI)); BasicBlock *EndBlock = StartBlock->splitBasicBlock(SplitPt, "select.end"); - BFI->setBlockFreq(EndBlock, BFI->getBlockFreq(StartBlock).getFrequency()); + BFI->setBlockFreq(EndBlock, BFI->getBlockFreq(StartBlock)); // Delete the unconditional branch that was just created by the split. StartBlock->getTerminator()->eraseFromParent(); @@ -439,7 +438,7 @@ void SelectOptimize::convertProfitableSIGroups(SelectGroups &ProfSIGroups) { DIt++; } for (auto *DI : DebugPseudoINS) { - DI->moveBefore(&*EndBlock->getFirstInsertionPt()); + DI->moveBeforePreserving(&*EndBlock->getFirstInsertionPt()); } // These are the new basic blocks for the conditional branch. @@ -505,7 +504,8 @@ void SelectOptimize::convertProfitableSIGroups(SelectGroups &ProfSIGroups) { for (auto It = ASI.rbegin(); It != ASI.rend(); ++It) { SelectInst *SI = *It; // The select itself is replaced with a PHI Node. - PHINode *PN = PHINode::Create(SI->getType(), 2, "", &EndBlock->front()); + PHINode *PN = PHINode::Create(SI->getType(), 2, ""); + PN->insertBefore(EndBlock->begin()); PN->takeName(SI); PN->addIncoming(getTrueOrFalseValue(SI, true, INS), TrueBlock); PN->addIncoming(getTrueOrFalseValue(SI, false, INS), FalseBlock); |
