Re: [clang] f2d301f - Revert "[codegen] Store address of indirect arguments on the stack"

2023-01-17 Thread Felipe de Azevedo Piovezan via cfe-commits
Apologies, I’ll do it next time!

In the meantime, the reason was posted in D141381

> On Jan 16, 2023, at 13:59, Roman Lebedev  wrote:
> 
> Reminder to please always mention the reason for the revert/recommit
> in the commit message.
> 
> On Mon, Jan 16, 2023 at 7:05 PM Felipe de Azevedo Piovezan via
> cfe-commits  wrote:
>> 
>> 
>> Author: Felipe de Azevedo Piovezan
>> Date: 2023-01-16T13:05:22-03:00
>> New Revision: f2d301fe82869f881b86b51da7b4752972c66707
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707.diff
>> 
>> LOG: Revert "[codegen] Store address of indirect arguments on the stack"
>> 
>> This reverts commit 7e4447a17db4a070f01c8f8a87505a4b2a1b0e3a.
>> 
>> Added:
>> 
>> 
>> Modified:
>>clang/docs/ReleaseNotes.rst
>>clang/lib/CodeGen/CGDebugInfo.cpp
>>clang/lib/CodeGen/CGDebugInfo.h
>>clang/lib/CodeGen/CGDecl.cpp
>>clang/test/CodeGen/aarch64-ls64.c
>>clang/test/CodeGen/atomic-arm64.c
>>clang/test/CodeGenCXX/amdgcn-func-arg.cpp
>>clang/test/CodeGenCXX/debug-info.cpp
>>clang/test/CodeGenCXX/derived-to-base-conv.cpp
>>clang/test/CodeGenCoroutines/coro-params-exp-namespace.cpp
>>clang/test/CodeGenCoroutines/coro-params.cpp
>>clang/test/OpenMP/for_firstprivate_codegen.cpp
>>clang/test/OpenMP/parallel_firstprivate_codegen.cpp
>>clang/test/OpenMP/sections_firstprivate_codegen.cpp
>>clang/test/OpenMP/single_firstprivate_codegen.cpp
>>clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
>>
>> clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
>>
>> clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
>>
>> clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_firstprivate_codegen.cpp
>> 
>> Removed:
>> 
>> 
>> 
>> 
>> diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
>> index 731d10ac64a3f..3bbab951e8a8c 100644
>> --- a/clang/docs/ReleaseNotes.rst
>> +++ b/clang/docs/ReleaseNotes.rst
>> @@ -500,9 +500,6 @@ Non-comprehensive list of changes in this release
>> - Clang can now generate a PCH when using ``-fdelayed-template-parsing`` for
>>   code with templates containing loop hint pragmas, OpenMP pragmas, and
>>   ``#pragma unused``.
>> -- Clang now saves the address of ABI-indirect function parameters on the 
>> stack,
>> -  improving the debug information available in programs compiled without
>> -  optimizations.
>> 
>> 
>> New Compiler Flags
>> 
>> diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
>> b/clang/lib/CodeGen/CGDebugInfo.cpp
>> index f2d558456fde4..f53a9d00ae5fd 100644
>> --- a/clang/lib/CodeGen/CGDebugInfo.cpp
>> +++ b/clang/lib/CodeGen/CGDebugInfo.cpp
>> @@ -4822,10 +4822,9 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
>> 
>> llvm::DILocalVariable *
>> CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *VD, llvm::Value *AI,
>> -  unsigned ArgNo, CGBuilderTy &Builder,
>> -  const bool UsePointerValue) {
>> +  unsigned ArgNo, CGBuilderTy &Builder) 
>> {
>>   assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
>> -  return EmitDeclare(VD, AI, ArgNo, Builder, UsePointerValue);
>> +  return EmitDeclare(VD, AI, ArgNo, Builder);
>> }
>> 
>> namespace {
>> 
>> diff  --git a/clang/lib/CodeGen/CGDebugInfo.h 
>> b/clang/lib/CodeGen/CGDebugInfo.h
>> index 10660a2550b56..95484a060cd88 100644
>> --- a/clang/lib/CodeGen/CGDebugInfo.h
>> +++ b/clang/lib/CodeGen/CGDebugInfo.h
>> @@ -487,9 +487,10 @@ class CGDebugInfo {
>> 
>>   /// Emit call to \c llvm.dbg.declare for an argument variable
>>   /// declaration.
>> -  llvm::DILocalVariable *
>> -  EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned 
>> ArgNo,
>> -   CGBuilderTy &Builder, bool UsePointerValue = 
>> false);
>> +  llvm::DILocalVariable *EmitDeclareOfArgVariable(const VarDecl *Decl,
>> +  llvm::Value *AI,
>> +  unsigned ArgNo,
>> +  CGBuilderTy &Builder);
>> 
>>   /// Emit call to \c llvm.dbg.declare for the block-literal argument
>>   /// to a block invocation function.
>> 
>> diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
>> index a70997f5b27b8..ceaddc4e694ac 100644
>> --- a/clang/li

Re: [clang] f2d301f - Revert "[codegen] Store address of indirect arguments on the stack"

2023-01-16 Thread Roman Lebedev via cfe-commits
Reminder to please always mention the reason for the revert/recommit
in the commit message.

On Mon, Jan 16, 2023 at 7:05 PM Felipe de Azevedo Piovezan via
cfe-commits  wrote:
>
>
> Author: Felipe de Azevedo Piovezan
> Date: 2023-01-16T13:05:22-03:00
> New Revision: f2d301fe82869f881b86b51da7b4752972c66707
>
> URL: 
> https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707
> DIFF: 
> https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707.diff
>
> LOG: Revert "[codegen] Store address of indirect arguments on the stack"
>
> This reverts commit 7e4447a17db4a070f01c8f8a87505a4b2a1b0e3a.
>
> Added:
>
>
> Modified:
> clang/docs/ReleaseNotes.rst
> clang/lib/CodeGen/CGDebugInfo.cpp
> clang/lib/CodeGen/CGDebugInfo.h
> clang/lib/CodeGen/CGDecl.cpp
> clang/test/CodeGen/aarch64-ls64.c
> clang/test/CodeGen/atomic-arm64.c
> clang/test/CodeGenCXX/amdgcn-func-arg.cpp
> clang/test/CodeGenCXX/debug-info.cpp
> clang/test/CodeGenCXX/derived-to-base-conv.cpp
> clang/test/CodeGenCoroutines/coro-params-exp-namespace.cpp
> clang/test/CodeGenCoroutines/coro-params.cpp
> clang/test/OpenMP/for_firstprivate_codegen.cpp
> clang/test/OpenMP/parallel_firstprivate_codegen.cpp
> clang/test/OpenMP/sections_firstprivate_codegen.cpp
> clang/test/OpenMP/single_firstprivate_codegen.cpp
> clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
> 
> clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
> 
> clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
> clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
> clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
> clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
> 
> clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
> clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
> clang/test/OpenMP/teams_firstprivate_codegen.cpp
>
> Removed:
>
>
>
> 
> diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
> index 731d10ac64a3f..3bbab951e8a8c 100644
> --- a/clang/docs/ReleaseNotes.rst
> +++ b/clang/docs/ReleaseNotes.rst
> @@ -500,9 +500,6 @@ Non-comprehensive list of changes in this release
>  - Clang can now generate a PCH when using ``-fdelayed-template-parsing`` for
>code with templates containing loop hint pragmas, OpenMP pragmas, and
>``#pragma unused``.
> -- Clang now saves the address of ABI-indirect function parameters on the 
> stack,
> -  improving the debug information available in programs compiled without
> -  optimizations.
>
>
>  New Compiler Flags
>
> diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
> b/clang/lib/CodeGen/CGDebugInfo.cpp
> index f2d558456fde4..f53a9d00ae5fd 100644
> --- a/clang/lib/CodeGen/CGDebugInfo.cpp
> +++ b/clang/lib/CodeGen/CGDebugInfo.cpp
> @@ -4822,10 +4822,9 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
>
>  llvm::DILocalVariable *
>  CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *VD, llvm::Value *AI,
> -  unsigned ArgNo, CGBuilderTy &Builder,
> -  const bool UsePointerValue) {
> +  unsigned ArgNo, CGBuilderTy &Builder) {
>assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
> -  return EmitDeclare(VD, AI, ArgNo, Builder, UsePointerValue);
> +  return EmitDeclare(VD, AI, ArgNo, Builder);
>  }
>
>  namespace {
>
> diff  --git a/clang/lib/CodeGen/CGDebugInfo.h 
> b/clang/lib/CodeGen/CGDebugInfo.h
> index 10660a2550b56..95484a060cd88 100644
> --- a/clang/lib/CodeGen/CGDebugInfo.h
> +++ b/clang/lib/CodeGen/CGDebugInfo.h
> @@ -487,9 +487,10 @@ class CGDebugInfo {
>
>/// Emit call to \c llvm.dbg.declare for an argument variable
>/// declaration.
> -  llvm::DILocalVariable *
> -  EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned 
> ArgNo,
> -   CGBuilderTy &Builder, bool UsePointerValue = 
> false);
> +  llvm::DILocalVariable *EmitDeclareOfArgVariable(const VarDecl *Decl,
> +  llvm::Value *AI,
> +  unsigned ArgNo,
> +  CGBuilderTy &Builder);
>
>/// Emit call to \c llvm.dbg.declare for the block-literal argument
>/// to a block invocation function.
>
> diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
> index a70997f5b27b8..ceaddc4e694ac 100644
> --- a/clang/lib/CodeGen/CGDecl.cpp
> +++ b/clang/lib/CodeGen/CGDecl.cpp
> @@ -2476,8 +2476,6 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, 
> ParamValue Arg,
>Address AllocaPtr = Address::invalid();
>bool DoStore = false;
>bool IsScalar = ha

[clang] f2d301f - Revert "[codegen] Store address of indirect arguments on the stack"

2023-01-16 Thread Felipe de Azevedo Piovezan via cfe-commits

Author: Felipe de Azevedo Piovezan
Date: 2023-01-16T13:05:22-03:00
New Revision: f2d301fe82869f881b86b51da7b4752972c66707

URL: 
https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707
DIFF: 
https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707.diff

LOG: Revert "[codegen] Store address of indirect arguments on the stack"

This reverts commit 7e4447a17db4a070f01c8f8a87505a4b2a1b0e3a.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/CodeGen/CGDecl.cpp
clang/test/CodeGen/aarch64-ls64.c
clang/test/CodeGen/atomic-arm64.c
clang/test/CodeGenCXX/amdgcn-func-arg.cpp
clang/test/CodeGenCXX/debug-info.cpp
clang/test/CodeGenCXX/derived-to-base-conv.cpp
clang/test/CodeGenCoroutines/coro-params-exp-namespace.cpp
clang/test/CodeGenCoroutines/coro-params.cpp
clang/test/OpenMP/for_firstprivate_codegen.cpp
clang/test/OpenMP/parallel_firstprivate_codegen.cpp
clang/test/OpenMP/sections_firstprivate_codegen.cpp
clang/test/OpenMP/single_firstprivate_codegen.cpp
clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp

clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp

clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp

clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
clang/test/OpenMP/teams_firstprivate_codegen.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 731d10ac64a3f..3bbab951e8a8c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -500,9 +500,6 @@ Non-comprehensive list of changes in this release
 - Clang can now generate a PCH when using ``-fdelayed-template-parsing`` for
   code with templates containing loop hint pragmas, OpenMP pragmas, and
   ``#pragma unused``.
-- Clang now saves the address of ABI-indirect function parameters on the stack,
-  improving the debug information available in programs compiled without
-  optimizations.
 
 
 New Compiler Flags

diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index f2d558456fde4..f53a9d00ae5fd 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -4822,10 +4822,9 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
 
 llvm::DILocalVariable *
 CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *VD, llvm::Value *AI,
-  unsigned ArgNo, CGBuilderTy &Builder,
-  const bool UsePointerValue) {
+  unsigned ArgNo, CGBuilderTy &Builder) {
   assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
-  return EmitDeclare(VD, AI, ArgNo, Builder, UsePointerValue);
+  return EmitDeclare(VD, AI, ArgNo, Builder);
 }
 
 namespace {

diff  --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 10660a2550b56..95484a060cd88 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -487,9 +487,10 @@ class CGDebugInfo {
 
   /// Emit call to \c llvm.dbg.declare for an argument variable
   /// declaration.
-  llvm::DILocalVariable *
-  EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned 
ArgNo,
-   CGBuilderTy &Builder, bool UsePointerValue = false);
+  llvm::DILocalVariable *EmitDeclareOfArgVariable(const VarDecl *Decl,
+  llvm::Value *AI,
+  unsigned ArgNo,
+  CGBuilderTy &Builder);
 
   /// Emit call to \c llvm.dbg.declare for the block-literal argument
   /// to a block invocation function.

diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index a70997f5b27b8..ceaddc4e694ac 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -2476,8 +2476,6 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, 
ParamValue Arg,
   Address AllocaPtr = Address::invalid();
   bool DoStore = false;
   bool IsScalar = hasScalarEvaluationKind(Ty);
-  bool UseIndirectDebugAddress = false;
-
   // If we already have a pointer to the argument, reuse the input pointer.
   if (Arg.isIndirect()) {
 // If we have a prettier pointer type at this point, bitcast to that.
@@ -2489,19 +2487,6 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, 
ParamValue Arg,
 auto AllocaAS = CGM.getASTAlloc