* [PATCH] Fix PR87024
@ 2018-08-23 9:27 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2018-08-23 9:27 UTC (permalink / raw)
To: gcc-patches
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
sofar.
Richard.
2018-08-23 Richard Biener <rguenther@suse.de>
PR middle-end/87024
* tree-inline.c (copy_bb): Drop unused __builtin_va_arg_pack_len
calls.
* gcc.dg/pr87024.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr87024.c b/gcc/testsuite/gcc.dg/pr87024.c
new file mode 100644
index 00000000000..a8a58aafc26
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr87024.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-dce" } */
+
+static inline void __attribute__((always_inline))
+mp ()
+{
+ (void) __builtin_va_arg_pack_len ();
+}
+
+void
+ui (void)
+{
+ mp ();
+}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 2b6bb5c0e31..ef615cc347e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1951,7 +1951,13 @@ copy_bb (copy_body_data *id, basic_block bb,
for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p))
nargs--;
- if (!gimple_call_va_arg_pack_p (id->call_stmt))
+ if (!gimple_call_lhs (stmt))
+ {
+ /* Drop unused calls. */
+ gsi_remove (©_gsi, false);
+ continue;
+ }
+ else if (!gimple_call_va_arg_pack_p (id->call_stmt))
{
count = build_int_cst (integer_type_node, nargs);
new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-23 9:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 9:27 [PATCH] Fix PR87024 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).