[all-commits] [llvm/llvm-project] 531fd4: [PPC] Set minimum of largest number of comparisons...

Shimin Cui via All-commits all-commits at lists.llvm.org
Tue Oct 28 07:24:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 531fd45e9238d0485e3268aaf14ae15d01c7740f
      https://github.com/llvm/llvm-project/commit/531fd45e9238d0485e3268aaf14ae15d01c7740f
  Author: Shimin Cui <scui at ca.ibm.com>
  Date:   2025-10-28 (Tue, 28 Oct 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/BasicTTIImpl.h
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/CodeGen/SwitchLoweringUtils.cpp
    M llvm/lib/CodeGen/TargetLoweringBase.cpp
    M llvm/lib/Target/PowerPC/PPCISelLowering.cpp
    A llvm/test/CodeGen/PowerPC/bittest.ll

  Log Message:
  -----------
  [PPC] Set minimum of largest number of comparisons to use bit test for switch lowering (#155910)

Currently it is considered suitable to lower to a bit test for a set of
switch case clusters when the the number of unique destinations
(`NumDests`) and the number of total comparisons (`NumCmps`) satisfy:
`(NumDests == 1 && NumCmps >= 3) || (NumDests == 2 && NumCmps >= 5) ||
(NumDests == 3 && NumCmps >= 6)`

However it is found for some cases on powerpc, for example, when
NumDests is 3, and the number of comparisons for each destination is all
2, it's not profitable to lower the switch to bit test. This is to add
an option to set the minimum of largest number of comparisons to use bit
test for switch lowering.

---------

Co-authored-by: Shimin Cui <scui at xlperflep9.rtp.raleigh.ibm.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