summary refs log tree commit diff
path: root/fold.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-09 22:08:25 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-09 22:22:44 -0400
commit3a3c88532c4d1c5fdf89d159cb24706dcbc6fc28 (patch)
tree7fd1a61d453269bafe53f599018562808700d356 /fold.c
parentcecf04f009a68e8a3cd8a7ce4945245d177124c9 (diff)
downloadroux-3a3c88532c4d1c5fdf89d159cb24706dcbc6fc28.tar.gz
this can be false
I think I should check for Top when rewriting.
Because for sure, we don't want to replace some
temporary by Top, first, I can't represent it,
and second, it'd mean that it is a temporary
used undefined.

The example that triggered the assertion was like
that:

@b0
  jnz 1, @b1, @b3
@b1
  %x =w phi @b0 10, @b2 %x1
  jnz %x, @b2, @b3
@b2
  %x1 =w sub %x, 1
  jmp @b1
@b3
  %x2 =w phi @b1 %x, @b0 42

So SCCP optimistically assumes %x is 10 when it goes
through @b1, then at the branch, @b1->@b3 is left for
dead.  After that, @b2 is processed and the flow
worklist is empty.  Now uses are processed, %x2 will
get processed regardless if its block is dead or not
(it is at that time), then all the back-edges are dead
so the phi is set to the lattice merge of tops only.
BOOM!

This leads to the question, should phis of dead blocks
be processed?  I'll check that later.
Diffstat (limited to 'fold.c')
-rw-r--r--fold.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/fold.c b/fold.c
index 55e8b72..ea1cb6e 100644
--- a/fold.c
+++ b/fold.c
@@ -82,7 +82,6 @@ visitphi(Phi *p, int n, Fn *fn)
 				v = m;
 		}
 	}
-	assert(v != Top);
 	update(p->to.val, v, fn);
 }