[PATCH 6/7] big-shift: do not optimize negative shifts

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

 



Like GCC, we don't want to touch shifts with a negative count.

Return early as soon as a negative value is detected.

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

diff --git a/simplify.c b/simplify.c
index 1b258eb63..5afa0c9ca 100644
--- a/simplify.c
+++ b/simplify.c
@@ -575,6 +575,8 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v
 	if (!value)
 		return replace_with_pseudo(insn, pseudo);
 	value = check_shift_count(insn, value);
+	if (value < 0)
+		return 0;
 
 	size = insn->size;
 	switch (insn->opcode) {
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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