[PATCH v3 07/15] switch return order in simplify_mask_or_and()

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

 



This function used an early return when the test guarding
the simplification failed but this make impossible to add
other ones simplifications.

In preparation for incoming additional simplifications,
negate the test and switch the returns so that the early return
is now a catch-all return when no simplifications can apply.

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

diff --git a/simplify.c b/simplify.c
index 25641400e..969fd15bb 100644
--- a/simplify.c
+++ b/simplify.c
@@ -568,12 +568,11 @@ static int simplify_mask_or_and(struct instruction *insn, unsigned long long mas
 		return 0;
 	omask = src2->value;
 	nmask = omask & mask;
-	if (nmask != 0)
-		return 0;
-	// replace OP(((x & M') | b), K)
-	// by      OP(b, K)
-	// when	(M' & M) == 0
-	return replace_pseudo(insn, &insn->src1, orb);
+	if (nmask == 0) {
+		// if (M' & M) == 0: ((a & M') | b) -> b
+		return replace_pseudo(insn, &insn->src1, orb);
+	}
+	return 0;
 }
 
 ///
-- 
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