r283685 - When optimizing for size, enable loop rerolling by default

Hal Finkel via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 12:58:52 PDT 2016


Hi Chris, 

Thanks! Can you (or someone else) revert this. I won't be able to look at it until tonight. 

-Hal 

----- Original Message -----

> From: "Chris Matthews" <chris.matthews at apple.com>
> To: "Hal Finkel" <hfinkel at anl.gov>, cfe-commits at lists.llvm.org
> Sent: Tuesday, October 11, 2016 2:32:33 PM
> Subject: Re: r283685 - When optimizing for size, enable loop
> rerolling by default

> I noticed since this commit there is a test-suite failure:

> http://lab.llvm.org:8080/green/job/perf_darwin_x86_Osflto/64/

> SingleSource.Benchmarks.Adobe-C++.loop_unroll appears to be failing.

> Tailing the output of the program gets:

>> test 236 failed
> test 236 failed
> test 236 failed
> test 236 failed
> test 236 failed
> test 236 failed
> test 236 failed

> On October 8, 2016 at 8:15:40 PM, Hal Finkel via cfe-commits (
> cfe-commits at lists.llvm.org ) wrote:
> > Author: hfinkel
> 
> > Date: Sat Oct 8 22:06:31 2016
> 
> > New Revision: 283685
> 

> > URL: http://llvm.org/viewvc/llvm-project?rev=283685&view=rev
> 
> > Log:
> 
> > When optimizing for size, enable loop rerolling by default
> 

> > We have a loop-rerolling optimization which can be enabled by using
> 
> > -freroll-loops. While sometimes loops are hand-unrolled for
> > performance
> 
> > reasons, when optimizing for size, we should always undo this
> > manual
> 
> > optimization to produce smaller code (our optimizer's unroller will
> > still
> 
> > unroll the rerolled loops if it thinks that is a good idea).
> 

> > Modified:
> 
> > cfe/trunk/lib/Driver/Tools.cpp
> 
> > cfe/trunk/test/Driver/clang_f_opts.c
> 

> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> 
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=283685&r1=283684&r2=283685&view=diff
> 
> > ==============================================================================
> 
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> 
> > +++ cfe/trunk/lib/Driver/Tools.cpp Sat Oct 8 22:06:31 2016
> 
> > @@ -5227,9 +5227,18 @@ void Clang::ConstructJob(Compilation &C,
> 
> > }
> 

> > if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
> 
> > - options::OPT_fno_reroll_loops))
> 
> > + options::OPT_fno_reroll_loops)) {
> 
> > if (A->getOption().matches(options::OPT_freroll_loops))
> 
> > CmdArgs.push_back("-freroll-loops");
> 
> > + } else if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
> 
> > + // If rerolling is not explicitly enabled or disabled, then
> > enable
> > when
> 
> > + // optimizing for size.
> 
> > + if (A->getOption().matches(options::OPT_O)) {
> 
> > + StringRef S(A->getValue());
> 
> > + if (S == "s" || S == "z")
> 
> > + CmdArgs.push_back("-freroll-loops");
> 
> > + }
> 
> > + }
> 

> > Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings);
> 
> > Args.AddLastArg(CmdArgs, options::OPT_funroll_loops,
> 

> > Modified: cfe/trunk/test/Driver/clang_f_opts.c
> 
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=283685&r1=283684&r2=283685&view=diff
> 
> > ==============================================================================
> 
> > --- cfe/trunk/test/Driver/clang_f_opts.c (original)
> 
> > +++ cfe/trunk/test/Driver/clang_f_opts.c Sat Oct 8 22:06:31 2016
> 
> > @@ -47,7 +47,12 @@
> 
> > // CHECK-NO-UNROLL-LOOPS: "-fno-unroll-loops"
> 

> > // RUN: %clang -### -S -freroll-loops %s 2>&1 | FileCheck
> > -check-prefix=CHECK-REROLL-LOOPS %s
> 
> > +// RUN: %clang -### -S -Os %s 2>&1 | FileCheck
> > -check-prefix=CHECK-REROLL-LOOPS %s
> 
> > +// RUN: %clang -### -S -Oz %s 2>&1 | FileCheck
> > -check-prefix=CHECK-REROLL-LOOPS %s
> 
> > // RUN: %clang -### -S -fno-reroll-loops %s 2>&1 | FileCheck
> > -check-prefix=CHECK-NO-REROLL-LOOPS %s
> 
> > +// RUN: %clang -### -S -Os -fno-reroll-loops %s 2>&1 | FileCheck
> > -check-prefix=CHECK-NO-REROLL-LOOPS %s
> 
> > +// RUN: %clang -### -S -Oz -fno-reroll-loops %s 2>&1 | FileCheck
> > -check-prefix=CHECK-NO-REROLL-LOOPS %s
> 
> > +// RUN: %clang -### -S -O1 %s 2>&1 | FileCheck
> > -check-prefix=CHECK-NO-REROLL-LOOPS %s
> 
> > // RUN: %clang -### -S -fno-reroll-loops -freroll-loops %s 2>&1 |
> > FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
> 
> > // RUN: %clang -### -S -freroll-loops -fno-reroll-loops %s 2>&1 |
> > FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
> 
> > // CHECK-REROLL-LOOPS: "-freroll-loops"
> 

> > _______________________________________________
> 
> > cfe-commits mailing list
> 
> > cfe-commits at lists.llvm.org
> 
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

-- 

Hal Finkel 
Lead, Compiler Technology and Programming Languages 
Leadership Computing Facility 
Argonne National Laboratory 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161011/c3650b7e/attachment-0001.html>


More information about the cfe-commits mailing list