diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-03-20 15:42:19 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-04-17 20:43:15 +0200 |
commit | b91ba64904a6a05d619a27a17545163eac97c2ca (patch) | |
tree | 0c8055ecc19bcff650e2ec022de156e9a41d006d | |
parent | 3de14a1edba826afa66840798ec260ec60f6ed49 (diff) | |
download | sparse-b91ba64904a6a05d619a27a17545163eac97c2ca.tar.gz |
memops: avoid using first_pseudo()
The loop in rewrite_load_instruction() uses first_pseudo() to not have
to special case the first element.
But this slightly complicates further changes.
So, simply use a null-or-no-null test inside the loop to identify
this first element.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | memops.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -19,15 +19,17 @@ static void rewrite_load_instruction(struct instruction *insn, struct pseudo_list *dominators) { - pseudo_t new, phi; + pseudo_t new = NULL; + pseudo_t phi; /* * Check for somewhat common case of duplicate * phi nodes. */ - new = first_pseudo(dominators)->def->phi_src; FOR_EACH_PTR(dominators, phi) { - if (new != phi->def->phi_src) + if (!new) + new = phi->def->phi_src; + else if (new != phi->def->phi_src) goto complex_phi; } END_FOR_EACH_PTR(phi); |