+2009-10-28 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41855
+ * tree-ssa-alias.c (refs_may_alias_p_1): Deal with CONST_DECLs
+ (ref_maybe_used_by_call_p_1): Fix bcopy handling.
+ (call_may_clobber_ref_p_1): Likewise.
+ * tree-ssa-structalias.c (find_func_aliases): Likewise.
+ * alias.c (nonoverlapping_memrefs_p): Deal with CONST_DECLs.
+
2009-10-28 Paolo Bonzini <bonzini@gnu.org>
PR rtl-optimization/41812
if (! DECL_P (exprx) || ! DECL_P (expry))
return 0;
+ /* With invalid code we can end up storing into the constant pool.
+ Bail out to avoid ICEing when creating RTL for this.
+ See gfortran.dg/lto/20091028-2_0.f90. */
+ if (TREE_CODE (exprx) == CONST_DECL
+ || TREE_CODE (expry) == CONST_DECL)
+ return 1;
+
rtlx = DECL_RTL (exprx);
rtly = DECL_RTL (expry);
+2009-10-28 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41855
+ * gfortran.dg/lto/20091028-1_0.f90: New testcase.
+ * gfortran.dg/lto/20091028-1_1.c: Likewise.
+ * gfortran.dg/lto/20091028-2_0.f90: Likewise.
+ * gfortran.dg/lto/20091028-2_1.c: Likewise.
+
2009-10-28 Paolo Bonzini <bonzini@gnu.org>
PR rtl-optimization/39715
--- /dev/null
+! { dg-lto-do link }
+! { dg-extra-ld-options "-r -nostdlib -finline-functions" }
+
+SUBROUTINE int_gen_ti_header_char( hdrbuf, hdrbufsize, itypesize, &
+ DataHandle, Element, VarName, Data, code )
+ CALL int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, 1, &
+ DataHandle, DummyData, DummyCount, code )
+END SUBROUTINE int_gen_ti_header_char
+
--- /dev/null
+extern void bcopy(const void *, void *, __SIZE_TYPE__ n);
+char *p;
+int int_gen_ti_header_c_ (char * hdrbuf, int * hdrbufsize,
+ int * itypesize, int * typesize,
+ int * DataHandle, char * Data,
+ int * Count, int * code)
+{
+ bcopy (typesize, p, sizeof(int)) ;
+ bcopy (Data, p, *Count * *typesize) ;
+}
+
--- /dev/null
+! { dg-lto-do link }
+! { dg-extra-ld-options "-r -nostdlib -finline-functions" }
+
+SUBROUTINE int_gen_ti_header_char( hdrbuf, hdrbufsize, itypesize, &
+ DataHandle, Element, VarName, Data, code )
+ CALL int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, 1, &
+ DataHandle, DummyData, DummyCount, code )
+END SUBROUTINE int_gen_ti_header_char
+
--- /dev/null
+extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n);
+char *p;
+int int_gen_ti_header_c_ (char * hdrbuf, int * hdrbufsize,
+ int * itypesize, int * typesize,
+ int * DataHandle, char * Data,
+ int * Count, int * code)
+{
+ memcpy (typesize, p, sizeof(int)) ;
+ memcpy (Data, p, *Count * *typesize) ;
+}
+
|| SSA_VAR_P (ref1->ref)
|| handled_component_p (ref1->ref)
|| INDIRECT_REF_P (ref1->ref)
- || TREE_CODE (ref1->ref) == TARGET_MEM_REF)
+ || TREE_CODE (ref1->ref) == TARGET_MEM_REF
+ || TREE_CODE (ref1->ref) == CONST_DECL)
&& (!ref2->ref
|| SSA_VAR_P (ref2->ref)
|| handled_component_p (ref2->ref)
|| INDIRECT_REF_P (ref2->ref)
- || TREE_CODE (ref2->ref) == TARGET_MEM_REF));
+ || TREE_CODE (ref2->ref) == TARGET_MEM_REF
+ || TREE_CODE (ref2->ref) == CONST_DECL));
/* Decompose the references into their base objects and the access. */
base1 = ao_ref_base (ref1);
which is seen as a struct copy. */
if (TREE_CODE (base1) == SSA_NAME
|| TREE_CODE (base2) == SSA_NAME
+ || TREE_CODE (base1) == CONST_DECL
+ || TREE_CODE (base2) == CONST_DECL
|| is_gimple_min_invariant (base1)
|| is_gimple_min_invariant (base2))
return false;
their first argument. */
case BUILT_IN_STRCPY:
case BUILT_IN_STRNCPY:
- case BUILT_IN_BCOPY:
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMPCPY:
size);
return refs_may_alias_p_1 (&dref, ref, false);
}
+ case BUILT_IN_BCOPY:
+ {
+ ao_ref dref;
+ tree size = gimple_call_arg (call, 2);
+ ao_ref_init_from_ptr_and_size (&dref,
+ gimple_call_arg (call, 0),
+ size);
+ return refs_may_alias_p_1 (&dref, ref, false);
+ }
/* The following builtins do not read from memory. */
case BUILT_IN_FREE:
case BUILT_IN_MEMSET:
their first argument. */
case BUILT_IN_STRCPY:
case BUILT_IN_STRNCPY:
- case BUILT_IN_BCOPY:
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMPCPY:
size);
return refs_may_alias_p_1 (&dref, ref, false);
}
+ case BUILT_IN_BCOPY:
+ {
+ ao_ref dref;
+ tree size = gimple_call_arg (call, 2);
+ ao_ref_init_from_ptr_and_size (&dref,
+ gimple_call_arg (call, 1),
+ size);
+ return refs_may_alias_p_1 (&dref, ref, false);
+ }
/* Freeing memory kills the pointed-to memory. More importantly
the call has to serve as a barrier for moving loads and stores
across it. */
case BUILT_IN_STRNCAT:
{
tree res = gimple_call_lhs (t);
- tree dest = gimple_call_arg (t, 0);
- tree src = gimple_call_arg (t, 1);
+ tree dest = gimple_call_arg (t, (DECL_FUNCTION_CODE (fndecl)
+ == BUILT_IN_BCOPY ? 1 : 0));
+ tree src = gimple_call_arg (t, (DECL_FUNCTION_CODE (fndecl)
+ == BUILT_IN_BCOPY ? 0 : 1));
if (res != NULL_TREE)
{
get_constraint_for (res, &lhsc);