[PATCH] temporary revert commit 11b1a83b d7985338 cause deadloop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Stefaniuc report that sparse deadloop on one of the
wine source file. The minimal test case to reproduced the
deadloop has been add to validation as "kill-unreachable-phi.c".

The change that introduce the deadloop can be trace back to
11b1a83b "fix OP_PHI usage in try_to_simplify_bb()" and later
d7985338 "fix OP_PHI usage in try_to_simplify_bb() only when non-bogus"

Temporary revert the change to avoid the deadloop.

The revert cause one of the test case fail because some phi
related optimization was not done. I set that test case to
known to fail.

Reported-by: Michael Stefaniuc <mstefani@xxxxxxxxxxx>
Signed-off-by: Christopher Li <sparse@xxxxxxxxxxx>
---
 flow.c                            | 16 +++++++---------
 validation/kill-phi-ttsbb.c       |  1 +
 validation/kill-unreachable-phi.c | 27 +++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 9 deletions(-)
 create mode 100644 validation/kill-unreachable-phi.c

diff --git a/flow.c b/flow.c
index bfe54f7..4ff6745 100644
--- a/flow.c
+++ b/flow.c
@@ -119,14 +119,6 @@ static int try_to_simplify_bb(struct basic_block
*bb, struct instruction *first,
 {
  int changed = 0;
  pseudo_t phi;
- int bogus;
-
- /*
- * This a due to improper dominance tracking during
- * simplify_symbol_usage()/conversion to SSA form.
- * No sane simplification can be done when we have this.
- */
- bogus = bb_list_size(bb->parents) != pseudo_list_size(first->phi_list);

  FOR_EACH_PTR(first->phi_list, phi) {
  struct instruction *def = phi->def;
@@ -156,8 +148,14 @@ static int try_to_simplify_bb(struct basic_block
*bb, struct instruction *first,
  continue;
  changed |= rewrite_branch(source, &br->bb_true, bb, target);
  changed |= rewrite_branch(source, &br->bb_false, bb, target);
- if (changed && !bogus)
+ /*
+ * FIXME: change 11b1a83 cause deadloop on wine compile,
+ * disable for now.
+ */
+#if 0
+ if (changed)
  kill_use(THIS_ADDRESS(phi));
+#endif
  } END_FOR_EACH_PTR(phi);
  return changed;
 }
diff --git a/validation/kill-phi-ttsbb.c b/validation/kill-phi-ttsbb.c
index 178a65d..b05c4c2 100644
--- a/validation/kill-phi-ttsbb.c
+++ b/validation/kill-phi-ttsbb.c
@@ -22,6 +22,7 @@ static int foo(int a, int b)
  * Verify if OP_PHI usage is adjusted after successful try_to_simplify_bb()
  * check-command: test-linearize $file
  * check-output-ignore
+ * check-known-to-fail
  *
  * check-output-excludes: phi\\.
  * check-output-excludes: phisrc\\.
diff --git a/validation/kill-unreachable-phi.c
b/validation/kill-unreachable-phi.c
new file mode 100644
index 0000000..4c7e249
--- /dev/null
+++ b/validation/kill-unreachable-phi.c
@@ -0,0 +1,27 @@
+extern char *strcpy (char *__dest, const char *__src);
+
+static void test_menu_iteminfo( void )
+{
+ int ansi = 1;
+ void *init, *string;
+ char initA[]="XYZ";
+ char stringA[0x80];
+ do {
+ if(ansi) {
+ string=stringA;
+ init = initA;
+ }
+ if(ansi)
+ strcpy( string, init );
+ } while( !(ansi = !ansi) );
+}
+/*
+ * check-name: kill-unreachable-phi
+ * check-description:
+ * In wine source tests/menu.c
+ * Improper killing a phi instruction inside not reachable BB cause
+ * dead loop on sparse.
+ *
+ * check-output-ignore
+ *
+ */
-- 
2.13.3
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux