[all-commits] [llvm/llvm-project] 69192e: [LegalizeDAG] Optimize CodeGen for `ISD::CTLZ_ZERO...

Manish Kausik H via All-commits all-commits at lists.llvm.org
Mon Jul 8 06:01:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 69192e0193e60c169c7776f444362dffba31eb7d
      https://github.com/llvm/llvm-project/commit/69192e0193e60c169c7776f444362dffba31eb7d
  Author: Manish Kausik H <46352931+Nirhar at users.noreply.github.com>
  Date:   2024-07-08 (Mon, 08 Jul 2024)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
    A llvm/test/CodeGen/AArch64/ctlz_zero_undef.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ctlz-zero-undef.mir
    M llvm/test/CodeGen/AMDGPU/ctlz_zero_undef.ll
    M llvm/test/CodeGen/ARM/GlobalISel/arm-legalize-bitcounts.mir
    M llvm/test/CodeGen/Hexagon/bitmanip.ll
    M llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
    M llvm/test/CodeGen/RISCV/rv64-legal-i32/rv64xtheadbb.ll
    M llvm/test/CodeGen/RISCV/rvv/ctlz-vp.ll
    M llvm/test/CodeGen/SystemZ/scalar-ctlz-01.ll
    M llvm/test/CodeGen/VE/Scalar/ctlz.ll
    M llvm/test/CodeGen/X86/ctlo.ll
    M llvm/test/CodeGen/X86/ctlz.ll
    M llvm/test/CodeGen/X86/lzcnt.ll
    M llvm/test/CodeGen/X86/pr38539.ll
    M llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp

  Log Message:
  -----------
  [LegalizeDAG] Optimize CodeGen for `ISD::CTLZ_ZERO_UNDEF` (#83039)

Previously we had the same instructions being generated for `ISD::CTLZ` and `ISD::CTLZ_ZERO_UNDEF` which did not take advantage of the fact that zero is an invalid input for `ISD::CTLZ_ZERO_UNDEF`. This commit separates codegen for the two cases to allow for the optimization for the latter case.

The details of the optimization are outlined in #82075

Fixes #82075

Co-authored-by: Manish Kausik H <hmamishkausik at gmail.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