aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-04-17 09:26:50 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-04-17 09:26:50 +0000
commit1691b2e1ca494eee178a70c73c0f941ff27118f6 (patch)
tree37cc3da3b1e49c1cbab2ac01cbed05e03eea3bc1 /gcc
parent302f08072ff5559a762baed4bde399852c0960be (diff)
downloadgcc-1691b2e1ca494eee178a70c73c0f941ff27118f6.zip
gcc-1691b2e1ca494eee178a70c73c0f941ff27118f6.tar.gz
gcc-1691b2e1ca494eee178a70c73c0f941ff27118f6.tar.bz2
Handle internal_fn in operand_equal_p
2015-04-17 Tom de Vries <tom@codesourcery.com> * fold-const.c (operand_equal_p): Handle INTERNAL_FNs. * calls.c (call_expr_flags): Same. From-SVN: r222172
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/calls.c2
-rw-r--r--gcc/fold-const.c23
3 files changed, 26 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b653b58..54c3ccf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2015-04-17 Tom de Vries <tom@codesourcery.com>
+ * fold-const.c (operand_equal_p): Handle INTERNAL_FNs.
+ * calls.c (call_expr_flags): Same.
+
+2015-04-17 Tom de Vries <tom@codesourcery.com>
+
* tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ...
(pass_stdarg::execute): ... here.
diff --git a/gcc/calls.c b/gcc/calls.c
index 32ea4eb..3be7ca5 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -847,6 +847,8 @@ call_expr_flags (const_tree t)
if (decl)
flags = flags_from_decl_or_type (decl);
+ else if (CALL_EXPR_FN (t) == NULL_TREE)
+ flags = internal_fn_flags (CALL_EXPR_IFN (t));
else
{
t = TREE_TYPE (CALL_EXPR_FN (t));
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 6d085b1..3654fd6 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3045,11 +3045,26 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
switch (TREE_CODE (arg0))
{
case CALL_EXPR:
- /* If the CALL_EXPRs call different functions, then they
- clearly can not be equal. */
- if (! operand_equal_p (CALL_EXPR_FN (arg0), CALL_EXPR_FN (arg1),
- flags))
+ if ((CALL_EXPR_FN (arg0) == NULL_TREE)
+ != (CALL_EXPR_FN (arg1) == NULL_TREE))
+ /* If not both CALL_EXPRs are either internal or normal function
+ functions, then they are not equal. */
return 0;
+ else if (CALL_EXPR_FN (arg0) == NULL_TREE)
+ {
+ /* If the CALL_EXPRs call different internal functions, then they
+ are not equal. */
+ if (CALL_EXPR_IFN (arg0) != CALL_EXPR_IFN (arg1))
+ return 0;
+ }
+ else
+ {
+ /* If the CALL_EXPRs call different functions, then they are not
+ equal. */
+ if (! operand_equal_p (CALL_EXPR_FN (arg0), CALL_EXPR_FN (arg1),
+ flags))
+ return 0;
+ }
{
unsigned int cef = call_expr_flags (arg0);