[PATCH] D46340: AMDGPU/SI: Handle infinite loop for the structurizer to work with CFG with infinite loops.

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 07:46:54 PDT 2018


nhaehnle added a comment.

So this does not cover all possible cases of "irreducible" infinite loops, e.g. consider the case with basic blocks A and B where both end with a conditional branch that can go to either A or B. I.e., there are no unconditional branches in the loop.

A more robust approach would be to also transform conditional branches like this:

  br i1 %cc, label %A, label %B

becomes

    br i1 true, label %DummyReturnBB, label %local_dummy
  local_dummy:
    br i1 %cc, label %A, label %b



================
Comment at: lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp:194
+        ConstantInt *BoolTrue = ConstantInt::getTrue(F.getContext());
+        BB->getInstList().pop_back(); // Remove the unconditional branch.
+        // Add a new conditional branch with a dummy edge to the return block.
----------------
Shouldn't this use eraseFromParent()?


https://reviews.llvm.org/D46340





More information about the llvm-commits mailing list