[PATCH] D148420: [InstSimplify] Enhance select icmp and simplification

Peixin Qiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 18:03:18 PDT 2023


peixin added a comment.

In D148420#4315381 <https://reviews.llvm.org/D148420#4315381>, @nikic wrote:

> Just took a closer look at this. This is one of those transforms where we need to be very careful about derefinement, because we're replacing a constant `0` with an instruction that (under the given condition) may refine to zero but is not necessarily equivalent to zero.
>
> In particular, if the `shl` has nowrap flags, this transform is incorrect: https://alive2.llvm.org/ce/z/EjBRVW
>
> This means we need to drop nowrap flags as part of the transform. I'm afraid this means that my original recommendation to move this to InstSimplify was wrong and this should be in InstCombine after all, as we can only drop nowrap flags there.

@nikic Thanks for the notice. I was on vacation and just came back today. I will continue this work.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148420/new/

https://reviews.llvm.org/D148420



More information about the llvm-commits mailing list