aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-11-15 13:44:34 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-11-15 13:44:34 +0000
commit0e02fb26381e7c8a4766eb0e29c325b5ef6917f9 (patch)
tree847f652b13c72a623572026c35b54afecacf9801 /gcc
parent22692f3ce9d00eac18d5582de90dda5ae5c07c77 (diff)
downloadgcc-0e02fb26381e7c8a4766eb0e29c325b5ef6917f9.zip
gcc-0e02fb26381e7c8a4766eb0e29c325b5ef6917f9.tar.gz
gcc-0e02fb26381e7c8a4766eb0e29c325b5ef6917f9.tar.bz2
re PR tree-optimization/88029 (ICE in execute_todo, at passes.c:1974)
2018-11-15 Richard Biener <rguenther@suse.de> PR middle-end/88029 * gimple.c (gimple_call_flags): Union flags from decl, type and call fntype. * trans-mem.c (is_tm_pure_call): Simplify. * gcc.dg/tree-ssa/pr88029.c: New testcase. From-SVN: r266183
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/gimple.c14
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr88029.c14
-rw-r--r--gcc/trans-mem.c15
5 files changed, 35 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index df86323..f60b321 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2018-11-15 Richard Biener <rguenther@suse.de>
+ PR middle-end/88029
+ * gimple.c (gimple_call_flags): Union flags from decl, type
+ and call fntype.
+ * trans-mem.c (is_tm_pure_call): Simplify.
+
+2018-11-15 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/88031
* tree-vect-loop.c (vectorizable_reduction): Move check
for multiple types earlier so we get the expected dump.
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 41d9f67..23ccbae 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1446,15 +1446,17 @@ gimple_call_same_target_p (const gimple *c1, const gimple *c2)
int
gimple_call_flags (const gimple *stmt)
{
- int flags;
- tree decl = gimple_call_fndecl (stmt);
+ int flags = 0;
- if (decl)
- flags = flags_from_decl_or_type (decl);
- else if (gimple_call_internal_p (stmt))
+ if (gimple_call_internal_p (stmt))
flags = internal_fn_flags (gimple_call_internal_fn (stmt));
else
- flags = flags_from_decl_or_type (gimple_call_fntype (stmt));
+ {
+ tree decl = gimple_call_fndecl (stmt);
+ if (decl)
+ flags = flags_from_decl_or_type (decl);
+ flags |= flags_from_decl_or_type (gimple_call_fntype (stmt));
+ }
if (stmt->subcode & GF_CALL_NOTHROW)
flags |= ECF_NOTHROW;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ee0d920..c947fa9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2018-11-15 Richard Biener <rguenther@suse.de>
+ PR middle-end/88029
+ * gcc.dg/tree-ssa/pr88029.c: New testcase.
+
+2018-11-15 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/88031
* gcc.dg/pr88031.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr88029.c b/gcc/testsuite/gcc.dg/tree-ssa/pr88029.c
new file mode 100644
index 0000000..c169dd5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr88029.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -w -fdump-tree-fre1-vops" } */
+
+double foo (double) __attribute__ ((pure));
+double (*fp) (double) __attribute__ ((const));
+double f(double a)
+{
+ fp = foo;
+ /* Verify when propagating foo to the call we preserve its constness. */
+ return fp (a);
+}
+
+/* { dg-final { scan-tree-dump "foo \\(a" "fre1" } } */
+/* { dg-final { scan-tree-dump-times "VUSE" 1 "fre1" } } */
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 938f4e2..bb7146b 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -265,20 +265,7 @@ is_tm_safe (const_tree x)
static bool
is_tm_pure_call (gimple *call)
{
- if (gimple_call_internal_p (call))
- return (gimple_call_flags (call) & (ECF_CONST | ECF_TM_PURE)) != 0;
-
- tree fn = gimple_call_fn (call);
-
- if (TREE_CODE (fn) == ADDR_EXPR)
- {
- fn = TREE_OPERAND (fn, 0);
- gcc_assert (TREE_CODE (fn) == FUNCTION_DECL);
- }
- else
- fn = TREE_TYPE (fn);
-
- return is_tm_pure (fn);
+ return (gimple_call_flags (call) & (ECF_CONST | ECF_TM_PURE)) != 0;
}
/* Return true if X has been marked TM_CALLABLE. */