[all-commits] [llvm/llvm-project] 8d3f49: [StructurizeCFG] Hoist and simplify zero-cost inco...

Vigneshwar Jayakumar via All-commits all-commits at lists.llvm.org
Thu Jul 10 10:03:26 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d3f497eb834a84b954241b8c4293f8387e75576
      https://github.com/llvm/llvm-project/commit/8d3f497eb834a84b954241b8c4293f8387e75576
  Author: Vigneshwar Jayakumar <vigneshwar.jayakumar at amd.com>
  Date:   2025-07-10 (Thu, 10 Jul 2025)

  Changed paths:
    M llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
    M llvm/test/CodeGen/AMDGPU/memintrinsic-unroll.ll
    A llvm/test/CodeGen/AMDGPU/structurize-hoist.ll
    A llvm/test/Transforms/StructurizeCFG/hoist-zerocost.ll

  Log Message:
  -----------
  [StructurizeCFG] Hoist and simplify zero-cost incoming else phi values (#139605)

The order of if and else blocks can introduce unnecessary VGPR copies.  
Consider the case of an if-else block where the incoming phi from the
'Else block' only contains zero-cost instructions, and the 'Then' block
modifies some value. There would be no interference when coalescing
because only one value is live at any point before structurization.
However, in the structurized CFG, the Then value is live at 'Else' block
due to the path if→flow→else, leading to additional VGPR copies.

This patch addresses the issue by:
- Identifying PHI nodes with zero-cost incoming values from the Else
block and hoisting those values to the nearest common dominator of the
Then and Else blocks.
- Updating Flow PHI nodes by replacing poison entries (on the if→flow
edge) with the correct hoisted values.



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