[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 13 00:41:32 PDT 2024
dtcxzyw wrote:
> @aemerson, @dtcxzyw, @goldsteinn Throughout the code review, I noticed an issue caused by `%switch.i = icmp ult i1 %cmp4.i, true`. This part of the code checks `if (TrueVal == CmpLHS && FalseVal == CmpRHS)`, indicating a match that could be handled more effectively with a pattern-matching approach. For example, in the following code snippet:
>
> ```
> %cmp4.i = icmp sgt i64 %shr, 348731
> %switch.i = icmp ult i1 %cmp4.i, true
> %spec.select.i = select i1 %switch.i, i64 %shr, i64 348731
> ```
>
> If we examine the value of `%cmp4.i`, we find that both branches have the same value. This suggests that we only need to handle the middle pattern. I just noticed this and I am not clear on how effective it could be. Could you please provide your insight on this?
cc @nikic
https://github.com/llvm/llvm-project/pull/83563
More information about the llvm-commits
mailing list