r191695 - Turn struct-path aware TBAA on by default.

Eric Christopher echristo at gmail.com
Tue Oct 1 10:19:07 PDT 2013


On Tue, Oct 1, 2013 at 10:11 AM, Manman Ren <manman.ren at gmail.com> wrote:
>
> This is an incremental step on top of scalar TBAA.

This isn't really an incremental step given the size and complexity of
the implementation.

>
> I collected stats when building SPEC targeting x86:
> First number is without struct-path aware TBAA, the second number is with,
> the third number is the difference.
>
> GVN_blocks_merged                         398     405     7
> GVN_equalities_propagated              10759 10813 54
> GVN_instructions_PRE                      2967   2911 -56
> GVN_instructions_deleted                  261595  265409 3814
> GVN_instructions_simplified              70826 71195 369
> GVN_loads_PRE                               20444 20677 233
> GVN_loads_deleted                           76842 79041 2199
> LICM_instructions_hoisted                114225 115546 1321
> LICM_instructions_sunk                     5 17 12
> LICM_load_insts_hoisted_or_sunk    21430 22070 640
> LICM_memory_locations_promoted  74 85 11
>
> I also observed 1% to 2% performance improvement on some benchmarks.
>

Could you show these numbers? Keep in mind that turning other such
things on by default has usually been shown with real numbers and
tested more widely - or at least discussion.

-eric



> Manman
>
>
> On Mon, Sep 30, 2013 at 9:49 PM, Eric Christopher <echristo at gmail.com>
> wrote:
>>
>> Do you have any numbers or anything showing this as being a win?
>>
>> -eric
>>
>> On Mon, Sep 30, 2013 at 12:35 PM, Manman Ren <manman.ren at gmail.com> wrote:
>> > Author: mren
>> > Date: Mon Sep 30 14:35:19 2013
>> > New Revision: 191695
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=191695&view=rev
>> > Log:
>> > Turn struct-path aware TBAA on by default.
>> >
>> > Use -no-struct-path-tbaa to turn it off.
>> >
>> > Modified:
>> >     cfe/trunk/include/clang/Driver/CC1Options.td
>> >     cfe/trunk/include/clang/Driver/Options.td
>> >     cfe/trunk/lib/Driver/Tools.cpp
>> >     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> >     cfe/trunk/test/CodeGen/bitfield.c
>> >     cfe/trunk/test/CodeGen/may-alias.c
>> >     cfe/trunk/test/CodeGen/tbaa-class.cpp
>> >     cfe/trunk/test/CodeGen/tbaa.cpp
>> >
>> > Modified: cfe/trunk/include/clang/Driver/CC1Options.td
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
>> > +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Sep 30 14:35:19
>> > 2013
>> > @@ -165,8 +165,8 @@ def fuse_register_sized_bitfield_access:
>> >    HelpText<"Use register sized accesses to bit-fields, when
>> > possible.">;
>> >  def relaxed_aliasing : Flag<["-"], "relaxed-aliasing">,
>> >    HelpText<"Turn off Type Based Alias Analysis">;
>> > -def struct_path_tbaa : Flag<["-"], "struct-path-tbaa">,
>> > -  HelpText<"Turn on struct-path aware Type Based Alias Analysis">;
>> > +def no_struct_path_tbaa : Flag<["-"], "no-struct-path-tbaa">,
>> > +  HelpText<"Turn off struct-path aware Type Based Alias Analysis">;
>> >  def masm_verbose : Flag<["-"], "masm-verbose">,
>> >    HelpText<"Generate verbose assembly output">;
>> >  def mcode_model : Separate<["-"], "mcode-model">,
>> >
>> > Modified: cfe/trunk/include/clang/Driver/Options.td
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/include/clang/Driver/Options.td (original)
>> > +++ cfe/trunk/include/clang/Driver/Options.td Mon Sep 30 14:35:19 2013
>> > @@ -646,6 +646,7 @@ def fno_spell_checking : Flag<["-"], "fn
>> >  def fno_stack_protector : Flag<["-"], "fno-stack-protector">,
>> > Group<f_Group>;
>> >  def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">,
>> > Group<f_Group>;
>> >  def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">,
>> > Group<f_Group>;
>> > +def fno_struct_path_tbaa : Flag<["-"], "fno-struct-path-tbaa">,
>> > Group<f_Group>;
>> >  def fno_strict_enums : Flag<["-"], "fno-strict-enums">, Group<f_Group>;
>> >  def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">,
>> > Group<f_Group>;
>> >  def fno_threadsafe_statics : Flag<["-"], "fno-threadsafe-statics">,
>> > Group<f_Group>,
>> >
>> > Modified: cfe/trunk/lib/Driver/Tools.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> > +++ cfe/trunk/lib/Driver/Tools.cpp Mon Sep 30 14:35:19 2013
>> > @@ -2183,8 +2183,9 @@ void Clang::ConstructJob(Compilation &C,
>> >                      options::OPT_fno_strict_aliasing,
>> >                      getToolChain().IsStrictAliasingDefault()))
>> >      CmdArgs.push_back("-relaxed-aliasing");
>> > -  if (Args.hasArg(options::OPT_fstruct_path_tbaa))
>> > -    CmdArgs.push_back("-struct-path-tbaa");
>> > +  if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
>> > +                    options::OPT_fno_struct_path_tbaa))
>> > +    CmdArgs.push_back("-no-struct-path-tbaa");
>> >    if (Args.hasFlag(options::OPT_fstrict_enums,
>> > options::OPT_fno_strict_enums,
>> >                     false))
>> >      CmdArgs.push_back("-fstrict-enums");
>> >
>> > Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
>> > +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Sep 30 14:35:19
>> > 2013
>> > @@ -344,7 +344,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
>> >    Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
>> >      OPT_fuse_register_sized_bitfield_access);
>> >    Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
>> > -  Opts.StructPathTBAA = Args.hasArg(OPT_struct_path_tbaa);
>> > +  Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
>> >    Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
>> >    Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
>> >    Opts.NoCommon = Args.hasArg(OPT_fno_common);
>> >
>> > Modified: cfe/trunk/test/CodeGen/bitfield.c
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/bitfield.c?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/test/CodeGen/bitfield.c (original)
>> > +++ cfe/trunk/test/CodeGen/bitfield.c Mon Sep 30 14:35:19 2013
>> > @@ -1,5 +1,5 @@
>> > -// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -O3
>> > | FileCheck %s
>> > -// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -O3
>> > -struct-path-tbaa | FileCheck %s --check-prefix=PATH
>> > +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -O3
>> > -no-struct-path-tbaa | FileCheck %s
>> > +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -O3
>> > | FileCheck %s --check-prefix=PATH
>> >
>> >  static int f0(int n) {
>> >    struct s0 {
>> >
>> > Modified: cfe/trunk/test/CodeGen/may-alias.c
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/may-alias.c?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/test/CodeGen/may-alias.c (original)
>> > +++ cfe/trunk/test/CodeGen/may-alias.c Mon Sep 30 14:35:19 2013
>> > @@ -1,5 +1,5 @@
>> > -// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1
>> > -disable-llvm-optzns -o - %s | FileCheck %s
>> > -// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1
>> > -struct-path-tbaa -disable-llvm-optzns -o - %s | FileCheck %s
>> > -check-prefix=PATH
>> > +// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1
>> > -no-struct-path-tbaa -disable-llvm-optzns -o - %s | FileCheck %s
>> > +// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1
>> > -disable-llvm-optzns -o - %s | FileCheck %s -check-prefix=PATH
>> >
>> >  // Types with the may_alias attribute should be considered equivalent
>> >  // to char for aliasing.
>> >
>> > Modified: cfe/trunk/test/CodeGen/tbaa-class.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/tbaa-class.cpp?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/test/CodeGen/tbaa-class.cpp (original)
>> > +++ cfe/trunk/test/CodeGen/tbaa-class.cpp Mon Sep 30 14:35:19 2013
>> > @@ -1,5 +1,5 @@
>> > -// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns
>> > %s -emit-llvm -o - | FileCheck %s
>> > -// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -struct-path-tbaa
>> > -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH
>> > +// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -no-struct-path-tbaa
>> > -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s
>> > +// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns
>> > %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH
>> >  // Test TBAA metadata generated by front-end.
>> >
>> >  typedef unsigned char uint8_t;
>> >
>> > Modified: cfe/trunk/test/CodeGen/tbaa.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/tbaa.cpp?rev=191695&r1=191694&r2=191695&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/test/CodeGen/tbaa.cpp (original)
>> > +++ cfe/trunk/test/CodeGen/tbaa.cpp Mon Sep 30 14:35:19 2013
>> > @@ -1,5 +1,5 @@
>> > -// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns
>> > %s -emit-llvm -o - | FileCheck %s
>> > -// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -struct-path-tbaa
>> > -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH
>> > +// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -no-struct-path-tbaa
>> > -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s
>> > +// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns
>> > %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH
>> >  // Test TBAA metadata generated by front-end.
>> >
>> >  typedef unsigned char uint8_t;
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>



More information about the cfe-commits mailing list