This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR66916
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Jul 2015 09:26:15 +0200 (CEST)
- Subject: [PATCH] Fix PR66916
- Authentication-results: sourceware.org; auth=none
The following adds a single-use restriction to the widening/sing-change
comparison pattern which fixes PR66916.
Bootstrapped and tested on x86_64-unknown-linux-gnu. Verified the
arm testcase produces expected assembly with a cc1 cross.
Richard.
2015-07-22 Richard Biener <rguenther@suse.de>
PR middle-end/66916
* match.pd: Guard widen and sign-change comparison simplification
with single_use.
Index: gcc/match.pd
===================================================================
--- gcc/match.pd (revision 226042)
+++ gcc/match.pd (working copy)
@@ -1679,7 +1719,8 @@ (define_operator_list CBRT BUILT_IN_CBRT
type on targets that require function pointer canonicalization. */
&& !(targetm.have_canonicalize_funcptr_for_compare ()
&& TREE_CODE (TREE_TYPE (@00)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (@00))) == FUNCTION_TYPE))
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (@00))) == FUNCTION_TYPE)
+ && single_use (@0))
(if (TYPE_PRECISION (TREE_TYPE (@00)) == TYPE_PRECISION (TREE_TYPE (@0))
&& (TREE_CODE (@10) == INTEGER_CST
|| (@1 != @10 && types_match (TREE_TYPE (@10), TREE_TYPE (@00))))