aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-11-28 12:26:50 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-11-28 12:26:50 +0000
commit68578d6efa09a5e5d3e7eca4de48f03b21f701c0 (patch)
tree4a1bdee96188de03b1806cdaee39d144f5802f3a /gcc
parent78307657cf9675bc4aa2e77561c823834714b4c8 (diff)
downloadgcc-68578d6efa09a5e5d3e7eca4de48f03b21f701c0.zip
gcc-68578d6efa09a5e5d3e7eca4de48f03b21f701c0.tar.gz
gcc-68578d6efa09a5e5d3e7eca4de48f03b21f701c0.tar.bz2
re PR tree-optimization/92645 (Hand written vector code is 450 times slower when compiled with GCC compared to Clang)
2019-11-28 Richard Biener <rguenther@suse.de> PR tree-optimization/92645 * tree-inline.c (remap_gimple_stmt): When the return value is not wanted, elide GIMPLE_RETURN. * gcc.dg/tree-ssa/inline-12.c: New testcase. From-SVN: r278807
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/inline-12.c22
-rw-r--r--gcc/tree-inline.c5
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d4a66fd..fe76b3e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,12 @@
2019-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/92645
+ * tree-inline.c (remap_gimple_stmt): When the return value
+ is not wanted, elide GIMPLE_RETURN.
+
+2019-11-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/92645
* tree-ssa-forwprop.c (get_bit_field_ref_def): Also handle
conversions inside a mode class. Remove restriction on
preserving the element size.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a0fdcd5..a753383 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,11 @@
2019-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/92645
+ * gcc.dg/tree-ssa/inline-12.c: New testcase.
+
+2019-11-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/92645
* gcc.target/i386/pr92645-4.c: New testcase.
2019-11-28 Christophe Lyon <christophe.lyon@linaro.org>
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-12.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-12.c
new file mode 100644
index 0000000..250d77e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-12.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-einline" } */
+
+void *foo (void *, int);
+static inline void *mcp (void *src, int i)
+{
+ return foo (src, i);
+}
+void bar()
+{
+ int i;
+ mcp (&i, 0);
+}
+
+/* There should be exactly two assignments, one for both
+ the original foo call and the inlined copy (plus a clobber
+ that doesn't match here). In particular bar should look like
+ <bb 2> :
+ _4 = foo (&i, 0);
+ i ={v} {CLOBBER};
+ return; */
+/* { dg-final { scan-tree-dump-times " = " 2 "einline" } } */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index eecf5c6..720f50e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1541,9 +1541,12 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
assignment to the equivalent of the original RESULT_DECL.
If RETVAL is just the result decl, the result decl has
already been set (e.g. a recent "foo (&result_decl, ...)");
- just toss the entire GIMPLE_RETURN. */
+ just toss the entire GIMPLE_RETURN. Likewise for when the
+ call doesn't want the return value. */
if (retval
&& (TREE_CODE (retval) != RESULT_DECL
+ && (!id->call_stmt
+ || gimple_call_lhs (id->call_stmt) != NULL_TREE)
&& (TREE_CODE (retval) != SSA_NAME
|| ! SSA_NAME_VAR (retval)
|| TREE_CODE (SSA_NAME_VAR (retval)) != RESULT_DECL)))