[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
Fri Apr 19 00:01:43 PDT 2024
dtcxzyw wrote:
> @dtcxyzw,
>
> ```c++
> if (IsAShr && matchSelectPattern(Shr->user_back(), Lhs, Rhs).Flavor == SPF_UNKNOWN) {
> ```
>
> After I made some code changes, this line now triggers three times. However, it only returns SPF_SMIN twice. On the third call, Shr->user_back() seems to be behaving unexpectedly, as shown by the following output:
>
> ```
> (lldb) expr Shr->user_back()->dump()
> %cmp4.i = icmp slt i64 %shr, 348732
> ```
>
> Can you help me understand why this discrepancy might be happening?
`%spec.select.i = select i1 %switch.i, i64 %shr, i64 348731` seems to be eliminated. You can pass `-debug-only=instcombine` to opt for more details :)
https://github.com/llvm/llvm-project/pull/83563
More information about the llvm-commits
mailing list