[all-commits] [llvm/llvm-project] 56ae79: reland "[StructurizeCFG] Hoist and simplify zero-c...

Vigneshwar Jayakumar via All-commits all-commits at lists.llvm.org
Fri Jul 25 13:24:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 56ae79a6ab70ded92846e053b13745ea51e48089
      https://github.com/llvm/llvm-project/commit/56ae79a6ab70ded92846e053b13745ea51e48089
  Author: Vigneshwar Jayakumar <vigneshwar.jayakumar at amd.com>
  Date:   2025-07-25 (Fri, 25 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:
  -----------
  reland "[StructurizeCFG] Hoist and simplify zero-cost incoming else p… (#149744)

…hi values (#139605)"

This relands commit b11523b494b with the fix for llvm-buildbot failures
"clang-hip-vega20" and "openmp-offload-amdgpu-runtime-2". The reland
prevents hoisting the phi node which fixes the issue.

Original PR description:

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