diff mbox series

[7/9] small code reorg of simplify_or_lsr()

Message ID 20180808143528.82880-8-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, just moving the code around to prepare
the next patch.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/simplify.c b/simplify.c
index ff2174388..e58c97c08 100644
--- a/simplify.c
+++ b/simplify.c
@@ -578,13 +578,14 @@  static long long check_shift_count(struct instruction *insn, unsigned long long
 static int simplify_or_lsr(struct instruction *insn, pseudo_t src, pseudo_t other, unsigned shift)
 {
 	// src->def->opcode == OP_AND
-	pseudo_t src2 = src->def->src2;
+	struct instruction *insn2 = src->def;
+	pseudo_t src2 = insn2->src2;
 
 	if (!constant(src2))
 		return 0;
-	if (((unsigned long long) src2->value) >> shift)
-		return 0;
-	return replace_pseudo(insn, &insn->src1, other);
+	if ((((unsigned long long)src2->value) >> shift) == 0)
+		return replace_pseudo(insn, &insn->src1, other);
+	return 0;
 }
 
 static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long value)