[PATCH 3/7] canon: put PSEUDO_REGs in canonical order too

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

 



Currently, only binops containing PSEUDO_VAL, SYM or ARG were
put in canonical order. This means that binops containing only
PSEUDO_REGs are not ordered. This is not directly
a problem for CSE because commutativity is taken in account but:
* more combination need to be checked during simplification
* 'anti-commutative' operations like (a > b) & (b < a) are not
  recognized as such.

So, take PSEUDO_REGs in account when checking if operands
are in canonical order.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c                   | 3 +++
 validation/optim/cse-reg01.c | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index c809b832afeb..ee485798148b 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1474,6 +1474,9 @@ static int canonical_order(pseudo_t p1, pseudo_t p2)
 	if (p1->type == PSEUDO_ARG)
 		return (p2->type == PSEUDO_ARG && p1->nr <= p2->nr) || p2->type == PSEUDO_VAL || p2->type == PSEUDO_SYM;
 
+	if (p1->type == PSEUDO_REG)
+		return (p2->type == PSEUDO_REG && p1->nr <= p2->nr) || p2->type == PSEUDO_VAL || p2->type == PSEUDO_SYM || p2->type == PSEUDO_ARG;
+
 	return 1;
 }
 
diff --git a/validation/optim/cse-reg01.c b/validation/optim/cse-reg01.c
index 938858f4649b..3ea283d35368 100644
--- a/validation/optim/cse-reg01.c
+++ b/validation/optim/cse-reg01.c
@@ -3,7 +3,6 @@ int foo(int a, int b) { int x = a + b, y = ~b; return (x < y) == (y > x); }
 /*
  * check-name: cse-reg01
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-returns: 1
-- 
2.29.2




[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