Hi, When I tried to decrease # of IV candidates, I removed code that adds IV candidates for use with constant offset stripped in use->base. This is kind of too aggressive and triggers PR69042. So here is a patch adding back the missing candidates. Honestly, this patch doesn't truly fix the issue, it just brings back the original behavior in IVOPT part (Which is still a right thing to do I think). The issue still depends on PIC_OFFSET register used on x86 target. As discussed in https://gcc.gnu.org/ml/gcc/2016-02/msg00040.html. Furthermore, the real problem could be in register pressure modeling about PIC_OFFSET symbol in IVOPT.
On AArch64, overall spec2k number isn't changed, though 173.applu is regressed by ~4% because couple of loops' # of candidates now hits "--param iv-consider-all-candidates-bound=30". For spec2k6 data on AArch64, INT is not affected; FP overall is not changed, as for specific case: 459.GemsFDTD is regressed by 2%, 433.milc is improved by 2%. To address the regression, I will send another patch increasing the parameter bound. Bootstrap&test on x86_64 and AArch64, is it OK? In the meantime, I will collect spec2k6 data on x86_64. Thanks, bin 2016-03-10 Bin Cheng <bin.ch...@arm.com> PR tree-optimization/69042 * tree-ssa-loop-ivopts.c (add_iv_candidate_for_use): Add IV cand for use with constant offset stripped in base.
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 4026d28..32594df 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3232,11 +3232,13 @@ add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use) basetype = sizetype; record_common_cand (data, build_int_cst (basetype, 0), iv->step, use); - /* Record common candidate with constant offset stripped in base. */ + /* Record common candidate with constant offset stripped in base. + Like the use itself, we also add candidate directly for it. */ + base = strip_offset (iv->base, &offset); + if (offset || base != iv->base) { - base = strip_offset (iv->base, &offset); - if (offset || base != iv->base) - record_common_cand (data, base, iv->step, use); + record_common_cand (data, base, iv->step, use); + add_candidate (data, base, iv->step, false, use); } /* Record common candidate with base_object removed in base. */