diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-11-29 07:18:00 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-11-29 07:18:00 -0800 |
commit | 6988511ee608ec35c529ed2ee41ad2f324f4534b (patch) | |
tree | 5b6a10d6b0aeee73c160018042ea6d72e57e526b /parser.c | |
parent | 0fe99a6c310484d676c37c60c406784fd14af6a2 (diff) | |
download | txr-6988511ee608ec35c529ed2ee41ad2f324f4534b.tar.gz txr-6988511ee608ec35c529ed2ee41ad2f324f4534b.tar.bz2 txr-6988511ee608ec35c529ed2ee41ad2f324f4534b.zip |
compiler: new late-peephole case.
This is related to the pattern in the previous commit. When we have a
situation like this:
lab1
mov tn nil
lab2
ifq tn nil lab4
lab3
gcall tn ...
We know that if lab1 is entered, then lab2 will necessarily
fall through: the lab4 branch is not taken because tn is nil.
But then, tn is clobbered immediately in lab3 by the gcall tn.
In other words, the value stored into tn by lab1 is never used.
Therefore, we can remove the "mov tn nil" instruction and
move the l1 label.
lab2
ifq tn nil lab4
lab1
lab3
gcall tn ...
There are 74 hits for this pattern in stdlib.
* stdlib/optimize.tl (basic-blocks late-peephole): Implement the
above pattern.
Diffstat (limited to 'parser.c')
0 files changed, 0 insertions, 0 deletions