[all-commits] [llvm/llvm-project] cd1dcd: [InstCombine] Handle const select arm in foldSelec...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 14 03:01:44 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd1dcd2c956188521e668e77eec1f8913c01b644
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-ctlz-to-cttz.ll

  Log Message:
  [InstCombine] Handle const select arm in foldSelectCtlzToCttz()

The select arm that takes the ctlz result can also instead be a
constant with the bit width (as this is what the ctlz evaluates to
for a==0).

This avoids a regression when strengthening the
simplifyWithOpReplaced() fold.

Proof: https://alive2.llvm.org/ce/z/DMRL5A

More information about the All-commits mailing list