Commit graph

928 commits

Author SHA1 Message Date
Quentin Carbonneaux
8992106928 do not compute def-use links for regs 2016-04-13 12:39:57 -04:00
Quentin Carbonneaux
e9dc0035ae hack an ssa validator (likely buggy) 2016-04-13 12:39:57 -04:00
Quentin Carbonneaux
4a4a013291 add unsigned comparisons to emit 2016-04-13 12:39:57 -04:00
Quentin Carbonneaux
0e85eb8282 handle the bad jump case 2016-04-13 12:39:54 -04:00
Quentin Carbonneaux
b067c4eea4 add new minic test 2016-04-13 09:58:10 -04:00
Quentin Carbonneaux
95f1a20e0e separate name and index in newtmp() 2016-04-13 09:53:54 -04:00
Quentin Carbonneaux
32d9e33191 harden memopt() 2016-04-13 09:53:50 -04:00
Quentin Carbonneaux
02b70c0cb1 bug in checking of multiple definitions 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
1f4ff63418 subtle bug in liveness!
If on of the phis in a block A uses the result
of another one when coming from B, we have to
be careful!
2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
4cee19ea9f add missing idiv in opdesc[] 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
4be9d2b559 cosmetic modification in fold 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
eb3a5b4457 simplify latmerge() 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
3bb4f8a647 nicer agony message in isel 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
861bb7c534 the lattice merge has to be used in update() 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
ff53f2258d fix wrong isext() macro 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
e562f219cf oops, dumb bug in folding 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
4ce295adad use a shift to divide by 2 in collatz 2016-04-12 14:51:50 -04:00
Quentin Carbonneaux
4999d6ebf0 more extensive handling of fast locals 2016-04-12 14:51:45 -04:00
Quentin Carbonneaux
422c2eebae avoid a few hangs in parsing code 2016-04-12 13:06:45 -04:00
Quentin Carbonneaux
8657a7e730 check invalid instruction types 2016-04-12 13:03:37 -04:00
Quentin Carbonneaux
5c3c410c60 both comparison arguments need to be fixed
The second argument will not be a constant because
of the assertion.  But it could be a fast local, and
this situation needs to be handled by the last case
of fixarg().
2016-04-12 13:00:16 -04:00
Quentin Carbonneaux
60feaba8c5 frendlier error message in emit 2016-04-12 12:37:11 -04:00
Quentin Carbonneaux
ce26f8625d add simple il validation 2016-04-12 12:17:04 -04:00
Quentin Carbonneaux
4a52182ed7 fix typo in emit 2016-04-12 12:16:42 -04:00
Quentin Carbonneaux
c416da5a70 handle dumb conditional jumps in isel
I also removed the code to handle jumps with a
constant argument since those should be eliminated
by the folding pass.
2016-04-12 12:06:51 -04:00
Quentin Carbonneaux
6b1b97c996 fix bug in predecessors filling code 2016-04-12 12:02:56 -04:00
Quentin Carbonneaux
83506f8b75 fix type bug in abi3 test 2016-04-12 11:33:32 -04:00
Quentin Carbonneaux
6e70be3f22 simplify fillpreds() code 2016-04-12 10:49:56 -04:00
Quentin Carbonneaux
b58fdfec9d diagnose some undefined uses 2016-04-12 10:24:00 -04:00
Quentin Carbonneaux
d837263ffa oops, wrong test in abi classify() 2016-04-12 09:55:59 -04:00
Quentin Carbonneaux
8bb7d57b4e improve help message slightly 2016-04-11 18:00:45 -04:00
Quentin Carbonneaux
3a3c88532c 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.
2016-04-09 22:22:44 -04:00
Quentin Carbonneaux
cecf04f009 cosmetic fixes in llvm comparison 2016-04-09 19:11:25 -04:00
Quentin Carbonneaux
e1691d5c82 rebuild rpo after fold 2016-04-09 18:41:30 -04:00
Quentin Carbonneaux
c691b4df12 did I loose my c? 2016-04-09 18:39:39 -04:00
Quentin Carbonneaux
abe45f1ab0 enable constant folding 2016-04-09 14:32:07 -04:00
Quentin Carbonneaux
d8770d112b fix wrong assertion in fold 2016-04-09 14:31:42 -04:00
Quentin Carbonneaux
71e6fa0b30 oops, forgot to patch phi arguments 2016-04-09 14:31:23 -04:00
Quentin Carbonneaux
a8fc696052 more debug tweaks in fold 2016-04-09 14:22:25 -04:00
Quentin Carbonneaux
1e0f18e908 add a proper block deletion routine 2016-04-09 14:21:56 -04:00
Quentin Carbonneaux
081360df6a nicer debug info 2016-04-09 09:38:20 -04:00
Quentin Carbonneaux
717524d4a3 quickly hack fold rewriting 2016-04-09 09:32:22 -04:00
Quentin Carbonneaux
206a0e55ba avoid gcc warning in emit 2016-04-08 09:47:00 -04:00
Quentin Carbonneaux
15cee065a5 simplify a buggy test
I found it by compiling -O2 and seeing the ABI code
fail.  Further investigation revealed GCC trimmed
away the last iteration of the loop because I was
accessing the third element of an array of size two.
This is undefined behavior, so GCC "proved" that the
last iteration was never run.
2016-04-08 09:41:59 -04:00
Quentin Carbonneaux
a7fb69fd78 prevent gcc warning in rega 2016-04-08 09:11:56 -04:00
Quentin Carbonneaux
238bc89271 fix loop header detection bug in spill 2016-04-08 08:33:37 -04:00
Quentin Carbonneaux
8c92b12485 use union for punning in emit 2016-04-08 08:31:25 -04:00
Quentin Carbonneaux
554ba694ab use cast in czero() 2016-04-07 20:31:33 -04:00
Quentin Carbonneaux
9294295bb5 inline latmerge() (cross fingers) 2016-04-07 14:48:21 -04:00
Quentin Carbonneaux
03083f653d adjustments in sccp 2016-04-07 14:43:02 -04:00