[llvm] [InstCombine] Fix fail to fold (A >> C1) Pred C2 if shr is used multple times #83430 (PR #83563)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 3 07:52:52 PST 2024


================
@@ -10,7 +10,8 @@ define i64 @dont_break_minmax_i64(i64 %conv, i64 %conv2) {
 ; CHECK-SAME: (i64 [[CONV:%.*]], i64 [[CONV2:%.*]]) {
 ; CHECK-NEXT:    [[MUL:%.*]] = mul nsw i64 [[CONV]], [[CONV2]]
 ; CHECK-NEXT:    [[SHR:%.*]] = ashr i64 [[MUL]], 4
-; CHECK-NEXT:    [[SPEC_SELECT_I:%.*]] = call i64 @llvm.smin.i64(i64 [[SHR]], i64 348731)
+; CHECK-NEXT:    [[CMP4_I:%.*]] = icmp slt i64 [[MUL]], 5579712
----------------
SahilPatidar wrote:

When I executed `matchSelectPattern(Shr->user_back(), Lhs, Rhs).Flavor == SPF_UNKNOWN` within the function, it produced an `SPF_UNKNOWN` output for the `dont_break_minmax` test on this code snippet.

https://github.com/llvm/llvm-project/pull/83563


More information about the llvm-commits mailing list