Commit 20ed357c authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

Fix block align decision

If scheduled-before block is not a cf-predecessor, the function
ultimately computed a NaN and returned false. However, such blocks
should be aligned.

Initially, clang -fsanitize=undefined found the NaN, which is certainly
not expected by original programmer. The DELTA approach still looks
fishy to me.
parent 89e17137
......@@ -1509,16 +1509,21 @@ static int should_align_block(const ir_node *block)
double pred_freq = get_block_execfreq(pred);
if (pred == prev) {
assert (pred_freq > 0.0f && "Might result in NaN below!?!");
prev_freq += pred_freq;
} else {
jmp_freq += pred_freq;
}
}
if (prev_freq == 0.0)
/* Prev-by-schedule block never falls-through => align! */
return 1;
if (prev_freq < DELTA && !(jmp_freq < DELTA))
return 1;
jmp_freq /= prev_freq;
assert (jmp_freq == jmp_freq && "NaN!");
return jmp_freq > ia32_cg_config.label_alignment_factor;
}
......
Supports Markdown
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