[PATCH] fix symbol cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 simplify.c                        | 2 ++
 validation/optim/address-used01.c | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index a2edda479..0a3207404 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 6ca75ffe5..628923d19 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
  */
-- 
2.16.2

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux