[llvm-commits] [llvm-gcc-4.2] r53105 - /llvm-gcc-4.2/trunk/gcc/tree-inline.c
Dale Johannesen
dalej at apple.com
Thu Jul 3 10:30:45 PDT 2008
Author: johannes
Date: Thu Jul 3 12:30:32 2008
New Revision: 53105
URL: http://llvm.org/viewvc/llvm-project?rev=53105&view=rev
Log:
Fix a bug in gcc's inliner; wasn't remapping
the type of parameters with variably modified types,
which refer to variables elsewhere in the callee;
the references need to be remapped. This caused
incorrect codegen with llvm, but not gcc, because
of our greater use of array notation.
gcc.c-torture/execute/pr22061-1.c
Modified:
llvm-gcc-4.2/trunk/gcc/tree-inline.c
Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-inline.c?rev=53105&r1=53104&r2=53105&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-inline.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-inline.c Thu Jul 3 12:30:32 2008
@@ -1022,8 +1022,11 @@
/* If the parameter is never assigned to, we may not need to
create a new variable here at all. Instead, we may be able
to just use the argument value. */
+/* LLVM LOCAL begin fix handling of parameters with variably modified types */
+ /* We need the copy if it has a variably modified type. */
if (TREE_READONLY (p)
&& !TREE_ADDRESSABLE (p)
+ && !variably_modified_type_p (TREE_TYPE (p), id->src_fn)
&& value && !TREE_SIDE_EFFECTS (value))
{
/* We may produce non-gimple trees by adding NOPs or introduce
@@ -1049,6 +1052,13 @@
function. */
var = copy_decl_to_var (p, id);
+ /* But, we must remap variably modified types, which depend on local
+ variables in this function and are NOT visible to the calling
+ function. */
+ if (variably_modified_type_p (TREE_TYPE (p), id->src_fn))
+ TREE_TYPE (var) = remap_type(TREE_TYPE (p), id);
+/* LLVM LOCAL end fix handling of parameters with variably modified types */
+
/* See if the frontend wants to pass this by invisible reference. If
so, our new VAR_DECL will have REFERENCE_TYPE, and we need to
replace uses of the PARM_DECL with dereferences. */
More information about the llvm-commits
mailing list