[all-commits] [llvm/llvm-project] b7f6ab: [AMDGPU] Try to reuse register with the constant f...

Daniil Fukalov via All-commits all-commits at lists.llvm.org
Wed Jul 16 14:19:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7f6abdd052412bebfedc9cac26fc58b9edb618d
      https://github.com/llvm/llvm-project/commit/b7f6abdd052412bebfedc9cac26fc58b9edb618d
  Author: Daniil Fukalov <dfukalov at gmail.com>
  Date:   2025-07-16 (Wed, 16 Jul 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
    A llvm/test/CodeGen/AMDGPU/select-cmp-shared-constant-fp.ll
    A llvm/test/CodeGen/AMDGPU/select-cmp-shared-constant-int.ll

  Log Message:
  -----------
  [AMDGPU] Try to reuse register with the constant from compare in v_cndmask (#148740)

For some targets, the optimization X == Const ? X : Y -> X == Const ?
Const : Y can cause extra register usage or redundant immediate encoding
for the constant in cndmask generated from the ternary operation.

This patch detects such cases and reuses the register from the compare
instruction that already holds the constant, instead of materializing it
again for cndmask.

The optimization avoids immediates that can be encoded into cndmask
instruction (including +-0.0), as well as !isNormal() constants.

The change is reworked on the base of #131146

---------

Co-authored-by: Copilot <175728472+Copilot at users.noreply.github.com>



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