From 2895bdb8793587206b1a302607616f80cb22e5af Mon Sep 17 00:00:00 2001 From: Andreas Zwinkau Date: Fri, 18 Feb 2011 14:24:25 +0000 Subject: [PATCH] Fix opt/git_error.c testcase Extend the fix_adds_and_subs pass after strength reduction, which inserts Convs to make the verifier happy. In case the index variable is inverted (i=1-i) on each loop iteration, the optimization may yield a SubP(ConstIu,PhiP), which is rejected by the verifier. [r28409] --- ir/opt/opt_osr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index 1d3908409..0f3019343 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -1398,6 +1398,19 @@ static void fix_adds_and_subs(ir_node *irn, void *ctx) set_Sub_right(irn, right); } } + } else if (mode_is_reference(mode)) { + ir_node *left = get_Sub_left(irn); + ir_node *right = get_Sub_right(irn); + ir_mode *l_mode = get_irn_mode(left); + ir_mode *r_mode = get_irn_mode(right); + if (mode_is_int(l_mode)) { + /* Usually, Sub(I*,P) is an error, hence the verifier rejects it. + * However, it is correct in this case, so add Conv to make verifier happy. */ + assert (mode_is_reference(r_mode)); + ir_node *block = get_nodes_block(right); + ir_node *lconv = new_r_Conv(block,left,r_mode); + set_Sub_left(irn, lconv); + } } } } /* fix_adds_and_subs */ -- 2.20.1