Fold ashr-exact into a icmp-ugt.
This commit optimizes the code sequence: icmp-XXX (ashr-exact (X, C_1), C_2). Instcombine already implements this optimization for sgt, and this patch adds support to additional predicates. The transformation is legal for all predicates if the 'exact' flag is set, and to SGE, UGE, SLT, ULT when the exact flag is not present. This pattern is found in the std::vector bounds checks code of the at() method. Alive2 proof: https://alive2.llvm.org/ce/z/JT_WL8 Differential Revision: https://reviews.llvm.org/D117252
Loading
Please sign in to comment