aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-09 16:07:35 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-11 13:59:32 +0100
commitd2ca9a9ceb2cb6437b3b01fc5b3819df4e071e34 (patch)
treed9a0202092b149bcb08cf8a22132cf9117484f9e
parentb24289d4b62a73a7de9c5b9dd8780da96ec58bf4 (diff)
downloadsparse-dev-d2ca9a9ceb2cb6437b3b01fc5b3819df4e071e34.tar.gz
fix symbol cleanup
REPEAT_SYMBOL_CLEANUP is set when there is changes to the addressability of a symbol, typically when a OP_SYMADDR is removed. However, currently most OP_SYMADDRs are 'simplified'/folded into their use. For example: symaddr.64 %r1 <- var add.64 %r2 <- %r1, $4 is simplified into: add.64 %r2 <- var, $4 One of the bad consequences of this 'simplification' is that if the 'add' instruction is later optimized away, this correspond to an effective change to the addressability of the symbol. This is exactly as if the 'symaddr' has been removed before being so 'simplified', but because the symaddr is not there anymore there is no change recorded to the addressability to the symbol and some further optimizations may be missed. Change that by checking at each time the usage is removed from an instruction if the corresponding pseudo was a symbol and set REPEAT_SYMBOL_CLEANUP if it was the case. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--simplify.c2
-rw-r--r--validation/optim/address-used01.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/simplify.c b/simplify.c
index a2edda47..0a320740 100644
--- a/simplify.c
+++ b/simplify.c
@@ -187,6 +187,8 @@ out:
static inline void remove_usage(pseudo_t p, pseudo_t *usep)
{
if (has_use_list(p)) {
+ if (p->type == PSEUDO_SYM)
+ repeat_phase |= REPEAT_SYMBOL_CLEANUP;
delete_pseudo_user_list_entry(&p->users, usep, 1);
if (!p->users)
kill_instruction(p->def);
diff --git a/validation/optim/address-used01.c b/validation/optim/address-used01.c
index 6ca75ffe..628923d1 100644
--- a/validation/optim/address-used01.c
+++ b/validation/optim/address-used01.c
@@ -13,7 +13,6 @@ int foo(int **g, int j)
/*
* check-name: address-used01
* check-command: test-linearize -Wno-decl -fdump-ir=final $file
- * check-known-to-fail
* check-output-ignore
* check-output-contains: ret\\..* \\$0
*/