[llvm] [InstCombine] Factorise Add and Min/Max using Distributivity (PR #101717)
Jorge Botto via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 13:05:28 PDT 2024
================
@@ -0,0 +1,539 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=instcombine < %s 2>&1 | FileCheck %s
+
+
+define i8 @umax_of_add_nuw(i8 %a, i8 %b, i8 %c) {
+; CHECK-LABEL: define i8 @umax_of_add_nuw(
+; CHECK-SAME: i8 [[A:%.*]], i8 [[B:%.*]], i8 [[C:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.umax.i8(i8 [[B]], i8 [[C]])
+; CHECK-NEXT: [[MAX:%.*]] = add nuw i8 [[TMP1]], [[A]]
+; CHECK-NEXT: ret i8 [[MAX]]
+;
+ %add1 = add nuw i8 %b, %a ; thwart complexity-based canonicalization
----------------
jf-botto wrote:
I've removed them.
https://github.com/llvm/llvm-project/pull/101717
More information about the llvm-commits
mailing list