[all-commits] [llvm/llvm-project] 5e2dcf: [InstCombine] Avoid infinite loop in `foldSelectVa...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Wed Jun 4 04:43:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5e2dcfe42cd4af14d6e6155314aa5d4167710b65
      https://github.com/llvm/llvm-project/commit/5e2dcfe42cd4af14d6e6155314aa5d4167710b65
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-06-04 (Wed, 04 Jun 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-cmp-eq-op-fold.ll

  Log Message:
  -----------
  [InstCombine] Avoid infinite loop in `foldSelectValueEquivalence` (#142754)

Before this patch, InstCombine hung because it replaced a value with a
more complex one:
```
%sel = select i1 %cmp, i32 %smax, i32 0 ->
%sel = select i1 %cmp, i32 %masked, i32 0 ->
%sel = select i1 %cmp, i32 %smax, i32 0 ->
...
```
This patch makes this replacement more conservative. It only performs
the replacement iff the new value is one of the operands of the original
value.

Closes https://github.com/llvm/llvm-project/issues/142405.



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