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