diff mbox series

[2/9] reorg simplify_and_or_mask()

Message ID 20180808143528.82880-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Rejected, archived
Headers show
Series more simplifications of bitfiled accesses | expand

Commit Message

Luc Van Oostenryck Aug. 8, 2018, 2:35 p.m. UTC
No functional changes here. Just adding temporary vars
and switching the order of the last if in preparation
of some incoming changes in this function.
---
 simplify.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/simplify.c b/simplify.c
index 455b1a041..6b813d4f9 100644
--- a/simplify.c
+++ b/simplify.c
@@ -827,12 +827,15 @@  static int simplify_seteq_setne(struct instruction *insn, long long value)
 static int simplify_and_or_mask(struct instruction *insn, pseudo_t and, pseudo_t other, unsigned long long mask)
 {
 	struct instruction *def = and->def;
+	unsigned long long omask, nmask;
 
 	if (!constant(def->src2))
 		return 0;
-	if (def->src2->value & mask)
-		return 0;
-	return replace_pseudo(insn, &insn->src1, other);
+	omask = def->src2->value;
+	nmask = omask & mask;
+	if (nmask == 0)
+		return replace_pseudo(insn, &insn->src1, other);
+	return 0;
 }
 
 static int simplify_constant_mask(struct instruction *insn, unsigned long long mask)