[PATCH 6/8] trivial-phi: use a temp var for the real source

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

 



By design, all operands of a phi-node are defined by a OP_PHISRC.
So, this phi-source need to be dereferenced to get the real source.

Since this value is used in several tests, use a temoparary variable
for it.

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

diff --git a/simplify.c b/simplify.c
index 5413e1dd3..9a2f6c50d 100644
--- a/simplify.c
+++ b/simplify.c
@@ -191,16 +191,21 @@ static int trivial_phi(pseudo_t *pseudo, struct instruction *insn)
 	same = 1;
 	FOR_EACH_PTR(insn->phi_list, phi) {
 		struct instruction *def;
+		pseudo_t src;
+
 		if (phi == VOID)
 			continue;
 		def = phi->def;
-		if (def->phi_src == VOID || !def->bb)
+		if (!def->bb)
+			continue;
+		src = def->phi_src; // bypass OP_PHISRC & get the real source
+		if (src == VOID)
 			continue;
 		if (!last) {
 			last = def;
 			continue;
 		}
-		if (last->phi_src == def->phi_src)
+		if (last->phi_src == src)
 			continue;
 		return 0;
 	} END_FOR_EACH_PTR(phi);
-- 
2.18.0




[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