match.pd (simple_comparison): Don't optimize if either operand is a function pointer...
authorJohn David Anglin <danglin@gcc.gnu.org>
Fri, 28 Sep 2018 23:13:10 +0000 (23:13 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Fri, 28 Sep 2018 23:13:10 +0000 (23:13 +0000)
* match.pd (simple_comparison): Don't optimize if either operand is
a function pointer when target needs function pointer canonicalization.

From-SVN: r264705

gcc/ChangeLog
gcc/match.pd

index 0f703f5c0fb5792add779cb61d08c459130fc1a8..7be6ceb3d622059034034fcfd819a9975c8212cc 100644 (file)
@@ -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
index 74244f348a03951cbb4683a00a844d696f90ffad..ae26ec226aca2752ee13e3115bd7c2062de507ac 100644 (file)
@@ -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