This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.

[PATCH GCC]Introduce loop interchange pass and enable it at -O3

From: Bin Cheng <Bin dot Cheng at arm dot com>

To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>

Cc: nd <nd at arm dot com>

Date: Thu, 7 Dec 2017 10:28:26 +0000

Subject: [PATCH GCC]Introduce loop interchange pass and enable it at -O3

Authentication-results: sourceware.org; auth=none

Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bin dot Cheng at arm dot com;

Nodisclaimer: True

Spamdiagnosticmetadata: NSPM

Spamdiagnosticoutput: 1:99

Hi, This is the overall loop interchange patch on gimple-linterchange branch. Note the new pass is enabled at -O3 level by default. Bootstrap and regtest on x86_64 and AArch64(ongoing). NOte after cost model change it is now far more conservative than original version. It only interchanges 11 loops in spec2k6 (416 doesn't build at the moment), vs ~250 for the original version. I will collect compilation time data, though there shouldn't be any surprise given few loops are actually interchanged. I will also collect spec2k6 data, shouldn't affect cases other than bwaves either. So is it OK? Thanks, bin 2017-12-07 Bin Cheng <bin.cheng@arm.com> Richard Biener <rguenther@suse.de> PR tree-optimization/81303 * Makefile.in (gimple-loop-interchange.o): New object file. * common.opt (floop-interchange): Reuse the option from graphite. * doc/invoke.texi (-floop-interchange): Ditto. New document for -floop-interchange and mention it for -O3. * opts.c (default_options_table): Enable -floop-interchange at -O3. * gimple-loop-interchange.cc: New file. * params.def (PARAM_LOOP_INTERCHANGE_MAX_NUM_STMTS): New parameter. (PARAM_LOOP_INTERCHANGE_STRIDE_RATIO): New parameter. * passes.def (pass_linterchange): New pass. * timevar.def (TV_LINTERCHANGE): New time var. * tree-pass.h (make_pass_linterchange): New declaration. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Change to external interchange. Record IV before/after increment in new parameters. * tree-ssa-loop-ivopts.h (create_canonical_iv): New declaration. * tree-vect-loop.c (vect_is_simple_reduction): Factor out reduction path check into... (check_reduction_path): ...New function here. * tree-vectorizer.h (check_reduction_path): New declaration. gcc/testsuite 2017-12-07 Bin Cheng <bin.cheng@arm.com> Richard Biener <rguenther@suse.de> PR tree-optimization/81303 * gcc.dg/tree-ssa/loop-interchange-1.c: New test. * gcc.dg/tree-ssa/loop-interchange-1b.c: New test. * gcc.dg/tree-ssa/loop-interchange-2.c: New test. * gcc.dg/tree-ssa/loop-interchange-3.c: New test. * gcc.dg/tree-ssa/loop-interchange-4.c: New test. * gcc.dg/tree-ssa/loop-interchange-5.c: New test. * gcc.dg/tree-ssa/loop-interchange-6.c: New test. * gcc.dg/tree-ssa/loop-interchange-7.c: New test. * gcc.dg/tree-ssa/loop-interchange-8.c: New test. * gcc.dg/tree-ssa/loop-interchange-9.c: New test. * gcc.dg/tree-ssa/loop-interchange-10.c: New test. * gcc.dg/tree-ssa/loop-interchange-11.c: New test. * gcc.dg/tree-ssa/loop-interchange-12.c: New test. * gcc.dg/tree-ssa/loop-interchange-13.c: New test.