[llvm] [InstCombine] Fix fail to fold (A >> C1) Pred C2 if shr is used multple times #83430 (PR #83563)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 20 01:57:45 PDT 2024


dtcxzyw wrote:

After the second iteration:
```
%shr = ashr i64 %mul, 4
%cmp4.i = icmp slt i64 %shr, 348732
%spec.select.i = select i1 %cmp4.i, i64 %shr, i64 348731
```
As `%shr` has multiple users, the result of `Shr->user_back()` is undetermined. Can you try `all_of(Shr->users(), [] (User* U) {return matchSelectPattern(U, Lhs, Rhs).Flavor == SPF_UNKNOWN;})`?


https://github.com/llvm/llvm-project/pull/83563


More information about the llvm-commits mailing list