From c5b65d9b7c4096fc5e6077a1e6561c96212a7cd4 Mon Sep 17 00:00:00 2001 From: hubicka Date: Mon, 12 Oct 2015 05:26:47 +0000 Subject: [PATCH] * fold-const.c (fold_comparsion): Pass OEP_ADDRESS_OF when comparing addresses. (fold_addr_of_array_ref_difference): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228701 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eff9eeaea04..7ba2cf9cf65 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-10-11 Jan Hubicka + + * fold-const.c (fold_comparsion): Pass OEP_ADDRESS_OF when comparing + addresses. + (fold_addr_of_array_ref_difference): Likewise. + 2015-10-11 Jeff Law * tree-ssa-threadedge.c (fsm_find_thread_path): Moved from here into diff --git a/gcc/fold-const.c b/gcc/fold-const.c index bdfda9a3cdc..de45a2cf477 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8426,7 +8426,8 @@ fold_comparison (location_t loc, enum tree_code code, tree type, /* If we have equivalent bases we might be able to simplify. */ if (indirect_base0 == indirect_base1 - && operand_equal_p (base0, base1, 0)) + && operand_equal_p (base0, base1, + indirect_base0 ? OEP_ADDRESS_OF : 0)) { /* We can fold this expression to a constant if the non-constant offset parts are equal. */ @@ -8846,7 +8847,7 @@ fold_addr_of_array_ref_difference (location_t loc, tree type, && (base_offset = fold_binary_loc (loc, MINUS_EXPR, type, TREE_OPERAND (base0, 0), TREE_OPERAND (base1, 0)))) - || operand_equal_p (base0, base1, 0)) + || operand_equal_p (base0, base1, OEP_ADDRESS_OF)) { tree op0 = fold_convert_loc (loc, type, TREE_OPERAND (aref0, 1)); tree op1 = fold_convert_loc (loc, type, TREE_OPERAND (aref1, 1)); -- 2.11.4.GIT