The linearization of logical '&&' create a phi-node with its operands in the wrong order relatively to the parent BBs. Switch the order of the operands for logical '&&'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- linearize.c | 4 ++-- validation/linear/logical.c | 8 ++++---- validation/linear/phi-order01.c | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/linearize.c b/linearize.c index a56c272f7..bdcb92c1e 100644 --- a/linearize.c +++ b/linearize.c @@ -1721,13 +1721,13 @@ static pseudo_t linearize_logical(struct entrypoint *ep, struct expression *expr } else { pseudo_t src1; - phi2 = alloc_phi(ep->active, value_pseudo(0), expr->ctype); + phi1 = alloc_phi(ep->active, value_pseudo(0), expr->ctype); linearize_cond_branch(ep, expr->left, other, merge); set_activeblock(ep, other); src1 = linearize_expression_to_bool(ep, expr->right); src1 = cast_pseudo(ep, src1, &bool_ctype, expr->ctype); - phi1 = alloc_phi(ep->active, src1, expr->ctype); + phi2 = alloc_phi(ep->active, src1, expr->ctype); } set_activeblock(ep, merge); diff --git a/validation/linear/logical.c b/validation/linear/logical.c index 0f502c6b9..2c9f43f8d 100644 --- a/validation/linear/logical.c +++ b/validation/linear/logical.c @@ -159,7 +159,7 @@ as: br .L19 .L19: - phi.32 %r46 <- %phi14, %phi13 + phi.32 %r46 <- %phi13, %phi14 phisrc.32 %phi15(return) <- %r46 br .L17 @@ -189,7 +189,7 @@ au: br .L23 .L23: - phi.32 %r56 <- %phi17, %phi16 + phi.32 %r56 <- %phi16, %phi17 phisrc.32 %phi18(return) <- %r56 br .L21 @@ -217,7 +217,7 @@ al: br .L27 .L27: - phi.32 %r64 <- %phi20, %phi19 + phi.32 %r64 <- %phi19, %phi20 phisrc.32 %phi21(return) <- %r64 br .L25 @@ -246,7 +246,7 @@ ad: br .L31 .L31: - phi.32 %r73 <- %phi23, %phi22 + phi.32 %r73 <- %phi22, %phi23 phisrc.32 %phi24(return) <- %r73 br .L29 diff --git a/validation/linear/phi-order01.c b/validation/linear/phi-order01.c index 18f2acbce..0c4004fea 100644 --- a/validation/linear/phi-order01.c +++ b/validation/linear/phi-order01.c @@ -13,5 +13,4 @@ static int bar(int a) /* * check-name: phi-order01 * check-command: sparse -vir -flinearize=last $file - * check-known-to-fail */ -- 2.18.0