[gcc(refs/vendors/ARM/heads/arm-struct-reorg-wip)] tree: Fix up TREE_SIDE_EFFECTS on internal calls [PR94809]

Tamar Christina tnfchris@gcc.gnu.org
Fri Jul 17 14:49:23 GMT 2020


https://gcc.gnu.org/g:34f6b14ff33e0c64b3a4a1a2cd871df715d69151

commit 34f6b14ff33e0c64b3a4a1a2cd871df715d69151
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 28 11:26:56 2020 +0200

    tree: Fix up TREE_SIDE_EFFECTS on internal calls [PR94809]
    
    On the following testcase, match.pd during GENERIC folding
    changes the -1U / x < y into __imag__ .MUL_OVERFLOW (x, y),
    but unfortunately unlike for normal calls nothing sets TREE_SIDE_EFFECTS on
    the call.  There is the process_call_operands function that non-internal
    call creation calls and it is usable for internal calls too,
    e.g. TREE_SIDE_EFFECTS is derived from checking whether the
    call has side-effects (non-ECF_{CONST,PURE}; we have those for internal
    calls) and from whether any of the arguments has TREE_SIDE_EFFECTS.
    
    2020-04-28  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/94809
            * tree.c (build_call_expr_internal_loc_array): Call
            process_call_operands.
    
            * gcc.c-torture/execute/pr94809.c: New test.

Diff:
---
 gcc/ChangeLog                                 | 10 ++++++++--
 gcc/testsuite/ChangeLog                       |  5 +++++
 gcc/testsuite/gcc.c-torture/execute/pr94809.c | 12 ++++++++++++
 gcc/tree.c                                    |  1 +
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7d8fb273776..d8b753d8bf1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,10 @@
-2020-04-27 Anton Youdkevitch <anton.youdkevitch@bell-sw.com>
+2020-04-28  Jakub Jelinek  <jakub@redhat.com>
+
+	PR tree-optimization/94809
+	* tree.c (build_call_expr_internal_loc_array): Call
+	process_call_operands.
+
+2020-04-27  Anton Youdkevitch  <anton.youdkevitch@bell-sw.com>
 
 	* config/aarch64/aarch64-cores.def (thunderx3t110): Add the chip name.
 	* config/aarch64/aarch64-tune.md: Regenerate.
@@ -7,7 +13,7 @@
 	(thunderx3t110_vector_cost): Likewise.
 	(thunderx3t110_prefetch_tune): Likewise.
 	(thunderx3t110_tunings): Likewise.
-	* gcc/config/aarch64/aarch64-cost-tables.h (thunderx3t110_extra_costs):
+	* config/aarch64/aarch64-cost-tables.h (thunderx3t110_extra_costs):
 	Define.
 	* config/aarch64/thunderx3t110.md: New file.
 	* config/aarch64/aarch64.md: Include thunderx3t110.md.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 77f56c1f90a..e94c09cef7b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-28  Jakub Jelinek  <jakub@redhat.com>
+
+	PR tree-optimization/94809
+	* gcc.c-torture/execute/pr94809.c: New test.
+
 2020-04-28  Iain Sandoe  <iain@sandoe.co.uk>
 
 	PR c++/94760
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr94809.c b/gcc/testsuite/gcc.c-torture/execute/pr94809.c
new file mode 100644
index 00000000000..ce55e8f92d4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr94809.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/94809 */
+
+int
+main ()
+{
+  int a = 0;
+  unsigned long long one = 1;
+  ((-1ULL / one) < a++, one);
+  if (a != 1)
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index da6b8e20eda..e28b29580ca 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11523,6 +11523,7 @@ build_call_expr_internal_loc_array (location_t loc, internal_fn ifn,
     CALL_EXPR_ARG (t, i) = args[i];
   SET_EXPR_LOCATION (t, loc);
   CALL_EXPR_IFN (t) = ifn;
+  process_call_operands (t);
   return t;
 }


More information about the Gcc-cvs mailing list