This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR66916


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))))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]