[PATCH] D69427: Fix compilation error in clangd/refactor/tweaks/ExpandAutoType.cpp

2019-10-25 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov created this revision.
psamolysov added projects: clang, clang-tools-extra.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, 
MaskRay, ilya-biryukov.

During the compilation of the `clangd/refactor/tweaks/ExpandAutoType.cpp`, MSVC 
returns the following error:

llvm-monorepo\llvm\tools\clang\tools\extra\clangd\refactor\tweaks\ExpandAutoType.cpp(85):
 error C2146: syntax error: missing ')' before identifier 'and'
llvm-monorepo\llvm\tools\clang\tools\extra\clangd\refactor\tweaks\ExpandAutoType.cpp(85):
 error C2065: 'and': undeclared identifier
llvm-monorepo\llvm\tools\clang\tools\extra\clangd\refactor\tweaks\ExpandAutoType.cpp(86):
 error C2143: syntax error: missing ';' before ''
llvm-monorepo\llvm\tools\clang\tools\extra\clangd\refactor\tweaks\ExpandAutoType.cpp(73):
 fatal error C1075: '{': no matching token found

So, && must be used instead of `and`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69427

Files:
  clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp


Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -82,7 +82,7 @@
   }
 
   // if it's a lambda expression, return an error message
-  if (isa(*DeducedType) and
+  if (isa(*DeducedType) &&
   dyn_cast(*DeducedType)->getDecl()->isLambda()) {
 return createErrorMessage("Could not expand type of lambda expression",
   Inputs);


Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -82,7 +82,7 @@
   }
 
   // if it's a lambda expression, return an error message
-  if (isa(*DeducedType) and
+  if (isa(*DeducedType) &&
   dyn_cast(*DeducedType)->getDecl()->isLambda()) {
 return createErrorMessage("Could not expand type of lambda expression",
   Inputs);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69427: Fix compilation error in clangd/refactor/tweaks/ExpandAutoType.cpp

2019-10-25 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

I have no commit access, can anyone land this small fix, please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69427/new/

https://reviews.llvm.org/D69427



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-28 Thread Pavel Samolysov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb10a341aa5b0: [Pipelines] Introduce DAE after 
ArgumentPromotion (authored by psamolysov).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/InstCombine/unused-nonnull.ll
  llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll

Index: llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
===
--- llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
+++ llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
@@ -9,7 +9,7 @@
 
 define internal void @f(%struct.ss* byval(%struct.ss) align 8 %b, i32* byval(i32) align 4 %X) noinline nounwind  {
 ; CHECK-LABEL: define {{[^@]+}}@f
-; CHECK-SAME: (i32 [[B_0:%.*]], i32 [[X:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TEMP:%.*]] = add i32 [[B_0]], 1
 ; CHECK-NEXT:store i32 [[TEMP]], i32* [[DUMMY]], align 4
@@ -28,8 +28,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@test
 ; CHECK-SAME: (i32* {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[X_VAL:%.*]] = load i32, i32* [[X]], align 4
-; CHECK-NEXT:tail call {{.*}}void @f(i32 1, i32 [[X_VAL]])
+; CHECK-NEXT:tail call {{.*}}void @f(i32 1)
 ; CHECK-NEXT:ret i32 0
 ;
 entry:
Index: llvm/test/Transforms/InstCombine/unused-nonnull.ll
===
--- llvm/test/Transforms/InstCombine/unused-nonnull.ll
+++ llvm/test/Transforms/InstCombine/unused-nonnull.ll
@@ -9,7 +9,7 @@
 
 define i32 @main(i32 %argc, i8** %argv) #0 {
 ; CHECK-LABEL: define {{[^@]+}}@main
-; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readnone [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readonly [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = icmp slt i32 [[ARGC]], 2
 ; CHECK-NEXT:[[SPEC_SELECT:%.*]] = select i1 [[TMP0]], i32 0, i32 [[ARGC]]
@@ -37,7 +37,8 @@
 
 define i32 @compute(i8* noundef nonnull %ptr, i32 %x) #1 {
 ; CHECK-LABEL: define {{[^@]+}}@compute
-; CHECK-SAME: (i8* nocapture nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; CHECK-SAME: (i8* nocapture noundef nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]])
+; CHECK-SAME:  local_unnamed_addr #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:ret i32 [[X]]
 ;
   ret i32 %x
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -58,7 +58,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
 ; These next two can appear in any order since they are accessed as parameters
@@ -166,6 +165,7 @@
 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
+; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -48,7 +48,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
 ; CHECK-O-NEXT: Running analysis: AAManager
@@ -201,6 +200,7 @@
 ; CHECK-O-NEXT: Running pass: Inv

[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-06-30 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov updated this revision to Diff 441462.
psamolysov added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fix `Clang :: CodeGen/thinlto-distributed-newpm.ll`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/InstCombine/unused-nonnull.ll
  llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll

Index: llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
===
--- llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
+++ llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
@@ -9,7 +9,7 @@
 
 define internal void @f(%struct.ss* byval(%struct.ss) align 8 %b, i32* byval(i32) align 4 %X) noinline nounwind  {
 ; CHECK-LABEL: define {{[^@]+}}@f
-; CHECK-SAME: (i32 [[B_0:%.*]], i32 [[X:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TEMP:%.*]] = add i32 [[B_0]], 1
 ; CHECK-NEXT:store i32 [[TEMP]], i32* [[DUMMY]], align 4
@@ -28,8 +28,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@test
 ; CHECK-SAME: (i32* {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[X_VAL:%.*]] = load i32, i32* [[X]], align 4
-; CHECK-NEXT:tail call {{.*}}void @f(i32 1, i32 [[X_VAL]])
+; CHECK-NEXT:tail call {{.*}}void @f(i32 1)
 ; CHECK-NEXT:ret i32 0
 ;
 entry:
Index: llvm/test/Transforms/InstCombine/unused-nonnull.ll
===
--- llvm/test/Transforms/InstCombine/unused-nonnull.ll
+++ llvm/test/Transforms/InstCombine/unused-nonnull.ll
@@ -9,7 +9,7 @@
 
 define i32 @main(i32 %argc, i8** %argv) #0 {
 ; CHECK-LABEL: define {{[^@]+}}@main
-; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readnone [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readonly [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = icmp slt i32 [[ARGC]], 2
 ; CHECK-NEXT:[[SPEC_SELECT:%.*]] = select i1 [[TMP0]], i32 0, i32 [[ARGC]]
@@ -37,7 +37,8 @@
 
 define i32 @compute(i8* noundef nonnull %ptr, i32 %x) #1 {
 ; CHECK-LABEL: define {{[^@]+}}@compute
-; CHECK-SAME: (i8* nocapture nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; CHECK-SAME: (i8* nocapture noundef nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]])
+; CHECK-SAME:  local_unnamed_addr #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:ret i32 [[X]]
 ;
   ret i32 %x
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -58,7 +58,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
 ; These next two can appear in any order since they are accessed as parameters
@@ -162,6 +161,7 @@
 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
 ; CHECK-O-NEXT: Running pass: CoroSplitPass
 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
+; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -48,7 +48,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
 ; CHECK-O-NEXT: Running analysis: AAManager
@@ -197,6 +196,7 @@
 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
 ; 

[PATCH] D122587: [clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member

2022-03-28 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel created this revision.
psamolysov-intel added reviewers: tejohnson, ddunbar, tobiasvk, tobiasvk_caf.
psamolysov-intel added a project: clang.
Herald added a subscriber: ormris.
Herald added a project: All.
psamolysov-intel requested review of this revision.
Herald added a subscriber: cfe-commits.

Few times in different methods of the EmitAssemblyHelper class the following
code snippet is used to get the TargetTriple and then use it's single method
to check some conditions:

TargetTriple(TheModule->getTargetTriple())

The parsing of a target triple string is not a trivial operation and it takes
time to repeat the parsing many times in different methods of the class and
even numerous times in one method just to call a getter
(llvm::Triple(TheModule->getTargetTriple()).getVendor()), for example.
The patch extracts the TargetTriple member of the EmitAssemblyHelper class to
parse the triple only once in the class' constructor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122587

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -118,6 +118,8 @@
 
   std::unique_ptr OS;
 
+  Triple TargetTriple;
+
   TargetIRAnalysis getTargetIRAnalysis() const {
 if (TM)
   return TM->getTargetIRAnalysis();
@@ -170,7 +172,8 @@
  const LangOptions &LOpts, Module *M)
   : Diags(_Diags), HSOpts(HeaderSearchOpts), CodeGenOpts(CGOpts),
 TargetOpts(TOpts), LangOpts(LOpts), TheModule(M),
-CodeGenerationTime("codegen", "Code Generation Time") {}
+CodeGenerationTime("codegen", "Code Generation Time"),
+TargetTriple(TheModule->getTargetTriple()) {}
 
   ~EmitAssemblyHelper() {
 if (CodeGenOpts.DisableFree)
@@ -694,7 +697,6 @@
   // manually (and not via PMBuilder), since some passes (eg. InstrProfiling)
   // are inserted before PMBuilder ones - they'd get the default-constructed
   // TLI with an unknown target otherwise.
-  Triple TargetTriple(TheModule->getTargetTriple());
   std::unique_ptr TLII(
   createTLII(TargetTriple, CodeGenOpts));
 
@@ -964,7 +966,6 @@
raw_pwrite_stream &OS,
raw_pwrite_stream *DwoOS) {
   // Add LibraryInfo.
-  llvm::Triple TargetTriple(TheModule->getTargetTriple());
   std::unique_ptr TLII(
   createTLII(TargetTriple, CodeGenOpts));
   CodeGenPasses.add(new TargetLibraryInfoWrapperPass(*TLII));
@@ -1053,10 +1054,8 @@
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
   bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO &&
-   !CodeGenOpts.DisableLLVMPasses &&
-   llvm::Triple(TheModule->getTargetTriple()).getVendor() !=
-   llvm::Triple::Apple);
+  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+   TargetTriple.getVendor() != llvm::Triple::Apple);
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
@@ -1337,7 +1336,6 @@
 
   // Register the target library analysis directly and give it a customized
   // preset TLI.
-  Triple TargetTriple(TheModule->getTargetTriple());
   std::unique_ptr TLII(
   createTLII(TargetTriple, CodeGenOpts));
   FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); });
@@ -1473,8 +1471,7 @@
   // targets
   bool EmitLTOSummary =
   (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   llvm::Triple(TheModule->getTargetTriple()).getVendor() !=
-   llvm::Triple::Apple);
+   TargetTriple.getVendor() != llvm::Triple::Apple);
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -118,6 +118,8 @@
 
   std::unique_ptr OS;
 
+  Triple TargetTriple;
+
   TargetIRAnalysis getTargetIRAnalysis() const {
 if (TM)
   return TM->getTargetIRAnalysis();
@@ -170,7 +172,8 @@
  const LangOptions &LOpts, Module *M)
   : Diags(_Diags), HSOpts(HeaderSearchOpts), CodeGenOpts(CGOpts),
 TargetOpts(TOpts), LangOpts(LOpts), TheModule(M),
-CodeGenerationTime("codegen", "Code Generation Time") {}
+CodeGenerationTime("codegen", "Code Generation Time"),
+TargetTriple(TheModule->getTargetTriple()) {}
 
   ~EmitAssemblyHelper() {
 if (CodeGenOpts.DisableFree)
@@ -694,7 +697,6 @@
   // manually (and not via PMBuilder), since some passes (eg. InstrProfiling)
   // are inserted before PMBuilder ones - they'd get

[PATCH] D122587: [clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member

2022-03-28 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel added a comment.

I see some code duplication on lines 1056-1065 and 1472-1481, I have a fix for 
this and going to open a new review after this patch will be landed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122587/new/

https://reviews.llvm.org/D122587

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D122587: [clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member

2022-03-30 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel added a comment.

Thank you @tejohnson for the approve. If there are no objections from someone 
could you (or another committer) help me with the landing, please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122587/new/

https://reviews.llvm.org/D122587

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D122587: [clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member

2022-04-01 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel added a comment.

All tests have been passed. Could anyone with the committer privileges help me 
with landing, please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122587/new/

https://reviews.llvm.org/D122587

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D123026: [clang][NFC] Extract the EmitAssemblyHelper::emitLTOSummary method

2022-04-04 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel created this revision.
psamolysov-intel added reviewers: tejohnson, ddunbar, tobiasvk, tobiasvk_caf, 
paulkirth, greened.
psamolysov-intel added a project: clang.
Herald added subscribers: ormris, inglorion.
Herald added a project: All.
psamolysov-intel requested review of this revision.
Herald added a subscriber: cfe-commits.

The code to check if the LTO summary should be emitted and to add the
corresponding module flags was duplicated in the
'EmitAssemblyHelper::EmitAssemblyWithLegacyPassManager' and
'EmitAssemblyHelper::RunOptimizationPipeline' methods.

  

In order to eliminate these code duplications, the
'EmitAssemblyHelper::emitLTOSummary' method has been extracted. The method
returns a bool value, the value is true if the module summary should be emitted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123026

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -164,6 +164,25 @@
   std::unique_ptr &OS,
   std::unique_ptr &DwoOS);
 
+  /// Emit a module summary by default for Regular LTO except for ld64
+  /// targets.
+  ///
+  /// \return True if the module summary should be emitted.
+  bool emitLTOSummary() {
+bool EmitLTOSummary =
+(CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+ TargetTriple.getVendor() != llvm::Triple::Apple);
+if (EmitLTOSummary) {
+  if (!TheModule->getModuleFlag("ThinLTO"))
+TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
+  if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
+TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
+ uint32_t(1));
+}
+
+return EmitLTOSummary;
+  }
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags,
  const HeaderSearchOptions &HeaderSearchOpts,
@@ -1052,19 +1071,7 @@
   PerModulePasses.add(createWriteThinLTOBitcodePass(
   *OS, ThinLinkOS ? &ThinLinkOS->os() : nullptr));
 } else {
-  // Emit a module summary by default for Regular LTO except for ld64
-  // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
-  if (EmitLTOSummary) {
-if (!TheModule->getModuleFlag("ThinLTO"))
-  TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
-if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
-  TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
-   uint32_t(1));
-  }
-
+  bool EmitLTOSummary = emitLTOSummary();
   PerModulePasses.add(createBitcodeWriterPass(
   *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary));
 }
@@ -1468,18 +1475,7 @@
   MPM.addPass(ThinLTOBitcodeWriterPass(*OS, ThinLinkOS ? &ThinLinkOS->os()
: nullptr));
 } else {
-  // Emit a module summary by default for Regular LTO except for ld64
-  // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
-  if (EmitLTOSummary) {
-if (!TheModule->getModuleFlag("ThinLTO"))
-  TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
-if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
-  TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
-   uint32_t(1));
-  }
+  bool EmitLTOSummary = emitLTOSummary();
   MPM.addPass(
   BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists, 
EmitLTOSummary));
 }


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -164,6 +164,25 @@
   std::unique_ptr &OS,
   std::unique_ptr &DwoOS);
 
+  /// Emit a module summary by default for Regular LTO except for ld64
+  /// targets.
+  ///
+  /// \return True if the module summary should be emitted.
+  bool emitLTOSummary() {
+bool EmitLTOSummary =
+(CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+ TargetTriple.getVendor() != llvm::Triple::Apple);
+if (EmitLTOSummary) {
+  if (!TheModule->getModuleFlag("ThinLTO"))
+TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
+  if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
+TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
+ uint32_t(1));
+}
+
+return EmitLTOSummary;
+  }
+
 public:
   Emi

[PATCH] D123026: [clang][NFC] Extract the EmitAssemblyHelper::emitLTOSummary method

2022-04-05 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel added a comment.

Colleagues, could you review this small non-functional change. After the 
`TargetTruiple` member has been extracted, it becomes clear that there is some 
code duplication in the `BackendUtil.cpp` source file. I think this is a good 
idea to eliminate this code duplication, isn't it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123026/new/

https://reviews.llvm.org/D123026

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D123026: [clang][NFC] Extract the EmitAssemblyHelper::shouldEmitLTOSummary method

2022-04-06 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel updated this revision to Diff 420831.
psamolysov-intel retitled this revision from "[clang][NFC] Extract the 
EmitAssemblyHelper::emitLTOSummary method" to "[clang][NFC] Extract the 
EmitAssemblyHelper::shouldEmitLTOSummary method".
psamolysov-intel edited the summary of this revision.
psamolysov-intel added a comment.

@tejohnson Thank you for your opinion. I've renamed the function member into 
`shouldEmitLTOSummary` and extract the condition only. The code that changes 
the module flags is still inlined. The patch description was also edited to 
reflect these changes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123026/new/

https://reviews.llvm.org/D123026

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -164,6 +164,16 @@
   std::unique_ptr &OS,
   std::unique_ptr &DwoOS);
 
+  /// Check whether we should emit a module summary.
+  /// The module summary should be emitted by default for Regular LTO
+  /// except for ld64 targets.
+  ///
+  /// \return True if the module summary should be emitted.
+  bool shouldEmitLTOSummary() const {
+return CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+   TargetTriple.getVendor() != llvm::Triple::Apple;
+  }
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags,
  const HeaderSearchOptions &HeaderSearchOpts,
@@ -1054,9 +1064,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
@@ -1064,7 +1072,6 @@
   TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
uint32_t(1));
   }
-
   PerModulePasses.add(createBitcodeWriterPass(
   *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary));
 }
@@ -1470,9 +1477,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -164,6 +164,16 @@
   std::unique_ptr &OS,
   std::unique_ptr &DwoOS);
 
+  /// Check whether we should emit a module summary.
+  /// The module summary should be emitted by default for Regular LTO
+  /// except for ld64 targets.
+  ///
+  /// \return True if the module summary should be emitted.
+  bool shouldEmitLTOSummary() const {
+return CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+   TargetTriple.getVendor() != llvm::Triple::Apple;
+  }
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags,
  const HeaderSearchOptions &HeaderSearchOpts,
@@ -1054,9 +1064,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
@@ -1064,7 +1072,6 @@
   TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
uint32_t(1));
   }
-
   PerModulePasses.add(createBitcodeWriterPass(
   *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary));
 }
@@ -1470,9 +1477,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));

[PATCH] D123026: [clang][NFC] Extract EmitAssemblyHelper::shouldEmitRegularLTOSummary

2022-04-06 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel updated this revision to Diff 420888.
psamolysov-intel retitled this revision from "[clang][NFC] Extract the 
EmitAssemblyHelper::shouldEmitLTOSummary method" to "[clang][NFC] Extract 
EmitAssemblyHelper::shouldEmitRegularLTOSummary".
psamolysov-intel edited the summary of this revision.
psamolysov-intel added a comment.

Thank you @tejohnson I've applied the suggested changes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123026/new/

https://reviews.llvm.org/D123026

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -164,6 +164,16 @@
   std::unique_ptr &OS,
   std::unique_ptr &DwoOS);
 
+  /// Check whether we should emit a module summary for regular LTO.
+  /// The module summary should be emitted by default for regular LTO
+  /// except for ld64 targets.
+  ///
+  /// \return True if the module summary should be emitted.
+  bool shouldEmitRegularLTOSummary() const {
+return CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+   TargetTriple.getVendor() != llvm::Triple::Apple;
+  }
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags,
  const HeaderSearchOptions &HeaderSearchOpts,
@@ -1054,9 +1064,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitRegularLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
@@ -1064,7 +1072,6 @@
   TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
uint32_t(1));
   }
-
   PerModulePasses.add(createBitcodeWriterPass(
   *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary));
 }
@@ -1470,9 +1477,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitRegularLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -164,6 +164,16 @@
   std::unique_ptr &OS,
   std::unique_ptr &DwoOS);
 
+  /// Check whether we should emit a module summary for regular LTO.
+  /// The module summary should be emitted by default for regular LTO
+  /// except for ld64 targets.
+  ///
+  /// \return True if the module summary should be emitted.
+  bool shouldEmitRegularLTOSummary() const {
+return CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
+   TargetTriple.getVendor() != llvm::Triple::Apple;
+  }
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags,
  const HeaderSearchOptions &HeaderSearchOpts,
@@ -1054,9 +1064,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitRegularLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
@@ -1064,7 +1072,6 @@
   TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
uint32_t(1));
   }
-
   PerModulePasses.add(createBitcodeWriterPass(
   *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary));
 }
@@ -1470,9 +1477,7 @@
 } else {
   // Emit a module summary by default for Regular LTO except for ld64
   // targets
-  bool EmitLTOSummary =
-  (CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
-   TargetTriple.getVendor() != llvm::Triple::Apple);
+  bool EmitLTOSummary = shouldEmitRegularLTOSummary();
   if (EmitLTOSummary) {
 if (!TheModule->getModuleFlag("ThinLTO"))
   TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/

[PATCH] D123026: [clang][NFC] Extract EmitAssemblyHelper::shouldEmitRegularLTOSummary

2022-04-07 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov-intel marked an inline comment as done.
psamolysov-intel added a comment.

Colleagues, could you help me with landing? @tejohnson has approved the patch 
(if I applied the suggestion as it was expected, thank you @tejohnson!)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123026/new/

https://reviews.llvm.org/D123026

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-07-11 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov updated this revision to Diff 443631.
psamolysov added a comment.

@aeubanks Thank you for the great explanation.

I've applied your suggestion and re-uploaded the patch. The test 
`unused-nonnull.ll` has been fixed with keeping the `readnone` attribute.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/InstCombine/unused-nonnull.ll
  llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll

Index: llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
===
--- llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
+++ llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
@@ -9,7 +9,7 @@
 
 define internal void @f(%struct.ss* byval(%struct.ss) align 8 %b, i32* byval(i32) align 4 %X) noinline nounwind  {
 ; CHECK-LABEL: define {{[^@]+}}@f
-; CHECK-SAME: (i32 [[B_0:%.*]], i32 [[X:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TEMP:%.*]] = add i32 [[B_0]], 1
 ; CHECK-NEXT:store i32 [[TEMP]], i32* [[DUMMY]], align 4
@@ -28,8 +28,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@test
 ; CHECK-SAME: (i32* {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[X_VAL:%.*]] = load i32, i32* [[X]], align 4
-; CHECK-NEXT:tail call {{.*}}void @f(i32 1, i32 [[X_VAL]])
+; CHECK-NEXT:tail call {{.*}}void @f(i32 1)
 ; CHECK-NEXT:ret i32 0
 ;
 entry:
Index: llvm/test/Transforms/InstCombine/unused-nonnull.ll
===
--- llvm/test/Transforms/InstCombine/unused-nonnull.ll
+++ llvm/test/Transforms/InstCombine/unused-nonnull.ll
@@ -37,7 +37,7 @@
 
 define i32 @compute(i8* noundef nonnull %ptr, i32 %x) #1 {
 ; CHECK-LABEL: define {{[^@]+}}@compute
-; CHECK-SAME: (i8* nocapture nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; CHECK-SAME: (i8* nocapture noundef nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:ret i32 [[X]]
 ;
   ret i32 %x
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -58,7 +58,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
 ; These next two can appear in any order since they are accessed as parameters
@@ -81,14 +80,13 @@
 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
 ; CHECK-O-NEXT: Running pass: InlinerPass
 ; CHECK-O-NEXT: Running pass: InlinerPass
-; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
-; CHECK-O-NEXT: Running analysis: AAManager
 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
 ; CHECK-O-NEXT: Running pass: SROAPass
 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
+; CHECK-O-NEXT: Running analysis: AAManager
 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
@@ -160,8 +158,10 @@
 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo
 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo
 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
+; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
 ; CHECK-O-NEXT: Running pass: CoroSplitPass
 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
+; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/

[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-07-11 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov updated this revision to Diff 443661.
psamolysov added a comment.

[Pipelines] Fix the Clang :: CodeGenCoroutines/coro-elide.cpp

Now, the `%_Z5task1v.Frame` type doesn't contain a field of  the
`%_Z5task0v.Frame` one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/CodeGenCoroutines/coro-elide.cpp
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/InstCombine/unused-nonnull.ll
  llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll

Index: llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
===
--- llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
+++ llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
@@ -9,7 +9,7 @@
 
 define internal void @f(%struct.ss* byval(%struct.ss) align 8 %b, i32* byval(i32) align 4 %X) noinline nounwind  {
 ; CHECK-LABEL: define {{[^@]+}}@f
-; CHECK-SAME: (i32 [[B_0:%.*]], i32 [[X:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TEMP:%.*]] = add i32 [[B_0]], 1
 ; CHECK-NEXT:store i32 [[TEMP]], i32* [[DUMMY]], align 4
@@ -28,8 +28,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@test
 ; CHECK-SAME: (i32* {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[X_VAL:%.*]] = load i32, i32* [[X]], align 4
-; CHECK-NEXT:tail call {{.*}}void @f(i32 1, i32 [[X_VAL]])
+; CHECK-NEXT:tail call {{.*}}void @f(i32 1)
 ; CHECK-NEXT:ret i32 0
 ;
 entry:
Index: llvm/test/Transforms/InstCombine/unused-nonnull.ll
===
--- llvm/test/Transforms/InstCombine/unused-nonnull.ll
+++ llvm/test/Transforms/InstCombine/unused-nonnull.ll
@@ -37,7 +37,7 @@
 
 define i32 @compute(i8* noundef nonnull %ptr, i32 %x) #1 {
 ; CHECK-LABEL: define {{[^@]+}}@compute
-; CHECK-SAME: (i8* nocapture nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; CHECK-SAME: (i8* nocapture noundef nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:ret i32 [[X]]
 ;
   ret i32 %x
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -58,7 +58,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
 ; These next two can appear in any order since they are accessed as parameters
@@ -81,14 +80,13 @@
 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
 ; CHECK-O-NEXT: Running pass: InlinerPass
 ; CHECK-O-NEXT: Running pass: InlinerPass
-; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
-; CHECK-O-NEXT: Running analysis: AAManager
 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
 ; CHECK-O-NEXT: Running pass: SROAPass
 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
+; CHECK-O-NEXT: Running analysis: AAManager
 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
@@ -160,8 +158,10 @@
 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo
 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo
 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
+; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
 ; CHECK-O-NEXT: Running pass: CoroSplitPass
 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
+; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ 

[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-07-12 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@aeubanks Hmm, if I correctly get your comment, I should revert this patch to 
the state before the proposed solution with moving the 
`PostOrderFunctionAttrsPass` at the end of the `buildInlinerPipeline` function 
regardless of the `readonly` instead of `readnone` regression. Personally along 
with your concern about compilation time, I have a concern about some changing 
in coroutines compilation, the `Clang :: CodeGenCoroutines/coro-elide.cpp` test 
demonstrates them:

  // CHECK-NOT: %_Z5task1v.Frame = type {{.*}}%_Z5task0v.Frame

instead of

  // CHECK: %_Z5task1v.Frame = type {{.*}}%_Z5task0v.Frame

I've reverted the latest changes because they require more investigation and, 
as you said, should be introduced in a separate patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-07-12 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov updated this revision to Diff 443860.
psamolysov added a comment.

Return the `PostOrderFunctionAttrsPass` pass back on its original place in the 
pipeline.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/InstCombine/unused-nonnull.ll
  llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll

Index: llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
===
--- llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
+++ llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
@@ -9,7 +9,7 @@
 
 define internal void @f(%struct.ss* byval(%struct.ss) align 8 %b, i32* byval(i32) align 4 %X) noinline nounwind  {
 ; CHECK-LABEL: define {{[^@]+}}@f
-; CHECK-SAME: (i32 [[B_0:%.*]], i32 [[X:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TEMP:%.*]] = add i32 [[B_0]], 1
 ; CHECK-NEXT:store i32 [[TEMP]], i32* [[DUMMY]], align 4
@@ -28,8 +28,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@test
 ; CHECK-SAME: (i32* {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[X_VAL:%.*]] = load i32, i32* [[X]], align 4
-; CHECK-NEXT:tail call {{.*}}void @f(i32 1, i32 [[X_VAL]])
+; CHECK-NEXT:tail call {{.*}}void @f(i32 1)
 ; CHECK-NEXT:ret i32 0
 ;
 entry:
Index: llvm/test/Transforms/InstCombine/unused-nonnull.ll
===
--- llvm/test/Transforms/InstCombine/unused-nonnull.ll
+++ llvm/test/Transforms/InstCombine/unused-nonnull.ll
@@ -9,7 +9,7 @@
 
 define i32 @main(i32 %argc, i8** %argv) #0 {
 ; CHECK-LABEL: define {{[^@]+}}@main
-; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readnone [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readonly [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = icmp slt i32 [[ARGC]], 2
 ; CHECK-NEXT:[[SPEC_SELECT:%.*]] = select i1 [[TMP0]], i32 0, i32 [[ARGC]]
@@ -37,7 +37,8 @@
 
 define i32 @compute(i8* noundef nonnull %ptr, i32 %x) #1 {
 ; CHECK-LABEL: define {{[^@]+}}@compute
-; CHECK-SAME: (i8* nocapture nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; CHECK-SAME: (i8* nocapture noundef nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]])
+; CHECK-SAME:  local_unnamed_addr #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:ret i32 [[X]]
 ;
   ret i32 %x
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -58,7 +58,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
 ; These next two can appear in any order since they are accessed as parameters
@@ -162,6 +161,7 @@
 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
 ; CHECK-O-NEXT: Running pass: CoroSplitPass
 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
+; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -48,7 +48,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
 ; CHECK-O-NEXT: Running analysis: AAManager
@@ -197,6 +196,7 @@
 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
 ; CHECK-O-NEXT: Running pass: CoroS

[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-18 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

In D128830#3647168 , @aeubanks wrote:

> ... but let me run some internal benchmarks on this patch

@aeubanks Sorry for the late answer. Did you have a chance to run the 
benchmarks? If so, could you share the results?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-24 Thread Pavel Samolysov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3f20dcbf708c: [Pipelines] Introduce DAE after 
ArgumentPromotion (authored by psamolysov).

Changed prior to commit:
  https://reviews.llvm.org/D128830?vs=443860&id=455093#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/InstCombine/unused-nonnull.ll
  llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll

Index: llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
===
--- llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
+++ llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion.ll
@@ -9,7 +9,7 @@
 
 define internal void @f(%struct.ss* byval(%struct.ss) align 8 %b, i32* byval(i32) align 4 %X) noinline nounwind  {
 ; CHECK-LABEL: define {{[^@]+}}@f
-; CHECK-SAME: (i32 [[B_0:%.*]], i32 [[X:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TEMP:%.*]] = add i32 [[B_0]], 1
 ; CHECK-NEXT:store i32 [[TEMP]], i32* [[DUMMY]], align 4
@@ -28,8 +28,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@test
 ; CHECK-SAME: (i32* {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[X_VAL:%.*]] = load i32, i32* [[X]], align 4
-; CHECK-NEXT:tail call {{.*}}void @f(i32 1, i32 [[X_VAL]])
+; CHECK-NEXT:tail call {{.*}}void @f(i32 1)
 ; CHECK-NEXT:ret i32 0
 ;
 entry:
Index: llvm/test/Transforms/InstCombine/unused-nonnull.ll
===
--- llvm/test/Transforms/InstCombine/unused-nonnull.ll
+++ llvm/test/Transforms/InstCombine/unused-nonnull.ll
@@ -9,7 +9,7 @@
 
 define i32 @main(i32 %argc, i8** %argv) #0 {
 ; CHECK-LABEL: define {{[^@]+}}@main
-; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readnone [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readonly [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = icmp slt i32 [[ARGC]], 2
 ; CHECK-NEXT:[[SPEC_SELECT:%.*]] = select i1 [[TMP0]], i32 0, i32 [[ARGC]]
@@ -37,7 +37,8 @@
 
 define i32 @compute(i8* noundef nonnull %ptr, i32 %x) #1 {
 ; CHECK-LABEL: define {{[^@]+}}@compute
-; CHECK-SAME: (i8* nocapture nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
+; CHECK-SAME: (i8* nocapture noundef nonnull readnone [[PTR:%.*]], i32 returned [[X:%.*]])
+; CHECK-SAME:  local_unnamed_addr #[[ATTR1:[0-9]+]] {
 ; CHECK-NEXT:ret i32 [[X]]
 ;
   ret i32 %x
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -58,7 +58,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
 ; These next two can appear in any order since they are accessed as parameters
@@ -166,6 +165,7 @@
 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
+; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -48,7 +48,6 @@
 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running pass: PromotePass
-; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O-NEXT: Running an

[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-24 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@aeubanks Thank you very much for the benchmark results and review. I've landed 
the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-24 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@Michael137 Thank you very much for the information!

I'm not sure, but it looks like the introduced change of the `readnone` 
attribute to `readonly` might make impact on DWARF. Unfortunately, I have no 
idea should this changes in DWARF be fixed or just it is enough to actualize 
the test.

I've reverted the patch to give our time to make the decision about DWARF 
generation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-24 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

I tried to triage a bit. The test 
`lldb\test\API\functionalities\unused-inlined-parameters\TestUnusedInlinedParameters.py`
 compiles the code in `main.c` with `-O1` and generates the following IR for 
the `@f` function:

  ; Function Attrs: alwaysinline nounwind uwtable
  define dso_local void @f(ptr nocapture noundef readnone %unused1, i32 noundef 
%used, i32 noundef %unused2) local_unnamed_addr #1 {
  entry:
tail call void @use(i32 noundef %used)
ret void
  }

With the reverted patch, the IR looks like the follow:

  ; Function Attrs: alwaysinline nounwind uwtable
  define dso_local void @f(ptr nocapture readnone %unused1, i32 noundef %used, 
i32 %unused2) local_unnamed_addr #1 {
  entry:
tail call void @use(i32 noundef %used)
ret void
  }

So, as we can see, the attribute `readnone` is present for the first unused 
argument for which an additional piece of the DWARF code is generated in both 
IRs but the `noundef` attribute is omitted in the second case (so, this 
attribute is introduces by some changes in the patch and this is "documented" 
by the changes in the `llvm/test/Transforms/InstCombine/unused-nonnull.ll` 
test).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-25 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

Colleagues, thank you for the discussion.

@aprantl @Michael137 Thank you very much for the patch and the test changes and 
confirmation. I've pushed the patch again.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-26 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@mstorsjo Thank you very much for the information. Unfortunately, our tests 
didn't catch this problem.

I've reproduced this on Windows even w/o mingw. Some time is required for 
triaging.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-26 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

No problem, I've reverted the commit while I need some time to build `clang` 
with the reverted commit even for make it clear the commit is guilty.

I'm sorry. It's very interesting, in @mstorsjo case, a function from the 
standard `C` library is used: `strtof`. When I renamed it in the test into 
`strtof2`, the problem has becomes not reproducible.

@Michael137 It looks like some DWARF generation/debugger test can fail after 
the revertion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-08-27 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@aeubanks Thank you for the investigation! I believe this patch can be 
re-landed after D132764  is committed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-09-23 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@aeubanks Thank you very much for the re-landing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71746: Fix the "TypeError: a bytes-like object is required, not 'str'" in exploded-graph-rewriter.py on Python 3.5+

2019-12-20 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov created this revision.
psamolysov added reviewers: dergachev.a, clang.
psamolysov added a project: clang.
Herald added a subscriber: cfe-commits.

When I run the 'exploded-graph-rewriter.py' tool on Windows using Python 3.5 
and above, the following error and stack trace occurs:

  Traceback (most recent call last):
File 
"C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py",
 line 1061, in 
  main()
File 
"C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py",
 line 1057, in main
  explorer.explore(graph, visitor)
File 
"C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py",
 line 911, in explore
  visitor.visit_end_of_graph()
File 
"C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py",
 line 879, in visit_end_of_graph
  svg = graphviz.pipe('dot', 'svg', self.output())
File "C:\Program Files\Python37\lib\site-packages\graphviz\backend.py", 
line 229, in pipe
  out, _ = run(cmd, input=data, capture_output=True, check=True, 
quiet=quiet)
File "C:\Program Files\Python37\lib\site-packages\graphviz\backend.py", 
line 166, in run
  out, err = proc.communicate(input)
File "C:\Program Files\Python37\lib\subprocess.py", line 920, in communicate
  stdout, stderr = self._communicate(input, endtime, timeout)
File "C:\Program Files\Python37\lib\subprocess.py", line 1238, in 
_communicate
  self._stdin_write(input)
File "C:\Program Files\Python37\lib\subprocess.py", line 854, in 
_stdin_write
  self.stdin.write(input)
  TypeError: a bytes-like object is required, not 'str'

Due to work with Unicode in Python begin from 3.5, the output string must be 
encoded, so I put the code to detect whether the script works on Python 3.5+ 
and use the encode() method if so. After this manipulations, the 
exploded-graph-rewriter.py script works fine on Windows and Python 3.7.

I haven't tried the script on Python 2


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71746

Files:
  clang/utils/analyzer/exploded-graph-rewriter.py


Index: clang/utils/analyzer/exploded-graph-rewriter.py
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -18,6 +18,7 @@
 import logging
 import os
 import re
+import sys
 
 
 #===---===#
@@ -425,7 +426,10 @@
 
 def output(self):
 assert not self._dump_dot_only
-return ''.join(self._output)
+if sys.version_info[0] > 2 and sys.version_info[1] >= 5:
+return ''.join(self._output).encode()
+else:
+return ''.join(self._output)
 
 def _dump(self, s):
 s = s.replace('&', '&') \


Index: clang/utils/analyzer/exploded-graph-rewriter.py
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -18,6 +18,7 @@
 import logging
 import os
 import re
+import sys
 
 
 #===---===#
@@ -425,7 +426,10 @@
 
 def output(self):
 assert not self._dump_dot_only
-return ''.join(self._output)
+if sys.version_info[0] > 2 and sys.version_info[1] >= 5:
+return ''.join(self._output).encode()
+else:
+return ''.join(self._output)
 
 def _dump(self, s):
 s = s.replace('&', '&') \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71746: Fix the "TypeError: a bytes-like object is required, not 'str'" in exploded-graph-rewriter.py on Python 3.5+

2019-12-20 Thread Pavel Samolysov via Phabricator via cfe-commits
psamolysov added a comment.

@NoQ Could you commit, please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71746/new/

https://reviews.llvm.org/D71746



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits