[CVP] @llvm.[us]{min,max}() intrinsics handling
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 10 Apr 2021 21:23:27 +0000 (00:23 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 10 Apr 2021 21:33:47 +0000 (00:33 +0300)
commit9829f5e6b1bca9b61efc629770d28bb9014dec45
tree7f5e54ff035291efc4cbf76e3df9f69e0fcf1ccc
parentd610f051045163f781ebc6da2e97414deafecd1e
[CVP] @llvm.[us]{min,max}() intrinsics handling

If we can tell that either one of the arguments is taken,
bypass the intrinsic.

Notably, we are indeed fine with non-strict predicate:
* UL: https://alive2.llvm.org/ce/z/69qVW9 https://alive2.llvm.org/ce/z/kNFTKf
      https://alive2.llvm.org/ce/z/AvaPw2 https://alive2.llvm.org/ce/z/oxo53i
* UG: https://alive2.llvm.org/ce/z/wxHeGH https://alive2.llvm.org/ce/z/Lf76qx
* SL: https://alive2.llvm.org/ce/z/hkeTGS https://alive2.llvm.org/ce/z/eR_b-W
* SG: https://alive2.llvm.org/ce/z/wEqRm7 https://alive2.llvm.org/ce/z/FpAsVr

Much like with all other comparison handling in CVP,
while we could sort-of handle two Value's,
at least for plain ICmpInst it does not appear to be worthwhile.

This only fires 78 times on test-suite + dt + rs,
but we don't canonicalize to these yet. (only SCEV produces them)
llvm/include/llvm/Analysis/LazyValueInfo.h
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
llvm/test/Transforms/CorrelatedValuePropagation/min-max.ll