[all-commits] [llvm/llvm-project] e4af48: [LoopFusion] Cleanup control flow before Fusion (#...

Ehsan Amiri via All-commits all-commits at lists.llvm.org
Fri Sep 25 13:45:53 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e4af48bd3b330282f36f075d6fa7a4a0742376c1
      https://github.com/llvm/llvm-project/commit/e4af48bd3b330282f36f075d6fa7a4a0742376c1
  Author: Ehsan Amiri <ehsan.amiri at huawei.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopFuse.cpp
    A llvm/test/Transforms/LoopFusion/guard_skip_empty_block.ll

  Log Message:
  -----------
  [LoopFusion] Cleanup control flow before Fusion (#226289)

Non-loop successor of loop guard is sometimes modified by JumpThreading
(and potentially some other passes) to jump to a new block, that doesn't
post dominate the exit block of the loop:

   Guard:    br %c, %Preheader, %Skip
   Skip:     br %Merge
   ...
   Exit:     br %Merge
   Merge:    ...

Later on, this block becomes empty, so it can be removed. Its presence
prevents Loop::getLoopGuardBranch() from detecting the loop guard which
results in missed fusion opportunities. SimplifyCFG will run when "Skip"
is still not optimzied, so it cannot resolve this issue.

Assisted by Claude Code



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list