-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AArch64][NPM] Chalk out the CodeGenPassBuilder for NPM #128471
Conversation
@llvm/pr-subscribers-backend-aarch64 Author: Akshat Oke (optimisan) ChangesThis allows for testing AArch64 passes with the new pass manager. Full diff: https://github.com/llvm/llvm-project/pull/128471.diff 3 Files Affected:
diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
index d10a0c0a08f89..7c8f101fa1538 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -41,6 +41,7 @@
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Pass.h"
+#include "llvm/Passes/CodeGenPassBuilder.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/CommandLine.h"
@@ -562,8 +563,39 @@ class AArch64PassConfig : public TargetPassConfig {
std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
};
+class AArch64CodeGenPassBuilder
+ : public CodeGenPassBuilder<AArch64CodeGenPassBuilder,
+ AArch64TargetMachine> {
+ using Base =
+ CodeGenPassBuilder<AArch64CodeGenPassBuilder, AArch64TargetMachine>;
+
+public:
+ AArch64CodeGenPassBuilder(AArch64TargetMachine &TM,
+ const CGPassBuilderOption &Opts,
+ PassInstrumentationCallbacks *PIC)
+ : CodeGenPassBuilder(TM, Opts, PIC) {}
+ void addPreISel(AddIRPass &) const {
+ // TODO: Add pre-isel passes
+ }
+ void addAsmPrinter(AddMachinePass &addPass, CreateMCStreamer) const {
+ // TODO: Add asm printer passes
+ }
+ Error addInstSelector(AddMachinePass &) const {
+ // TODO: Add instruction selector passes
+ return Error::success();
+ }
+};
+
} // end anonymous namespace
+Error AArch64TargetMachine::buildCodeGenPipeline(
+ ModulePassManager &MPM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut,
+ CodeGenFileType FileType, const CGPassBuilderOption &Opts,
+ PassInstrumentationCallbacks *PIC) {
+ AArch64CodeGenPassBuilder Builder(*this, Opts, PIC);
+ return Builder.buildPipeline(MPM, Out, DwoOut, FileType);
+}
+
void AArch64TargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
PB.registerLateLoopOptimizationsEPCallback(
diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.h b/llvm/lib/Target/AArch64/AArch64TargetMachine.h
index f8ba41f215430..4fb4581c63547 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetMachine.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.h
@@ -46,6 +46,12 @@ class AArch64TargetMachine : public CodeGenTargetMachineImpl {
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
+ Error buildCodeGenPipeline(ModulePassManager &MPM, raw_pwrite_stream &Out,
+ raw_pwrite_stream *DwoOut,
+ CodeGenFileType FileType,
+ const CGPassBuilderOption &Opts,
+ PassInstrumentationCallbacks *PIC) override;
+
void registerPassBuilderCallbacks(PassBuilder &PB) override;
TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
diff --git a/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir b/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir
index 9a8e5c6341bca..b357f7450b4b8 100644
--- a/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir
+++ b/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir
@@ -1,6 +1,9 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -start-before=machine-latecleanup -stop-after=machine-latecleanup \
# RUN: -o - %s | FileCheck %s
+
+# RUN: llc -enable-new-pm -start-before=machine-latecleanup -stop-after=machine-latecleanup \
+# RUN: -o - %s | FileCheck %s
--- |
; ModuleID = 'reduced5.ll'
source_filename = "reduced5.ll"
|
We may need feedback from https://discourse.llvm.org/t/rfc-codegen-new-pass-manager-pipeline-construction-design/84659. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we change the interface here, adding another instance of what we're already doing doesn't hurt
I believe it should be easy to swap out the current structure to the new one. |
238f35d
to
64c5685
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/89/builds/17266 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/13931 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/13687 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/13741 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/53/builds/12815 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/12737 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/80/builds/10505 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/13520 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/29/builds/10872 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/5324 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/2427 Here is the relevant piece of the build log for the reference
|
@optimisan I've reverted this PR. I can reproduce the problem with |
I'll do that, thanks! |
…r NPM (#128471)" This reverts commit d85685e. Multiple buildbot failures have been reported: llvm/llvm-project#128471
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/11899 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/20377 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/23823 Here is the relevant piece of the build log for the reference
|
@kazutakahirata I've fixed this here #128662 |
…r NPM (#128… (#128662) …471)" Reland llvm/llvm-project#128471 The Passes library was not linked in earlier.
…#128… (llvm#128662) …471)" Reland llvm#128471 The Passes library was not linked in earlier.
…#128… (llvm#128662) …471)" Reland llvm#128471 The Passes library was not linked in earlier.
This allows for testing AArch64 passes with the new pass manager.
…#128471)" This reverts commit d85685e. Multiple buildbot failures have been reported: llvm#128471
…#128… (llvm#128662) …471)" Reland llvm#128471 The Passes library was not linked in earlier.
This allows for testing AArch64 passes with the new pass manager.
…#128471)" This reverts commit d85685e. Multiple buildbot failures have been reported: llvm#128471
…#128… (llvm#128662) …471)" Reland llvm#128471 The Passes library was not linked in earlier.
This allows for testing AArch64 passes with the new pass manager.