>From 34e587f0b09cfe2cc9687c3c4cc578ce1e288389 Mon Sep 17 00:00:00 2001
From: Kael Andrew Alonzo Franco <[email protected]>
Date: Thu, 9 Jul 2026 22:27:52 -0400
Subject: [PATCH 3/3] match: Remove redundant build_one_cst (type) [PR104280]
integer_onep@0 is present, so use @0 instead of build_one_cst (type)
to remove function call.
Bootstrapped and tested on x86_64-pc-linux-gnu.
PR tree-optimization/104280
gcc/ChangeLog:
* match.pd: Remove redundant build_one_cst (type) [PR104280]
Signed-off-by: Kael Franco <[email protected]>
---
gcc/match.pd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/match.pd b/gcc/match.pd
index 85b7fb31b45..0aa7e194ac1 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -632,7 +632,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& !integer_zerop (@1)
&& (!flag_non_call_exceptions || tree_expr_nonzero_p (@1)))
(if (TYPE_UNSIGNED (type))
- (convert (eq:boolean_type_node @1 { build_one_cst (type); }))
+ (convert (eq:boolean_type_node @1 @0))
(if (fold_before_rtl_expansion_p ())
(with { tree utype = unsigned_type_for (type); }
(cond (le (plus (convert:utype @1) { build_one_cst (utype); })
--
2.55.0
On Fri, Jul 10, 2026 at 12:20 PM Kael Andrew Franco <[email protected]>
wrote:
> From 9a935c7173902d3294f6e19214b492dc47a8ff35 Mon Sep 17 00:00:00 2001
> From: Kael Andrew Alonzo Franco <[email protected]>
> Date: Thu, 9 Jul 2026 22:09:19 -0400
> Subject: [PATCH 2/3] match: Remove redundant build_zero_cst (type) [PR114009]
>
> Since PR114009 simplify patterns have integer_zerop, integer_zerop@2 can be
> used
> instead of build_zero_cst (type) to remove function call.
>
> Bootstrapped and tested on x86_64-pc-linux-gnu.
>
> PR tree-optimization/114009
>
> gcc/ChangeLog:
>
> * match.pd: Remove redundant build_zero_cst (type) [PR114009]
>
> Signed-off-by: Kael Franco <[email protected]>
> ---
> gcc/match.pd | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index cbf023e07fa..85b7fb31b45 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -1328,14 +1328,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>
> /* Fold a * !a into 0. */
> (simplify
> - (mult:c @0 (convert? (eq @0 integer_zerop)))
> - { build_zero_cst (type); })
> + (mult:c @0 (convert? (eq @0 integer_zerop@2)))
> + @2)
> (simplify
> - (mult:c @0 (vec_cond (eq @0 integer_zerop) @1 integer_zerop))
> - { build_zero_cst (type); })
> + (mult:c @0 (vec_cond (eq @0 integer_zerop) @1 integer_zerop@2))
> + @2)
> (simplify
> - (mult:c @0 (vec_cond (ne @0 integer_zerop) integer_zerop @1))
> - { build_zero_cst (type); })
> + (mult:c @0 (vec_cond (ne @0 integer_zerop) integer_zerop@2 @1))
> + @2)
>
> /* Shifts by precision or greater result in zero. */
> (for shift (lshift rshift)
> --
> 2.55.0
>
>