[PATCH 2/6] use an intermediate mask in simplify_shift()

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

 



This is to have the code to look as closest as possible to what
is done in simplify_mask_or_and() in preparation to some unification.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/simplify.c b/simplify.c
index 6619bd1b3..c18965bfa 100644
--- a/simplify.c
+++ b/simplify.c
@@ -590,7 +590,7 @@ static int simplify_or_lsr(struct instruction *insn, pseudo_t src, pseudo_t othe
 static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long value)
 {
 	struct instruction *def;
-	unsigned long long mask;
+	unsigned long long mask, omask;
 	unsigned long long nval;
 	unsigned int size;
 	pseudo_t src2;
@@ -649,13 +649,13 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v
 			// by      (A >> S) & (M >> S)
 			if (!constant(def->src2))
 				break;
+			omask = def->src2->value;
 			if (nbr_users(pseudo) > 1)
 				break;
-			mask = def->src2->value;
 			def->opcode = OP_LSR;
 			def->src2 = insn->src2;
 			insn->opcode = OP_AND;
-			insn->src2 = value_pseudo(mask >> value);
+			insn->src2 = value_pseudo(omask >> value);
 			return REPEAT_CSE;
 		case OP_LSR:
 			goto case_shift_shift;
-- 
2.18.0




[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