Re: [clang] 4821508 - Revert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info"

2022-07-27 Thread David Blaikie via cfe-commits
Excuse the delay - yeah, pulled out the fix in
4e719e0f16933a8945a4e85db39fdad5afbede36

On Fri, Jul 1, 2022 at 7:21 AM Robinson, Paul  wrote:
>
> Hi Dave,
>
> The original commit message included
> Also fix a bug I found along the way that was causing ctor type homing
> to kick in even when something could be vtable homed
>
> Is it reasonable to fix that without removing ctor homing in general?
> Or would that cause too much test churn, as you're planning to recommit
> this patch anyway?
> --paulr
>
> > -Original Message-
> > From: cfe-commits  On Behalf Of David
> > Blaikie via cfe-commits
> > Sent: Friday, June 24, 2022 1:08 PM
> > To: cfe-commits@lists.llvm.org
> > Subject: [clang] 4821508 - Revert "DebugInfo: Fully integrate ctor type
> > homing into 'limited' debug info"
> >
> >
> > Author: David Blaikie
> > Date: 2022-06-24T17:07:47Z
> > New Revision: 4821508d4db75a535d02b8938f81fac6de66cc26
> >
> > URL: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> > project/commit/4821508d4db75a535d02b8938f81fac6de66cc26__;!!JmoZiZGBv3RvKR
> > Sx!7pmjZG0ponrxAVY0dOSOTgWfvxMgERh3TNpn2zRGr7NTuooxwQKHzTroRX39LtKaKCXGoQD
> > n3Ri4BOhJymrwDVc8Rzk$
> > DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> > project/commit/4821508d4db75a535d02b8938f81fac6de66cc26.diff__;!!JmoZiZGBv
> > 3RvKRSx!7pmjZG0ponrxAVY0dOSOTgWfvxMgERh3TNpn2zRGr7NTuooxwQKHzTroRX39LtKaKC
> > XGoQDn3Ri4BOhJymrwKAIx5Rg$
> >
> > LOG: Revert "DebugInfo: Fully integrate ctor type homing into 'limited'
> > debug info"
> >
> > Reverting to simplify some Google-internal rollout issues. Will recommit
> > in a week or two.
> >
> > This reverts commit 517bbc64dbe493644eff8d55fd9566435e930520.
> >
> > Added:
> > clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp
> >
> > Modified:
> > clang/docs/UsersManual.rst
> > clang/include/clang/Basic/CodeGenOptions.h
> > clang/include/clang/Basic/DebugInfoOptions.h
> > clang/include/clang/Driver/Options.td
> > clang/lib/CodeGen/CGDebugInfo.cpp
> > clang/lib/Driver/ToolChains/Clang.cpp
> > clang/lib/Frontend/CompilerInvocation.cpp
> > clang/test/CodeGen/attr-cpuspecific-renaming.cpp
> > clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
> > clang/test/CodeGenCXX/debug-info-class.cpp
> > clang/test/CodeGenCXX/debug-info-limited-ctor.cpp
> > clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
> > clang/test/CodeGenCXX/debug-lambda-this.cpp
> > clang/test/CodeGenCXX/ibm128-declarations.cpp
> > clang/test/CodeGenCXX/standalone-debug-attribute.cpp
> > clang/test/Driver/cl-options.c
> > clang/test/Driver/clang-g-opts.c
> > clang/test/Driver/cuda-dwarf-2.cu
> > clang/test/Driver/debug-options-as.c
> > clang/test/Driver/debug-options.c
> > clang/test/Driver/integrated-as.s
> > clang/test/Driver/myriad-toolchain.c
> > clang/test/Driver/openmp-offload-gpu.c
> > clang/test/Driver/split-debug.c
> > clang/test/OpenMP/debug_private.c
> > clang/test/OpenMP/debug_task_shared.c
> > clang/test/OpenMP/debug_threadprivate_copyin.c
> >
> > Removed:
> >
> >
> >
> > ##
> > ##
> > diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
> > index ccb5fed1cb370..e12dc72407b13 100644
> > --- a/clang/docs/UsersManual.rst
> > +++ b/clang/docs/UsersManual.rst
> > @@ -2672,6 +2672,19 @@ below. If multiple flags are present, the last one
> > is used.
> > **-fno-standalone-debug** option can be used to get to turn on the
> > vtable-based optimization described above.
> >
> > +.. option:: -fuse-ctor-homing
> > +
> > +   This optimization is similar to the optimizations that are enabled as
> > part
> > +   of -fno-standalone-debug. Here, Clang only emits type info for a
> > +   non-trivial, non-aggregate C++ class in the modules that contain a
> > +   definition of one of its constructors. This relies on the additional
> > +   assumption that all classes that are not trivially constructible have
> > a
> > +   non-trivial constructor that is used somewhere. The negation,
> > +   -fno-use-ctor-homing, ensures that constructor homing is not used.
> > +
> > +   This flag is not enabled by default, and needs to be used with -cc1 or
> > +   -Xclang.
> > +
> >  .. option:: -g
> >
> >Generate complete debug info.
> >
> > diff  --git a/clang/include/clang/Basic/CodeGenOptions.h
> > b/clang/include/clang/Basic/CodeGenOptions.h
> > index 5f5218c87a605..23d76c308d847 100644
> > --- a/clang/include/clang/Basic/CodeGenOptions.h
> > +++ b/clang/include/clang/Basic/CodeGenOptions.h
> > @@ -468,7 +468,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
> >
> >/// Check if type and variable info should be emitted.
> >bool hasReducedDebugInfo() const {
> > -return getDebugInfo() >= codegenoptions::LimitedDebugInfo;
> > +return getDebugInfo() >= codegenoptions::DebugInfoConstructor;
> > 

RE: [clang] 4821508 - Revert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info"

2022-07-01 Thread Robinson, Paul via cfe-commits
Hi Dave,

The original commit message included
Also fix a bug I found along the way that was causing ctor type homing
to kick in even when something could be vtable homed

Is it reasonable to fix that without removing ctor homing in general?
Or would that cause too much test churn, as you're planning to recommit
this patch anyway?
--paulr

> -Original Message-
> From: cfe-commits  On Behalf Of David
> Blaikie via cfe-commits
> Sent: Friday, June 24, 2022 1:08 PM
> To: cfe-commits@lists.llvm.org
> Subject: [clang] 4821508 - Revert "DebugInfo: Fully integrate ctor type
> homing into 'limited' debug info"
> 
> 
> Author: David Blaikie
> Date: 2022-06-24T17:07:47Z
> New Revision: 4821508d4db75a535d02b8938f81fac6de66cc26
> 
> URL: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> project/commit/4821508d4db75a535d02b8938f81fac6de66cc26__;!!JmoZiZGBv3RvKR
> Sx!7pmjZG0ponrxAVY0dOSOTgWfvxMgERh3TNpn2zRGr7NTuooxwQKHzTroRX39LtKaKCXGoQD
> n3Ri4BOhJymrwDVc8Rzk$
> DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> project/commit/4821508d4db75a535d02b8938f81fac6de66cc26.diff__;!!JmoZiZGBv
> 3RvKRSx!7pmjZG0ponrxAVY0dOSOTgWfvxMgERh3TNpn2zRGr7NTuooxwQKHzTroRX39LtKaKC
> XGoQDn3Ri4BOhJymrwKAIx5Rg$
> 
> LOG: Revert "DebugInfo: Fully integrate ctor type homing into 'limited'
> debug info"
> 
> Reverting to simplify some Google-internal rollout issues. Will recommit
> in a week or two.
> 
> This reverts commit 517bbc64dbe493644eff8d55fd9566435e930520.
> 
> Added:
> clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp
> 
> Modified:
> clang/docs/UsersManual.rst
> clang/include/clang/Basic/CodeGenOptions.h
> clang/include/clang/Basic/DebugInfoOptions.h
> clang/include/clang/Driver/Options.td
> clang/lib/CodeGen/CGDebugInfo.cpp
> clang/lib/Driver/ToolChains/Clang.cpp
> clang/lib/Frontend/CompilerInvocation.cpp
> clang/test/CodeGen/attr-cpuspecific-renaming.cpp
> clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
> clang/test/CodeGenCXX/debug-info-class.cpp
> clang/test/CodeGenCXX/debug-info-limited-ctor.cpp
> clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
> clang/test/CodeGenCXX/debug-lambda-this.cpp
> clang/test/CodeGenCXX/ibm128-declarations.cpp
> clang/test/CodeGenCXX/standalone-debug-attribute.cpp
> clang/test/Driver/cl-options.c
> clang/test/Driver/clang-g-opts.c
> clang/test/Driver/cuda-dwarf-2.cu
> clang/test/Driver/debug-options-as.c
> clang/test/Driver/debug-options.c
> clang/test/Driver/integrated-as.s
> clang/test/Driver/myriad-toolchain.c
> clang/test/Driver/openmp-offload-gpu.c
> clang/test/Driver/split-debug.c
> clang/test/OpenMP/debug_private.c
> clang/test/OpenMP/debug_task_shared.c
> clang/test/OpenMP/debug_threadprivate_copyin.c
> 
> Removed:
> 
> 
> 
> ##
> ##
> diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
> index ccb5fed1cb370..e12dc72407b13 100644
> --- a/clang/docs/UsersManual.rst
> +++ b/clang/docs/UsersManual.rst
> @@ -2672,6 +2672,19 @@ below. If multiple flags are present, the last one
> is used.
> **-fno-standalone-debug** option can be used to get to turn on the
> vtable-based optimization described above.
> 
> +.. option:: -fuse-ctor-homing
> +
> +   This optimization is similar to the optimizations that are enabled as
> part
> +   of -fno-standalone-debug. Here, Clang only emits type info for a
> +   non-trivial, non-aggregate C++ class in the modules that contain a
> +   definition of one of its constructors. This relies on the additional
> +   assumption that all classes that are not trivially constructible have
> a
> +   non-trivial constructor that is used somewhere. The negation,
> +   -fno-use-ctor-homing, ensures that constructor homing is not used.
> +
> +   This flag is not enabled by default, and needs to be used with -cc1 or
> +   -Xclang.
> +
>  .. option:: -g
> 
>Generate complete debug info.
> 
> diff  --git a/clang/include/clang/Basic/CodeGenOptions.h
> b/clang/include/clang/Basic/CodeGenOptions.h
> index 5f5218c87a605..23d76c308d847 100644
> --- a/clang/include/clang/Basic/CodeGenOptions.h
> +++ b/clang/include/clang/Basic/CodeGenOptions.h
> @@ -468,7 +468,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
> 
>/// Check if type and variable info should be emitted.
>bool hasReducedDebugInfo() const {
> -return getDebugInfo() >= codegenoptions::LimitedDebugInfo;
> +return getDebugInfo() >= codegenoptions::DebugInfoConstructor;
>}
> 
>/// Check if maybe unused type info should be emitted.
> 
> diff  --git a/clang/include/clang/Basic/DebugInfoOptions.h
> b/clang/include/clang/Basic/DebugInfoOptions.h
> index 98210cc3cfa13..a99a2b5903d7e 100644
> --- a/clang/include/clang/Basic/DebugInfoOptions.h
> +++ b/clang/include/clang/Basic/DebugInfoOptions.h
> @@ -34,6 +34,12 @@ enum