[all-commits] [llvm/llvm-project] 500432: [LoopFusion] sink second loop PHIs

Joshua Cao via All-commits all-commits at lists.llvm.org
Tue Dec 13 10:14:03 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5004320590aed2e27140fb458ebd67b68af05a91
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2022-12-13 (Tue, 13 Dec 2022)

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

  Log Message:
  [LoopFusion] sink second loop PHIs

Fixes https://github.com/llvm/llvm-project/issues/59023

PHI nodes that are in the second loop only have the first loop as its
predecessor. These PHI nodes should be sunk to the end of the fused
loop. If the second loop uses the PHI, then the loops cannot be fused.

I don't think this should happen in typical compilation workflows.
The PHI will be in a dedicated exit block of the first loop following
LCSSA transformations.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D139812

More information about the All-commits mailing list