From 60d91c7fae77fe6b7bd50a8b400a045b813e330f Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 23 Aug 2018 09:29:45 +0000 Subject: [PATCH] re PR ipa/87024 (ICE in fold_stmt_1) 2018-08-23 Richard Biener PR middle-end/87024 * tree-inline.c (copy_bb): Drop unused __builtin_va_arg_pack_len calls. * gcc.dg/pr87024.c: New testcase. From-SVN: r263805 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr87024.c | 14 ++++++++++++++ gcc/tree-inline.c | 8 +++++++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr87024.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64e6d8e7b97..89dfeb9f81f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-23 Richard Biener + + PR middle-end/87024 + * tree-inline.c (copy_bb): Drop unused __builtin_va_arg_pack_len + calls. + 2018-08-23 Richard Sandiford * config/aarch64/aarch64.c (aarch64_evpc_sve_tbl): Fix handling diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95fd2e58fe7..bf2295bcdea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-23 Richard Biener + + PR middle-end/87024 + * gcc.dg/pr87024.c: New testcase. + 2018-08-23 Richard Sandiford * gcc.dg/vect/no-vfa-vect-depend-2.c: Remove XFAIL. 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); -- 2.30.2