[PATCH PR62631]Return shiftadd cost only when it's smaller than normal one
Thu Sep 4 08:59:00 GMT 2014
As reported by pr62631, case ivopts-lt-2.c is failed on sparc64. The root
cause is shiftadd_cost calculated on sparc64 is huge which prevents gcc from
choosing the wanted candidate. The problem with IVOPT is it always assumes
that shiftadd_cost is smaller than the normal cost, while it's not true in
this extreme case. This patch checks if the shiftadd_cost is smaller before
returning it. The patch also cleans code indent in context.
One question is left here.
Why >100 cost is calculated for shiftadd on sparc64? In final assembly
code, the computation is implemented by separated shift and add
instructions. Probably sparc64 should return cost no larger than
cost(shift)+cost(add) in the first place?.
Bootstrap and tested on x86_64/cortex-m3, the case is fixed on sparc64 now.
Is it OK?
2014-09-04 Bin Cheng <firstname.lastname@example.org>
* tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Return cost
calculated by get_shiftadd_cost only when it is smaller. Fix
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Gcc-patches