[llvm-branch-commits] [llvm] [DAG][AArch64] Handle truncated buildvectors to allow and(subvector(anyext)) fold. (PR #133915)

2025-05-17 Thread David Green via llvm-branch-commits

davemgreen wrote:

Did you have a reason to need this change?

https://github.com/llvm/llvm-project/pull/133915
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] [mlir][SparseTensor] Fix type conversion rule (PR #140350)

2025-05-17 Thread Peiming Liu via llvm-branch-commits

PeimingLiu wrote:

Thx!

https://github.com/llvm/llvm-project/pull/140350
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] [mlir][SparseTensor] Fix type conversion rule (PR #140350)

2025-05-17 Thread Peiming Liu via llvm-branch-commits

https://github.com/PeimingLiu approved this pull request.


https://github.com/llvm/llvm-project/pull/140350
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DAG][AArch64] Handle truncated buildvectors to allow and(subvector(anyext)) fold. (PR #133915)

2025-05-17 Thread via llvm-branch-commits

AZero13 wrote:

No I was not sure if you forgot about it or meant to merge it or wasn't merging 
for a reason. 

https://github.com/llvm/llvm-project/pull/133915
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-17 Thread Krzysztof Drewniak via llvm-branch-commits

https://github.com/krzysz00 approved this pull request.

Thanks for the ping, this looks good to me 

https://github.com/llvm/llvm-project/pull/139419
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Add parsing infastructure for StaticSampler (PR #140180)

2025-05-17 Thread Sarah Spall via llvm-branch-commits


@@ -606,6 +644,30 @@ 
RootSignatureParser::parseDescriptorTableClauseParams(TokenKind RegType) {
   return Params;
 }
 
+std::optional
+RootSignatureParser::parseStaticSamplerParams() {
+  assert(CurToken.TokKind == TokenKind::pu_l_paren &&
+ "Expects to only be invoked starting at given token");
+
+  ParsedStaticSamplerParams Params;
+  do {
+// `s` POS_INT
+if (tryConsumeExpectedToken(TokenKind::sReg)) {
+  if (Params.Reg.has_value()) {
+getDiags().Report(CurToken.TokLoc, diag::err_hlsl_rootsig_repeat_param)
+<< CurToken.TokKind;
+return std::nullopt;
+  }
+  auto Reg = parseRegister();
+  if (!Reg.has_value())

spall wrote:

what does this case look like? Why is this not a parsing error?

https://github.com/llvm/llvm-project/pull/140180
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Add parsing infastructure for StaticSampler (PR #140180)

2025-05-17 Thread Sarah Spall via llvm-branch-commits


@@ -223,6 +223,34 @@ TEST_F(ParseHLSLRootSignatureTest, 
ValidParseDTClausesTest) {
   ASSERT_TRUE(Consumer->isSatisfied());
 }
 
+TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {

spall wrote:

Should you add a test where the parsing is unsuccessful? 

https://github.com/llvm/llvm-project/pull/140180
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Add parsing infastructure for StaticSampler (PR #140180)

2025-05-17 Thread Sarah Spall via llvm-branch-commits


@@ -606,6 +644,30 @@ 
RootSignatureParser::parseDescriptorTableClauseParams(TokenKind RegType) {
   return Params;
 }
 
+std::optional
+RootSignatureParser::parseStaticSamplerParams() {
+  assert(CurToken.TokKind == TokenKind::pu_l_paren &&
+ "Expects to only be invoked starting at given token");
+
+  ParsedStaticSamplerParams Params;
+  do {
+// `s` POS_INT
+if (tryConsumeExpectedToken(TokenKind::sReg)) {
+  if (Params.Reg.has_value()) {
+getDiags().Report(CurToken.TokLoc, diag::err_hlsl_rootsig_repeat_param)
+<< CurToken.TokKind;
+return std::nullopt;
+  }
+  auto Reg = parseRegister();
+  if (!Reg.has_value())
+return std::nullopt;
+  Params.Reg = Reg;
+}
+  } while (tryConsumeExpectedToken(TokenKind::pu_comma));

spall wrote:

It looks like this parsing code allows stuff of the form 
'StaticSampler(,)', and from looking at a DXC example it seems 
that is allowed https://godbolt.org/z/j7qP11h9W. It is amusing this is so 
permissive, and I wonder if there is a reason for that. 

https://github.com/llvm/llvm-project/pull/140180
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [Clang][Backport] Demote mixed enumeration arithmetic error to a warning (#131811) (PR #139396)

2025-05-17 Thread via llvm-branch-commits


@@ -7567,9 +7567,13 @@ def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
   "%sub{select_arith_conv_kind}0 "
   "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
   InGroup;
-def err_conv_mixed_enum_types_cxx26 : Error<
+
+def err_conv_mixed_enum_types: Error <
   "invalid %sub{select_arith_conv_kind}0 "
   "different enumeration types%diff{ ($ and $)|}1,2">;
+def warn_conv_mixed_enum_types_cxx26 : Warning <
+  err_conv_mixed_enum_types.Summary>,
+  InGroup, DefaultError;

cor3ntin wrote:

So presumably, if we renamed it to z_error_xxx it would be fine?

https://github.com/llvm/llvm-project/pull/139396
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] CodeGen: Fix implementation of __builtin_trivially_relocate. (PR #140312)

2025-05-17 Thread via llvm-branch-commits


@@ -4425,6 +4425,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 Address Dest = EmitPointerWithAlignment(E->getArg(0));
 Address Src = EmitPointerWithAlignment(E->getArg(1));
 Value *SizeVal = EmitScalarExpr(E->getArg(2));
+if (BuiltinIDIfNoAsmLabel == Builtin::BI__builtin_trivially_relocate)
+  SizeVal = Builder.CreateMul(

cor3ntin wrote:

I think generally, there is the question of whether we want UBSAN to enforce 
the preconditions of trivially_relocate (object completeness, valid ranges), 
However, because the intent is for that builtin to be wrapped in a standard 
function, it's probably better to only do the checks there, it would integrate 
better with hardening/contracts, and we don't (afaik) have precondition checks 
for builtins


https://github.com/llvm/llvm-project/pull/140312
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [Clang][Backport] Demote mixed enumeration arithmetic error to a warning (#131811) (PR #139396)

2025-05-17 Thread Tom Stellard via llvm-branch-commits


@@ -7567,9 +7567,13 @@ def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
   "%sub{select_arith_conv_kind}0 "
   "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
   InGroup;
-def err_conv_mixed_enum_types_cxx26 : Error<
+
+def err_conv_mixed_enum_types: Error <
   "invalid %sub{select_arith_conv_kind}0 "
   "different enumeration types%diff{ ($ and $)|}1,2">;
+def warn_conv_mixed_enum_types_cxx26 : Warning <
+  err_conv_mixed_enum_types.Summary>,
+  InGroup, DefaultError;

tstellar wrote:

I think so, yes.  Someone could verify by looking at the generated .inc file.

https://github.com/llvm/llvm-project/pull/139396
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [polly] [Polly] Remove ScopPass infrastructure (PR #125783)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/125783

>From 67ff7b622fef21d39c524d0de9d4659d2444ccfd Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Wed, 5 Feb 2025 00:51:47 +0100
Subject: [PATCH] Remove ScopPass infrastructure

---
 polly/docs/ReleaseNotes.rst   |   1 +
 polly/include/polly/CodeGen/CodeGeneration.h  |  13 +-
 polly/include/polly/CodeGen/IslAst.h  |  21 +-
 polly/include/polly/CodePreparation.h |   7 +-
 polly/include/polly/DeLICM.h  |  21 +-
 polly/include/polly/DeadCodeElimination.h |   8 -
 polly/include/polly/DependenceInfo.h  |  26 +-
 polly/include/polly/ForwardOpTree.h   |  25 +-
 polly/include/polly/JSONExporter.h|  17 +-
 polly/include/polly/MaximalStaticExpansion.h  |  20 --
 polly/include/polly/Pass/PhaseManager.h   |   6 +-
 polly/include/polly/PruneUnprofitable.h   |  16 +-
 polly/include/polly/ScheduleOptimizer.h   |  24 +-
 polly/include/polly/ScopGraphPrinter.h|   1 -
 polly/include/polly/ScopInfo.h|   1 -
 polly/include/polly/ScopPass.h| 264 --
 polly/include/polly/Simplify.h|  29 +-
 polly/lib/Analysis/DependenceInfo.cpp |  27 --
 polly/lib/Analysis/PruneUnprofitable.cpp  |  16 --
 polly/lib/Analysis/ScopDetection.cpp  |   1 -
 polly/lib/Analysis/ScopInfo.cpp   |   1 -
 polly/lib/Analysis/ScopPass.cpp   | 134 -
 polly/lib/CMakeLists.txt  |   1 -
 polly/lib/CodeGen/CodeGeneration.cpp  |  13 -
 polly/lib/CodeGen/IslAst.cpp  |  19 --
 polly/lib/Exchange/JSONExporter.cpp   |  27 --
 polly/lib/Pass/PhaseManager.cpp   |   2 +
 polly/lib/Support/PollyPasses.def |  44 ---
 polly/lib/Support/RegisterPasses.cpp  | 133 +
 polly/lib/Transform/CodePreparation.cpp   |  14 -
 polly/lib/Transform/DeLICM.cpp|  43 ---
 polly/lib/Transform/DeadCodeElimination.cpp   |  23 --
 polly/lib/Transform/FlattenSchedule.cpp   |   1 -
 polly/lib/Transform/ForwardOpTree.cpp |  42 ---
 polly/lib/Transform/MatmulOptimizer.cpp   |   1 -
 .../lib/Transform/MaximalStaticExpansion.cpp  |  42 ---
 polly/lib/Transform/ScheduleOptimizer.cpp |  39 +--
 polly/lib/Transform/ScopInliner.cpp   |   1 -
 polly/lib/Transform/Simplify.cpp  |  35 ---
 ...invariant_load_base_pointer_conditional.ll |   2 +-
 polly/unittests/CMakeLists.txt|   1 -
 .../unittests/ScopPassManager/CMakeLists.txt  |   7 -
 .../ScopPassManager/PassManagerTest.cpp   |  66 -
 43 files changed, 42 insertions(+), 1193 deletions(-)
 delete mode 100644 polly/include/polly/ScopPass.h
 delete mode 100644 polly/lib/Analysis/ScopPass.cpp
 delete mode 100644 polly/unittests/ScopPassManager/CMakeLists.txt
 delete mode 100644 polly/unittests/ScopPassManager/PassManagerTest.cpp

diff --git a/polly/docs/ReleaseNotes.rst b/polly/docs/ReleaseNotes.rst
index 215a802843304..6461af35e9625 100644
--- a/polly/docs/ReleaseNotes.rst
+++ b/polly/docs/ReleaseNotes.rst
@@ -17,3 +17,4 @@ In Polly |version| the following important changes have been 
incorporated.
 
  * Polly's support for the legacy pass manager has been removed.
 
+ * The infrastructure around ScopPasses has been removed.
diff --git a/polly/include/polly/CodeGen/CodeGeneration.h 
b/polly/include/polly/CodeGen/CodeGeneration.h
index 2340fbe016b49..bf0b8e69f46bb 100644
--- a/polly/include/polly/CodeGen/CodeGeneration.h
+++ b/polly/include/polly/CodeGen/CodeGeneration.h
@@ -10,12 +10,16 @@
 #define POLLY_CODEGENERATION_H
 
 #include "polly/CodeGen/IRBuilder.h"
-#include "polly/ScopPass.h"
-#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+class RegionInfo;
+}
 
 namespace polly {
 class IslAstInfo;
 
+using llvm::BasicBlock;
+
 enum VectorizerChoice {
   VECTORIZER_NONE,
   VECTORIZER_STRIPMINE,
@@ -28,11 +32,6 @@ extern VectorizerChoice PollyVectorizerChoice;
 /// UnreachableInst.
 void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder);
 
-struct CodeGenerationPass final : PassInfoMixin {
-  PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
-ScopStandardAnalysisResults &AR, SPMUpdater &U);
-};
-
 extern bool PerfMonitoring;
 
 bool runCodeGeneration(Scop &S, llvm::RegionInfo &RI, IslAstInfo &AI);
diff --git a/polly/include/polly/CodeGen/IslAst.h 
b/polly/include/polly/CodeGen/IslAst.h
index 3e1ff2c8a24da..243ca46f9ba32 100644
--- a/polly/include/polly/CodeGen/IslAst.h
+++ b/polly/include/polly/CodeGen/IslAst.h
@@ -22,12 +22,11 @@
 #define POLLY_ISLAST_H
 
 #include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
 #include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/IR/PassManager.h"
 #include "isl/ctx.h"
 
 namespace polly {
+using llvm::raw_ostream;
 using llvm::SmallPtrSet;
 
 class Dependences;
@@ -164,24 +163,6 @@ class IslAstInf

[llvm-branch-commits] [polly] [Polly] Update ScopInliner for NPM (PR #125427)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/125427

>From 06b025db36dff8c1a3b0b22ae884d6506611f455 Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Sun, 2 Feb 2025 18:48:32 +0100
Subject: [PATCH 1/2] Update ScopInliner to support NPM

---
 polly/docs/ReleaseNotes.rst   |   2 +
 polly/include/polly/LinkAllPasses.h   |   2 +-
 polly/include/polly/ScopInliner.h |  34 
 polly/lib/Support/PollyPasses.def |   6 +
 polly/lib/Support/RegisterPasses.cpp  |  41 -
 polly/lib/Transform/ScopInliner.cpp   | 159 +++---
 polly/test/ScopInliner/ignore-declares.ll |   3 +-
 polly/test/ScopInliner/invariant-load-func.ll |   5 +-
 polly/test/ScopInliner/simple-inline-loop.ll  |   3 +-
 9 files changed, 184 insertions(+), 71 deletions(-)
 create mode 100644 polly/include/polly/ScopInliner.h

diff --git a/polly/docs/ReleaseNotes.rst b/polly/docs/ReleaseNotes.rst
index f7c9689089be2..f5ea47b69cf02 100644
--- a/polly/docs/ReleaseNotes.rst
+++ b/polly/docs/ReleaseNotes.rst
@@ -11,3 +11,5 @@ In Polly |version| the following important changes have been 
incorporated.
 the new features that have recently been committed to our development
 branch.
 
+ * ScopInliner has been updated for the New Pass Manager.
+
diff --git a/polly/include/polly/LinkAllPasses.h 
b/polly/include/polly/LinkAllPasses.h
index 54e7c5a43ab93..65846653f98e5 100644
--- a/polly/include/polly/LinkAllPasses.h
+++ b/polly/include/polly/LinkAllPasses.h
@@ -120,7 +120,7 @@ struct PollyForcePassLinking {
 
 namespace llvm {
 void initializeCodePreparationPass(llvm::PassRegistry &);
-void initializeScopInlinerPass(llvm::PassRegistry &);
+void initializeScopInlinerWrapperPassPass(llvm::PassRegistry &);
 void initializeScopDetectionWrapperPassPass(llvm::PassRegistry &);
 void initializeScopDetectionPrinterLegacyPassPass(llvm::PassRegistry &);
 void initializeScopInfoRegionPassPass(PassRegistry &);
diff --git a/polly/include/polly/ScopInliner.h 
b/polly/include/polly/ScopInliner.h
new file mode 100644
index 0..014667804330f
--- /dev/null
+++ b/polly/include/polly/ScopInliner.h
@@ -0,0 +1,34 @@
+//===-- ScopInliner.h ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef POLLY_POLLYINLINER_H
+#define POLLY_POLLYINLINER_H
+
+#include "llvm/Analysis/CGSCCPassManager.h"
+#include "llvm/Analysis/LazyCallGraph.h"
+#include "llvm/IR/PassManager.h"
+
+namespace polly {
+class ScopInlinerPass : public llvm::PassInfoMixin {
+public:
+  ScopInlinerPass();
+
+  llvm::PreservedAnalyses run(llvm::LazyCallGraph::SCC &C,
+  llvm::CGSCCAnalysisManager &AM,
+  llvm::LazyCallGraph &CG,
+  llvm::CGSCCUpdateResult &UR);
+};
+
+llvm::Pass *createScopInlinerWrapperPass();
+} // namespace polly
+
+namespace llvm {
+void initializeScopInlinerWrapperPassPass(llvm::PassRegistry &);
+}
+
+#endif /* POLLY_POLLYINLINER_H */
diff --git a/polly/lib/Support/PollyPasses.def 
b/polly/lib/Support/PollyPasses.def
index e068f31fdb703..2c792a5867100 100644
--- a/polly/lib/Support/PollyPasses.def
+++ b/polly/lib/Support/PollyPasses.def
@@ -1,3 +1,9 @@
+#ifndef CGSCC_PASS
+#define CGSCC_PASS(NAME, CREATE_PASS, PARSER)
+#endif
+CGSCC_PASS("polly-inline", ScopInlinerPass(), parseNoOptions)
+#undef CGSCC_PASS
+
 #ifndef FUNCTION_ANALYSIS
 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
 #endif
diff --git a/polly/lib/Support/RegisterPasses.cpp 
b/polly/lib/Support/RegisterPasses.cpp
index a46e61aafbeb7..3ace336cb588b 100644
--- a/polly/lib/Support/RegisterPasses.cpp
+++ b/polly/lib/Support/RegisterPasses.cpp
@@ -35,6 +35,7 @@
 #include "polly/ScopDetection.h"
 #include "polly/ScopGraphPrinter.h"
 #include "polly/ScopInfo.h"
+#include "polly/ScopInliner.h"
 #include "polly/Simplify.h"
 #include "polly/Support/DumpFunctionPass.h"
 #include "polly/Support/DumpModulePass.h"
@@ -46,10 +47,13 @@
 #include "llvm/Passes/PassBuilder.h"
 #include "llvm/Passes/PassPlugin.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Transforms/IPO.h"
 
+using namespace llvm;
 namespace cl = llvm::cl;
+using namespace polly;
 
 using llvm::FunctionPassManager;
 using llvm::OptimizationLevel;
@@ -233,7 +237,7 @@ void initializePollyPasses(llvm::PassRegistry &Registry) {
   initializePollyCanonicalizePass(Registry);
   initializeScopDetectionWrapperPassPass(Registry);
   initializeScopDetectionPrinterLegacyPassPass(Registry);
-  initializeScopInlinerPass(Registry);
+  initializeScopInlinerWrapperPassPass(Registry);
   initializeScopInfo

[llvm-branch-commits] [polly] [Polly] Update ScopInliner for NPM (PR #125427)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur converted_to_draft 
https://github.com/llvm/llvm-project/pull/125427
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [polly] [Polly] Introduce PhaseManager and remove LPM support (PR #125442)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur converted_to_draft 
https://github.com/llvm/llvm-project/pull/125442
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [polly] [Polly][CodePreparation] Extract common code of LPM and NPM (PR #140419)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur created 
https://github.com/llvm/llvm-project/pull/140419

Use a common function for the non-boilerplate code shared between LPM and NPM 
as done by most other passes already. ScalarEvolution is not actually used.

Patch extracted out of #125442 requested by 
https://github.com/llvm/llvm-project/pull/125442#discussion_r2034416019

>From 1acf246bac1428358ae616cc846bc40c1ae2b3c3 Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Sun, 18 May 2025 01:43:00 +0200
Subject: [PATCH] Refactor common code of LPM and NPM

---
 polly/lib/Transform/CodePreparation.cpp | 45 +++--
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/polly/lib/Transform/CodePreparation.cpp 
b/polly/lib/Transform/CodePreparation.cpp
index 7c8579eb93218..d045fb6b62c90 100644
--- a/polly/lib/Transform/CodePreparation.cpp
+++ b/polly/lib/Transform/CodePreparation.cpp
@@ -27,6 +27,26 @@
 using namespace llvm;
 using namespace polly;
 
+static bool runCodePreprationImpl(Function &F, DominatorTree *DT, LoopInfo *LI,
+  RegionInfo *RI) {
+  // Find first non-alloca instruction. Every basic block has a non-alloca
+  // instruction, as every well formed basic block has a terminator.
+  auto &EntryBlock = F.getEntryBlock();
+  BasicBlock::iterator I = EntryBlock.begin();
+  while (isa(I))
+++I;
+
+  // Abort if not necessary to split
+  if (I->isTerminator() && isa(I) &&
+  cast(I)->isUnconditional())
+return false;
+
+  // splitBlock updates DT, LI and RI.
+  splitEntryBlockForAlloca(&EntryBlock, DT, LI, RI);
+
+  return true;
+}
+
 namespace {
 
 /// Prepare the IR for the scop detection.
@@ -35,9 +55,6 @@ class CodePreparation final : public FunctionPass {
   CodePreparation(const CodePreparation &) = delete;
   const CodePreparation &operator=(const CodePreparation &) = delete;
 
-  LoopInfo *LI;
-  ScalarEvolution *SE;
-
   void clear();
 
 public:
@@ -58,19 +75,11 @@ class CodePreparation final : public FunctionPass {
 
 PreservedAnalyses CodePreparationPass::run(Function &F,
FunctionAnalysisManager &FAM) {
-
-  // Find first non-alloca instruction. Every basic block has a non-alloca
-  // instruction, as every well formed basic block has a terminator.
-  auto &EntryBlock = F.getEntryBlock();
-  BasicBlock::iterator I = EntryBlock.begin();
-  while (isa(I))
-++I;
-
   auto &DT = FAM.getResult(F);
   auto &LI = FAM.getResult(F);
-
-  // splitBlock updates DT, LI and RI.
-  splitEntryBlockForAlloca(&EntryBlock, &DT, &LI, nullptr);
+  bool Changed = runCodePreprationImpl(F, &DT, &LI, nullptr);
+  if (!Changed)
+return PreservedAnalyses::all();
 
   PreservedAnalyses PA;
   PA.preserve();
@@ -84,7 +93,6 @@ CodePreparation::~CodePreparation() { clear(); }
 
 void CodePreparation::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired();
-  AU.addRequired();
 
   AU.addPreserved();
   AU.addPreserved();
@@ -96,10 +104,11 @@ bool CodePreparation::runOnFunction(Function &F) {
   if (skipFunction(F))
 return false;
 
-  LI = &getAnalysis().getLoopInfo();
-  SE = &getAnalysis().getSE();
+  DominatorTree *DT = &getAnalysis().getDomTree();
+  LoopInfo *LI = &getAnalysis().getLoopInfo();
+  RegionInfo *RI = &getAnalysis().getRegionInfo();
 
-  splitEntryBlockForAlloca(&F.getEntryBlock(), this);
+  runCodePreprationImpl(F, DT, LI, RI);
 
   return true;
 }

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


[llvm-branch-commits] [polly] [Polly] Introduce PhaseManager and remove LPM support (PR #125442)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/125442
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [polly] [Polly] Introduce PhaseManager and remove LPM support (PR #125442)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/125442
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [polly] [Polly] Remove ScopPass infrastructure (PR #125783)

2025-05-17 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/125783

>From 67ff7b622fef21d39c524d0de9d4659d2444ccfd Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Wed, 5 Feb 2025 00:51:47 +0100
Subject: [PATCH] Remove ScopPass infrastructure

---
 polly/docs/ReleaseNotes.rst   |   1 +
 polly/include/polly/CodeGen/CodeGeneration.h  |  13 +-
 polly/include/polly/CodeGen/IslAst.h  |  21 +-
 polly/include/polly/CodePreparation.h |   7 +-
 polly/include/polly/DeLICM.h  |  21 +-
 polly/include/polly/DeadCodeElimination.h |   8 -
 polly/include/polly/DependenceInfo.h  |  26 +-
 polly/include/polly/ForwardOpTree.h   |  25 +-
 polly/include/polly/JSONExporter.h|  17 +-
 polly/include/polly/MaximalStaticExpansion.h  |  20 --
 polly/include/polly/Pass/PhaseManager.h   |   6 +-
 polly/include/polly/PruneUnprofitable.h   |  16 +-
 polly/include/polly/ScheduleOptimizer.h   |  24 +-
 polly/include/polly/ScopGraphPrinter.h|   1 -
 polly/include/polly/ScopInfo.h|   1 -
 polly/include/polly/ScopPass.h| 264 --
 polly/include/polly/Simplify.h|  29 +-
 polly/lib/Analysis/DependenceInfo.cpp |  27 --
 polly/lib/Analysis/PruneUnprofitable.cpp  |  16 --
 polly/lib/Analysis/ScopDetection.cpp  |   1 -
 polly/lib/Analysis/ScopInfo.cpp   |   1 -
 polly/lib/Analysis/ScopPass.cpp   | 134 -
 polly/lib/CMakeLists.txt  |   1 -
 polly/lib/CodeGen/CodeGeneration.cpp  |  13 -
 polly/lib/CodeGen/IslAst.cpp  |  19 --
 polly/lib/Exchange/JSONExporter.cpp   |  27 --
 polly/lib/Pass/PhaseManager.cpp   |   2 +
 polly/lib/Support/PollyPasses.def |  44 ---
 polly/lib/Support/RegisterPasses.cpp  | 133 +
 polly/lib/Transform/CodePreparation.cpp   |  14 -
 polly/lib/Transform/DeLICM.cpp|  43 ---
 polly/lib/Transform/DeadCodeElimination.cpp   |  23 --
 polly/lib/Transform/FlattenSchedule.cpp   |   1 -
 polly/lib/Transform/ForwardOpTree.cpp |  42 ---
 polly/lib/Transform/MatmulOptimizer.cpp   |   1 -
 .../lib/Transform/MaximalStaticExpansion.cpp  |  42 ---
 polly/lib/Transform/ScheduleOptimizer.cpp |  39 +--
 polly/lib/Transform/ScopInliner.cpp   |   1 -
 polly/lib/Transform/Simplify.cpp  |  35 ---
 ...invariant_load_base_pointer_conditional.ll |   2 +-
 polly/unittests/CMakeLists.txt|   1 -
 .../unittests/ScopPassManager/CMakeLists.txt  |   7 -
 .../ScopPassManager/PassManagerTest.cpp   |  66 -
 43 files changed, 42 insertions(+), 1193 deletions(-)
 delete mode 100644 polly/include/polly/ScopPass.h
 delete mode 100644 polly/lib/Analysis/ScopPass.cpp
 delete mode 100644 polly/unittests/ScopPassManager/CMakeLists.txt
 delete mode 100644 polly/unittests/ScopPassManager/PassManagerTest.cpp

diff --git a/polly/docs/ReleaseNotes.rst b/polly/docs/ReleaseNotes.rst
index 215a802843304..6461af35e9625 100644
--- a/polly/docs/ReleaseNotes.rst
+++ b/polly/docs/ReleaseNotes.rst
@@ -17,3 +17,4 @@ In Polly |version| the following important changes have been 
incorporated.
 
  * Polly's support for the legacy pass manager has been removed.
 
+ * The infrastructure around ScopPasses has been removed.
diff --git a/polly/include/polly/CodeGen/CodeGeneration.h 
b/polly/include/polly/CodeGen/CodeGeneration.h
index 2340fbe016b49..bf0b8e69f46bb 100644
--- a/polly/include/polly/CodeGen/CodeGeneration.h
+++ b/polly/include/polly/CodeGen/CodeGeneration.h
@@ -10,12 +10,16 @@
 #define POLLY_CODEGENERATION_H
 
 #include "polly/CodeGen/IRBuilder.h"
-#include "polly/ScopPass.h"
-#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+class RegionInfo;
+}
 
 namespace polly {
 class IslAstInfo;
 
+using llvm::BasicBlock;
+
 enum VectorizerChoice {
   VECTORIZER_NONE,
   VECTORIZER_STRIPMINE,
@@ -28,11 +32,6 @@ extern VectorizerChoice PollyVectorizerChoice;
 /// UnreachableInst.
 void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder);
 
-struct CodeGenerationPass final : PassInfoMixin {
-  PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
-ScopStandardAnalysisResults &AR, SPMUpdater &U);
-};
-
 extern bool PerfMonitoring;
 
 bool runCodeGeneration(Scop &S, llvm::RegionInfo &RI, IslAstInfo &AI);
diff --git a/polly/include/polly/CodeGen/IslAst.h 
b/polly/include/polly/CodeGen/IslAst.h
index 3e1ff2c8a24da..243ca46f9ba32 100644
--- a/polly/include/polly/CodeGen/IslAst.h
+++ b/polly/include/polly/CodeGen/IslAst.h
@@ -22,12 +22,11 @@
 #define POLLY_ISLAST_H
 
 #include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
 #include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/IR/PassManager.h"
 #include "isl/ctx.h"
 
 namespace polly {
+using llvm::raw_ostream;
 using llvm::SmallPtrSet;
 
 class Dependences;
@@ -164,24 +163,6 @@ class IslAstInf