diff mbox

Fix PR66916

Message ID alpine.LSU.2.11.1507230925030.19642@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener July 23, 2015, 7:26 a.m. UTC
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.
diff mbox

Patch

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