This is the mail archive of the
mailing list for the GCC project.
Re: [RFA][PATCH] Minor fix to aliasing machinery
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 29 Oct 2013 23:23:55 +0100 (CET)
- Subject: Re: [RFA][PATCH] Minor fix to aliasing machinery
- Authentication-results: sourceware.org; auth=none
- References: <52702A5D dot 6030101 at redhat dot com>
On Tue, 29 Oct 2013, Jeff Law wrote:
Marc pointed out that the handling of various BUILT_IN_MEM* and BUILT_IN_STR*
functions in tree-ssa-alias.c probably wasn't working as intended because the
code wasn't prepared for a common return value from ao_ref_base, particularly
returns of MEM_REFs.
Hmm, ao_ref_base is never a pointer, so I'd say the issue is really with
trying to use the SSA_NAME directly.
This patch fixes the code to handle the trivial case of returning a MEM_REF
and adds a simple testcase. There's probably a lot more that could be done
I am not sure we want to keep the variable "base" that is either a
decl/ref (from get_addr_base_and_unit_offset) or a pointer (dest). We know
which case is which, but then forget it by storing both into base. Maybe
something like this would be more "type-safe".
bool same = false;
if (TREE_CODE (dest) == ADDR_EXPR)
same = (ref_base == get_addr_base_and_unit_offset
(TREE_OPERAND (dest, 0), &offset));
else if (TREE_CODE (dest) == SSA_NAME
&& TREE_CODE (ref_base) == MEM_REF)
same = (TREE_OPERAND (ref_base, 0) == dest);
By the way, I think the patch is fine as is, I am only discussing possible
(see http://gcc.gnu.org/ml/gcc-patches/2013-10/txto0PQEYpiuz.txt for
another approach using ao_ref_init_from_ptr_and_size)