[PATCH 4/9] dumber simplify_and_or_mask()

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

 



Currently, in simplify_and_or_mask(), the simplification
done when (M & M') == 0 (replacing 'A & M' by 0) is just
a special case and a repetition of the normal neutral-0
simplification which will done anyway (albeit later).

Avoid the repetition by suppressing the special case.
This also allow to be able to use this function in more
situations.
---
 simplify.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/simplify.c b/simplify.c
index 6a68ee5b4..2f30b1769 100644
--- a/simplify.c
+++ b/simplify.c
@@ -824,7 +824,7 @@ static int simplify_seteq_setne(struct instruction *insn, long long value)
 	return 0;
 }
 
-static int simplify_and_or_mask(struct instruction *insn, pseudo_t and, pseudo_t other, unsigned long long mask)
+static int simplify_and_or_mask(pseudo_t and, unsigned long long mask)
 {
 	struct instruction *def = and->def;
 	unsigned long long omask, nmask;
@@ -835,8 +835,6 @@ static int simplify_and_or_mask(struct instruction *insn, pseudo_t and, pseudo_t
 	nmask = omask & mask;
 	if (nmask == omask)
 		return 0;
-	if (nmask == 0)
-		return replace_pseudo(insn, &insn->src1, other);
 	def->src2 = value_pseudo(nmask);
 	return REPEAT_CSE;
 }
@@ -860,9 +858,9 @@ static int simplify_constant_mask(struct instruction *insn, unsigned long long m
 		src1 = def->src1;
 		src2 = def->src2;
 		if (def_opcode(src1) == OP_AND)
-			return simplify_and_or_mask(insn, src1, src2, mask);
+			return simplify_and_or_mask(src1, mask);
 		if (def_opcode(src2) == OP_AND)
-			return simplify_and_or_mask(insn, src2, src1, mask);
+			return simplify_and_or_mask(src2, mask);
 		break;
 	case OP_ZEXT:
 		osize = def->orig_type->bit_size;
-- 
2.18.0

--
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