[PATCH] D26091: [ValueTracking] recognize more variants of smin/smax

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 29 08:45:49 PDT 2016


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/max-of-nots.ll:143
 ; CHECK-LABEL: @max_of_min_swap(
-; CHECK-NEXT:    [[NOT_A:%.*]] = xor i32 %a, -1
-; CHECK-NEXT:    [[C0:%.*]] = icmp slt i32 %a, 0
-; CHECK-NEXT:    [[S0:%.*]] = select i1 [[C0]], i32 -1, i32 [[NOT_A]]
-; CHECK-NEXT:    [[C1:%.*]] = icmp sgt i32 [[S0]], -1
-; CHECK-NEXT:    [[S1:%.*]] = select i1 [[C1]], i32 [[S0]], i32 -1
-; CHECK-NEXT:    ret i32 [[S1]]
+; CHECK-NEXT:    ret i32 -1
 ;
----------------
efriedma wrote:
> Is there really no better way to write a testcase for this?  I guess there are a limited number of transforms which use min/max formation, but this seems awkward.
Agree - I thought it was best to add to the existing IR test, and I assumed there wasn't a better instcombine way to expose this.

However, as shown in the related D26096, we can see the difference in vector codegen with the minimal IR patterns. Let me add similar tests here. I still think it's best if we keep these instcombine tests for bonus coverage though, but let me know if you think that's overkill.

Thanks for the prompt review!


https://reviews.llvm.org/D26091





More information about the llvm-commits mailing list