Commit 2895bdb8 authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

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.

parent 2c8cc375
......@@ -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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment