[all-commits] [llvm/llvm-project] b2659c: [InstCombine] Propagate flags in `foldSelectICmpAn...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Tue Feb 18 17:22:37 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b2659ca44b2e26b558fce66689792709411c7d38
      https://github.com/llvm/llvm-project/commit/b2659ca44b2e26b558fce66689792709411c7d38
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-02-19 (Wed, 19 Feb 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll

  Log Message:
  -----------
  [InstCombine] Propagate flags in `foldSelectICmpAndBinOp` (#127437)

It is always safe to add poison-generating flags for `BinOp Y,
Identity`.
Proof: https://alive2.llvm.org/ce/z/8BLEpq
and https://alive2.llvm.org/ce/z/584Bb4

Then we can propagate flags from one of the arms:
```
select Cond, Y, (BinOp flags Y, Z) ->
select Cond, (BinOp flags Y, Identity), (BinOp flags Y, Z) ->
BinOp flags Y, (select Cond, Identity, Z)
```
This patch is proposed to avoid information loss caused by
https://github.com/llvm/llvm-project/pull/127390.



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