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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 07:20:35 PDT 2023


nikic added a comment.

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.


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

https://reviews.llvm.org/D148420



More information about the llvm-commits mailing list