[PATCH 2/2] fix rem_usage()

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

 



rem_usage() is used to remove an element from a def-use chain. Optionally,
if the chain become empty, the defining instruction can also be killed.

This optional part is currently be done on all pseudos but only those
having a definition should be concerned.

Fix this by adding a check so that only PSEUDO_REGs and PSEUDO_PHIs are killed.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index a877b693b610..12482d787189 100644
--- a/simplify.c
+++ b/simplify.c
@@ -271,7 +271,7 @@ static inline void rem_usage(pseudo_t p, pseudo_t *usep, int kill)
 {
 	if (has_use_list(p)) {
 		delete_pseudo_user_list_entry(&p->users, usep, 1);
-		if (kill && !p->users)
+		if (kill && !p->users && has_definition(p))
 			kill_instruction(p->def);
 	}
 }
-- 
2.29.2




[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