aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2018-09-28 23:13:10 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2018-09-28 23:13:10 +0000
commit400bc5261ebde7046e2afd1c064109109ba2c0c1 (patch)
tree059384b0aefedfc865ed804fb2fc1e115a940d55
parent68cf2892dff86ff9b39436932d6c1484a120347f (diff)
downloadgcc-400bc5261ebde7046e2afd1c064109109ba2c0c1.zip
gcc-400bc5261ebde7046e2afd1c064109109ba2c0c1.tar.gz
gcc-400bc5261ebde7046e2afd1c064109109ba2c0c1.tar.bz2
match.pd (simple_comparison): Don't optimize if either operand is a function pointer when...
* match.pd (simple_comparison): Don't optimize if either operand is a function pointer when target needs function pointer canonicalization. From-SVN: r264705
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/match.pd6
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0f703f5..7be6ceb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-28 John David Anglin <danglin@gcc.gnu.org>
+
+ * match.pd (simple_comparison): Don't optimize if either operand is
+ a function pointer when target needs function pointer canonicalization.
+
2018-09-28 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/driver-rs6000.c (asm_names): Adjust the entries for
diff --git a/gcc/match.pd b/gcc/match.pd
index 74244f3..ae26ec2 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3558,8 +3558,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Disable this optimization if we're casting a function pointer
type on targets that require function pointer canonicalization. */
&& !(targetm.have_canonicalize_funcptr_for_compare ()
- && POINTER_TYPE_P (TREE_TYPE (@00))
- && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@00))))
+ && ((POINTER_TYPE_P (TREE_TYPE (@00))
+ && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@00))))
+ || (POINTER_TYPE_P (TREE_TYPE (@10))
+ && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@10))))))
&& single_use (@0))
(if (TYPE_PRECISION (TREE_TYPE (@00)) == TYPE_PRECISION (TREE_TYPE (@0))
&& (TREE_CODE (@10) == INTEGER_CST