aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-02-19 09:38:52 +0100
committerRichard Biener <rguenther@suse.de>2021-02-19 14:20:24 +0100
commit1a2a7096e5e20d736c6138179470b21aa5a74864 (patch)
treef7d3cbfeef170dce8f20c78ac5b770671ebf5545 /gcc/tree-inline.c
parent1a132c4d7cdb22cbab85b8596418daa2c3157812 (diff)
downloadgcc-1a2a7096e5e20d736c6138179470b21aa5a74864.zip
gcc-1a2a7096e5e20d736c6138179470b21aa5a74864.tar.gz
gcc-1a2a7096e5e20d736c6138179470b21aa5a74864.tar.bz2
middle-end/99122 - more VLA inlining fixes
This avoids declaring a function with VLA arguments or return values as inlineable. IPA CP still ICEs, so the testcase has that disabled. 2021-02-19 Richard Biener <rguenther@suse.de> PR middle-end/99122 * tree-inline.c (inline_forbidden_p): Do not inline functions with VLA arguments or return value. * gcc.dg/pr99122-3.c: New testcase.
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 01a08cf..c993b1f 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4022,6 +4022,16 @@ inline_forbidden_p (tree fndecl)
wi.info = (void *) fndecl;
wi.pset = &visited_nodes;
+ /* We cannot inline a function with a VLA typed argument or result since
+ we have no implementation materializing a variable of such type in
+ the caller. */
+ if (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
+ && !poly_int_tree_p (TYPE_SIZE (TREE_TYPE (TREE_TYPE (fndecl)))))
+ return true;
+ for (tree parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm))
+ if (!poly_int_tree_p (DECL_SIZE (parm)))
+ return true;
+
FOR_EACH_BB_FN (bb, fun)
{
gimple *ret;