[llvm] AMDGPU: fix isSafeToSink expecting exactly one predecessor (PR #89224)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 08:02:10 PDT 2024


================
@@ -213,17 +213,20 @@ bool SIInstrInfo::isSafeToSink(MachineInstr &MI,
       // Check if there is a FromCycle that contains SgprDef's basic block but
       // does not contain SuccToSinkTo and also has divergent exit condition.
       while (FromCycle && !FromCycle->contains(ToCycle)) {
-        // After structurize-cfg, there should be exactly one cycle exit.
+        // After structurize-cfg, there should be exactly one cycle exit. Also,
+        // cycle exit block should have exactly one predecessor, the cycle exit.
+        // Early-tailduplication can removed that block so we have to search for
+        // predecessor that is in cycle.
----------------
petar-avramovic wrote:

Should I switch to using LoopInfo then? For our targets cycles at this point should all be natural loops.

https://github.com/llvm/llvm-project/pull/89224


More information about the llvm-commits mailing list