tree-optimization/97357 - avoid abnormals in loop splitting conditions
authorRichard Biener <rguenther@suse.de>
Mon, 12 Oct 2020 06:51:05 +0000 (08:51 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 12 Oct 2020 08:27:27 +0000 (10:27 +0200)
This avoids abnormals in another place.

2020-10-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97357
* tree-ssa-loop-split.c (ssa_semi_invariant_p): Abnormal
SSA names are not semi invariant.

* gcc.dg/pr97357.c: New testcase.

gcc/testsuite/gcc.dg/pr97357.c [new file with mode: 0644]
gcc/tree-ssa-loop-split.c

diff --git a/gcc/testsuite/gcc.dg/pr97357.c b/gcc/testsuite/gcc.dg/pr97357.c
new file mode 100644 (file)
index 0000000..2b32d13
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-require-effective-target indirect_jumps } */
+
+#include <setjmp.h>
+#include <stdlib.h>
+
+void * my_malloc (size_t size);
+
+typedef struct glk {
+  struct glk *nxt;
+} glk;
+
+typedef struct Lock
+{
+ glk ByteLock;
+} Lock;
+
+static Lock *l, *lk;
+
+void bytelocks(glk *rethead, jmp_buf jb)
+{
+  glk *cur, *cur_lk;
+
+  if (( _setjmp (jb)) == 0)
+    for (cur = &l->ByteLock; cur != ((glk *)0) ; cur = (cur)->nxt)
+        for (cur_lk = &lk->ByteLock; cur_lk != ((glk *)0); cur_lk = cur_lk->nxt)
+          {
+            glk *retrng;
+
+            if(!rethead)
+              rethead = (glk *) my_malloc (sizeof(glk));
+            retrng = (glk *) my_malloc (sizeof(glk));
+
+            retrng->nxt = rethead;
+          }
+
+ return;
+}
index 1eb6be5ddb24be6e73237ae19ea1c57da15565a8..46ee7c0fc14592ff2cbeeb9fea47733eeda14db1 100644 (file)
@@ -977,6 +977,9 @@ ssa_semi_invariant_p (struct loop *loop, tree name,
   if (!def_bb || !flow_bb_inside_loop_p (loop, def_bb))
     return true;
 
+  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))
+    return false;
+
   return stmt_semi_invariant_p_1 (loop, def, skip_head, stmt_stat);
 }