* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130521
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-11-29 Jan Hubicka <jh@suse.cz>
+ Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2007-11-29 Jakub Jelinek <jakub@redhat.com>
PR target/32130
2007-11-29 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/33434
+ * 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.
+
PR c++/34270
* g++.dg/template/cond7.C: New test.
--- /dev/null
+/* PR tree-optimization/33434 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int k;
+
+void f1 (int a, int b)
+{
+ a = 1;
+ b = 1;
+ if (a)
+ while (b --)
+ k = 1;
+ else
+ if (b != 1)
+ __builtin_abort ();
+}
+
+int main (void)
+{
+ f1 (1, 1);
+ if (k != 1)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR tree-optimization/33434 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int k;
+
+void f1 (int a)
+{
+ int b;
+ a = 1;
+ b = 1;
+ if (a)
+ while (b --)
+ k = 1;
+ else
+ if (b != 1)
+ __builtin_abort ();
+}
+
+int main (void)
+{
+ f1 (1);
+ if (k != 1)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR tree-optimization/33434 */
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+int k;
+
+void __attribute__((noinline)) f2 (int b)
+{
+ k = b - 1;
+}
+
+void f1 (int a, int b)
+{
+ f2 (b);
+ a = 1;
+ b = 1;
+ if (a)
+ while (b --)
+ k = 1;
+ else
+ if (b != 1)
+ __builtin_abort ();
+}
+
+int main (void)
+{
+ f1 (1, 1);
+ if (k != 1)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR tree-optimization/33434 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void *baz (void);
+
+static void *
+bar (void *x)
+{
+ x = baz ();
+ return x;
+}
+
+void *
+foo (void *x)
+{
+ return bar (x);
+}
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)