[llvm] [InstCombine] Remove some of the complexity-based canonicalization (PR #91185)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 08:28:31 PDT 2024


================
@@ -3286,8 +3286,11 @@ define i32 @add_reduce_sqr_sum_flipped(i32 %a, i32 %b) {
 
 define i32 @add_reduce_sqr_sum_flipped2(i32 %a, i32 %b) {
 ; CHECK-LABEL: @add_reduce_sqr_sum_flipped2(
-; CHECK-NEXT:    [[TMP1:%.*]] = add i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    [[ADD:%.*]] = mul i32 [[TMP1]], [[TMP1]]
+; CHECK-NEXT:    [[A_SQ:%.*]] = mul nsw i32 [[A:%.*]], [[A]]
+; CHECK-NEXT:    [[TWO_A:%.*]] = shl i32 [[A]], 1
+; CHECK-NEXT:    [[TWO_A_PLUS_B:%.*]] = add i32 [[TWO_A]], [[B:%.*]]
+; CHECK-NEXT:    [[MUL:%.*]] = mul i32 [[B]], [[TWO_A_PLUS_B]]
+; CHECK-NEXT:    [[ADD:%.*]] = add i32 [[MUL]], [[A_SQ]]
----------------
goldsteinn wrote:

regression + below

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


More information about the llvm-commits mailing list