diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-10 11:59:59 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-10 14:24:51 +0100 |
| commit | 71205271e3c082b66a21640b2e92f21f5eaa7ad0 (patch) | |
| tree | 8430276c307d75a49810921da553e2fcf594cc7d | |
| parent | dd566d02ba1168b22281fb00b312fe09e6f09813 (diff) | |
| download | sparse-dev-71205271e3c082b66a21640b2e92f21f5eaa7ad0.tar.gz | |
fix dead dominator
During simplify_one_symbol(), if possible, loads are replaced by
an OP_PHI and the corresponding OP_PHISOURCE. To simplify things
firther, If all the phisrcs correspond to an unique pseudo (often
because there is only a single phisrc), then it's useless to
create the OP_PHI: the created OP_PHISOURCEs can be removed and
the initial load can be converted to the unique pseudo.
However, if the unique pseudo was never used, the removal of
the OP_PHISOURCEs, done *before* the load conversion, will
kill the defining load (at this point the only user of the
pseudo was the OP_PHISOURCEs) which will then erroneously make
a VOID from the pseudo.
Fix this by doing the load conversion before removing the
unneeded OP_PHISOURCEs.
| -rw-r--r-- | flow.c | 2 | ||||
| -rw-r--r-- | validation/mem2reg/load-dead.c | 1 |
2 files changed, 1 insertions, 2 deletions
@@ -453,10 +453,10 @@ void rewrite_load_instruction(struct instruction *insn, struct pseudo_list *domi * and convert the load into a LNOP and replace the * pseudo. */ + convert_load_instruction(insn, new); FOR_EACH_PTR(dominators, phi) { kill_instruction(phi->def); } END_FOR_EACH_PTR(phi); - convert_load_instruction(insn, new); return; complex_phi: diff --git a/validation/mem2reg/load-dead.c b/validation/mem2reg/load-dead.c index 19ac4e5e..1165fa1e 100644 --- a/validation/mem2reg/load-dead.c +++ b/validation/mem2reg/load-dead.c @@ -12,7 +12,6 @@ static void foo(int a) /* * check-name: load-dead * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: VOID |
