[mlir][index] Fold `cmp(max/min(x, cstA), cstB)`
This is a case that is not picked up by integer range inference and suggests a weakness with integer range inference on the index dialect. The problem is that when `[1, SMAX_64]` is truncated to 32 bits, the resulting range could be `[SMIN_32, SMAX_32]`, making the subsequent comparison worthless. This is because integer range inference doesn't know that the result of the max/min inference also changes based on the bitwidth, and doing the truncation locally at the input of the comparison op loses that information. This also was a pattern that frequently showed up in our code, so adding it as a folder allows dead code to be pruned more frequently. Depends on D153731 Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D153732
Loading
Please sign in to comment