[llvm] [AMDGPU] Change control flow intrinsic lowering making the wave to re… (PR #86805)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 13:40:12 PDT 2024
================
@@ -306,38 +306,26 @@ bool SIAnnotateControlFlow::handleLoop(BranchInst *Term) {
/// Close the last opened control flow
bool SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) {
- llvm::Loop *L = LI->getLoopFor(BB);
assert(Stack.back().first == BB);
- if (L && L->getHeader() == BB) {
- // We can't insert an EndCF call into a loop header, because it will
- // get executed on every iteration of the loop, when it should be
- // executed only once before the loop.
- SmallVector <BasicBlock *, 8> Latches;
- L->getLoopLatches(Latches);
-
- SmallVector<BasicBlock *, 2> Preds;
- for (BasicBlock *Pred : predecessors(BB)) {
- if (!is_contained(Latches, Pred))
- Preds.push_back(Pred);
- }
-
- BB = SplitBlockPredecessors(BB, Preds, "endcf.split", DT, LI, nullptr,
- false);
- }
-
Value *Exec = popSaved();
- BasicBlock::iterator FirstInsertionPt = BB->getFirstInsertionPt();
- if (!isa<UndefValue>(Exec) && !isa<UnreachableInst>(FirstInsertionPt)) {
- Instruction *ExecDef = cast<Instruction>(Exec);
- BasicBlock *DefBB = ExecDef->getParent();
- if (!DT->dominates(DefBB, BB)) {
- // Split edge to make Def dominate Use
- FirstInsertionPt = SplitEdge(DefBB, BB, DT, LI)->getFirstInsertionPt();
+ Instruction *ExecDef = dyn_cast<Instruction>(Exec);
+ BasicBlock *DefBB = ExecDef->getParent();
+ for (auto Pred : predecessors(BB)) {
+ llvm::Loop *L = LI->getLoopFor(Pred);
----------------
alex-t wrote:
The code is removed in the current version.
https://github.com/llvm/llvm-project/pull/86805
More information about the llvm-commits
mailing list