[PATCH 5/9] let's try simplify_and_or_mask() on both sides

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

 



Currently, when trying to simplify ((x | y) & M'),
if the left-side of the OR can be simplified, the right
side is left as-is and any potential simplification will
only be done in a later cycle.

Try to simplify both sides before returning.
---
 simplify.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/simplify.c b/simplify.c
index 2f30b1769..53dd4a2ad 100644
--- a/simplify.c
+++ b/simplify.c
@@ -846,6 +846,7 @@ static int simplify_constant_mask(struct instruction *insn, unsigned long long m
 	unsigned long long nmask;
 	struct instruction *def;
 	pseudo_t src1, src2;
+	int rc = 0;
 	int osize;
 
 	switch (DEF_OPCODE(def, old)) {
@@ -858,10 +859,10 @@ 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(src1, mask);
+			rc |= simplify_and_or_mask(src1, mask);
 		if (def_opcode(src2) == OP_AND)
-			return simplify_and_or_mask(src2, mask);
-		break;
+			rc |= simplify_and_or_mask(src2, mask);
+		return rc;
 	case OP_ZEXT:
 		osize = def->orig_type->bit_size;
 		/* fall through */
-- 
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