@@ -2528,12 +2528,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
{ neeq == EQ_EXPR ? boolean_false_node : boolean_true_node; })))
/* PR70920: Transform (intptr_t)x eq/ne CST to x eq/ne (typeof x) CST.
- and (typeof ptr_cst) x eq/ne ptr_cst to x eq/ne (typeof x) CST */
+ and (typeof ptr_cst) x eq/ne ptr_cst to x eq/ne (typeof x) CST.
+ Disable the transform if either operand is pointer to function.
+ This broke pr22051-2.c for arm where function pointer
+ canonicalizaion is not wanted. */
+
(for cmp (ne eq)
(simplify
(cmp (convert @0) INTEGER_CST@1)
- (if ((POINTER_TYPE_P (TREE_TYPE (@0)) && INTEGRAL_TYPE_P (TREE_TYPE (@1)))
- || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1))))
+ (if ((POINTER_TYPE_P (TREE_TYPE (@0)) && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@0)))
+ && INTEGRAL_TYPE_P (TREE_TYPE (@1)))
+ || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1))
+ && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@1)))))
(cmp @0 (convert @1)))))
/* Non-equality compare simplifications from fold_binary */