aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2007-11-29 22:57:38 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2007-11-29 22:57:38 +0100
commitf6f2da7df7acc7f6a9b7425c9e7ad8c304940299 (patch)
tree333a102d3377440a02a26d058160b3f6993e09eb /gcc/tree-inline.c
parent42924ed71f51fd6c33483ca202fc5a1ccff9b770 (diff)
downloadgcc-f6f2da7df7acc7f6a9b7425c9e7ad8c304940299.zip
gcc-f6f2da7df7acc7f6a9b7425c9e7ad8c304940299.tar.gz
gcc-f6f2da7df7acc7f6a9b7425c9e7ad8c304940299.tar.bz2
re PR tree-optimization/33434 (inlining miscompilation)
PR tree-optimization/33434 * tree-inline.c (setup_one_parameter): If the value passed to a parameter is never used, don't set it up. * gcc.dg/pr33434-1.c: New test. * gcc.dg/pr33434-2.c: New test. * gcc.dg/pr33434-3.c: New test. * gcc.dg/pr33434-4.c: New test. From-SVN: r130521
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index e7fba91..1efc0ed 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1508,6 +1508,14 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
return;
}
+ /* If the value of argument is never used, don't care about initializing
+ it. */
+ if (gimple_in_ssa_p (cfun) && !def && is_gimple_reg (p))
+ {
+ gcc_assert (!value || !TREE_SIDE_EFFECTS (value));
+ return;
+ }
+
/* Initialize this VAR_DECL from the equivalent argument. Convert
the argument to the proper type in case it was promoted. */
if (value)