All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] cleanup REPEAT_SYMBOL_CLEANUP & kill_insn()
@ 2020-11-21 22:46 Luc Van Oostenryck
  2020-11-21 22:46 ` [PATCH 1/2] remove unneeded REPEAT_SYMBOL_CLEANUP Luc Van Oostenryck
  2020-11-21 22:46 ` [PATCH 2/2] simplify kill_insn() of unops and unop-ish instructions Luc Van Oostenryck
  0 siblings, 2 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-11-21 22:46 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

This series contains 2 patches doing some cleanups related
to REPEAT_SYMBOL_CLEANUP and instruction killing.

Note: these pacthes must be applied on top of the previous
      641cf2c29528 ("fix kill_insn(OP_SETVAL)").

Luc Van Oostenryck (2):
  remove unneeded REPEAT_SYMBOL_CLEANUP
  simplify kill_insn() of unops and unop-ish instructions

 flow.c     |  3 +--
 flow.h     |  1 -
 simplify.c | 25 +++++++------------------
 3 files changed, 8 insertions(+), 21 deletions(-)


base-commit: 641cf2c295285ee15f35dbcfd85367ca61259be0
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] remove unneeded REPEAT_SYMBOL_CLEANUP
  2020-11-21 22:46 [PATCH 0/2] cleanup REPEAT_SYMBOL_CLEANUP & kill_insn() Luc Van Oostenryck
@ 2020-11-21 22:46 ` Luc Van Oostenryck
  2020-11-21 22:46 ` [PATCH 2/2] simplify kill_insn() of unops and unop-ish instructions Luc Van Oostenryck
  1 sibling, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-11-21 22:46 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

Since simplify_memops() must be called unconditionally (see [1])
it's useless to set REPEAT_SYMBOL_CLEANUP (at the condition that
REPEAT_CSE is set instead).

So remove it's definition and set REPEAT_CSE instead when needed).

[1] 6b5e7cf5ac39 ("cfg: call simplify_memops() unconditionally.")

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 flow.c     | 3 +--
 flow.h     | 1 -
 simplify.c | 7 ++-----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/flow.c b/flow.c
index 162c27346def..1a871df16bd5 100644
--- a/flow.c
+++ b/flow.c
@@ -457,7 +457,6 @@ void convert_load_instruction(struct instruction *insn, pseudo_t src)
 {
 	convert_instruction_target(insn, src);
 	kill_instruction(insn);
-	repeat_phase |= REPEAT_SYMBOL_CLEANUP;
 }
 
 static int overlapping_memop(struct instruction *a, struct instruction *b)
@@ -559,7 +558,7 @@ complex_phi:
 	insn->phi_list = dominators;
 
 end:
-	repeat_phase |= REPEAT_SYMBOL_CLEANUP;
+	repeat_phase |= REPEAT_CSE;
 }
 
 /* Kill a pseudo that is dead on exit from the bb */
diff --git a/flow.h b/flow.h
index 19a743c83b94..c3461c8c33bd 100644
--- a/flow.h
+++ b/flow.h
@@ -6,7 +6,6 @@
 extern unsigned long bb_generation;
 
 #define REPEAT_CSE		(1 << 0)
-#define REPEAT_SYMBOL_CLEANUP	(1 << 1)
 #define REPEAT_CFG_CLEANUP	(1 << 2)
 
 struct entrypoint;
diff --git a/simplify.c b/simplify.c
index 4d0adf444e17..465624f72677 100644
--- a/simplify.c
+++ b/simplify.c
@@ -259,8 +259,6 @@ out:
 static inline void rem_usage(pseudo_t p, pseudo_t *usep, int kill)
 {
 	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 (kill && !p->users)
 			kill_instruction(p->def);
@@ -338,7 +336,6 @@ int kill_insn(struct instruction *insn, int force)
 
 	case OP_SYMADDR:
 		kill_use(&insn->src);
-		repeat_phase |= REPEAT_SYMBOL_CLEANUP;
 		break;
 
 	case OP_CBR:
@@ -1715,7 +1712,7 @@ static int simplify_one_memop(struct instruction *insn, pseudo_t orig)
 		if (def->opcode == OP_SYMADDR && def->src) {
 			kill_use(&insn->src);
 			use_pseudo(insn, def->src, &insn->src);
-			return REPEAT_CSE | REPEAT_SYMBOL_CLEANUP;
+			return REPEAT_CSE;
 		}
 		if (def->opcode == OP_ADD) {
 			new = def->src1;
@@ -1751,7 +1748,7 @@ offset:
 	}
 	insn->offset += off->value;
 	replace_pseudo(insn, &insn->src, new);
-	return REPEAT_CSE | REPEAT_SYMBOL_CLEANUP;
+	return REPEAT_CSE;
 }
 
 ///
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] simplify kill_insn() of unops and unop-ish instructions
  2020-11-21 22:46 [PATCH 0/2] cleanup REPEAT_SYMBOL_CLEANUP & kill_insn() Luc Van Oostenryck
  2020-11-21 22:46 ` [PATCH 1/2] remove unneeded REPEAT_SYMBOL_CLEANUP Luc Van Oostenryck
@ 2020-11-21 22:46 ` Luc Van Oostenryck
  1 sibling, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-11-21 22:46 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

In instructions, the first pseudo operands exist under different
names (.src1, .src, .cond, .phi_src) all aliased to each other.

Use this to simplify unops and others instructions with a single
pseudo operand.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/simplify.c b/simplify.c
index 465624f72677..4508c6d54386 100644
--- a/simplify.c
+++ b/simplify.c
@@ -324,24 +324,16 @@ int kill_insn(struct instruction *insn, int force)
 
 	case OP_UNOP ... OP_UNOP_END:
 	case OP_SLICE:
-		kill_use(&insn->src1);
-		break;
-
-	case OP_PHI:
-		kill_use_list(insn->phi_list);
-		break;
 	case OP_PHISOURCE:
-		kill_use(&insn->phi_src);
-		break;
-
 	case OP_SYMADDR:
-		kill_use(&insn->src);
-		break;
-
 	case OP_CBR:
 	case OP_SWITCH:
 	case OP_COMPUTEDGOTO:
-		kill_use(&insn->cond);
+		kill_use(&insn->src1);
+		break;
+
+	case OP_PHI:
+		kill_use_list(insn->phi_list);
 		break;
 
 	case OP_CALL:
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-21 22:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21 22:46 [PATCH 0/2] cleanup REPEAT_SYMBOL_CLEANUP & kill_insn() Luc Van Oostenryck
2020-11-21 22:46 ` [PATCH 1/2] remove unneeded REPEAT_SYMBOL_CLEANUP Luc Van Oostenryck
2020-11-21 22:46 ` [PATCH 2/2] simplify kill_insn() of unops and unop-ish instructions Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.