[all-commits] [llvm/llvm-project] 8361d9: [InstCombine] disable select folding resulting in ...

Alex MacLean via All-commits all-commits at lists.llvm.org
Mon Jul 1 08:11:17 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8361d9065e393c0e74ab8bfccdab3fd7850a10b2
      https://github.com/llvm/llvm-project/commit/8361d9065e393c0e74ab8bfccdab3fd7850a10b2
  Author: Alex MacLean <amaclean at nvidia.com>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-icmp-and.ll

  Log Message:
  -----------
  [InstCombine] disable select folding resulting in extra instructions (#97184)

Disable conversion of a `(select (icmp))` when it would result in more
instructions `(xor (lshr (and)))`. This transformation produces more
instructions and can interfere with other more profitable folds for
`select`. For example before this change the following folding would
occur:
```llvm
  %1 = icmp slt i32 %X, 0
  %2 = select i1 %1, i64 0, i64 8
```
to 
```llvm
  %1 = lshr i32 %X, 28
  %2 = and i32 %1, 8
  %3 = xor i32 %2, 8
  %4 = zext nneg i32 %3 to i64
```



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