diff mbox series

[4/9] dumber simplify_and_or_mask()

Message ID 20180808143528.82880-5-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
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 mbox series

Patch

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;