[llvm] [GlobalISel] Allow customizing instruction-select pass (PR #95724)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 14:49:45 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-globalisel
Author: None (darkbuck)
<details>
<summary>Changes</summary>
- Allow customizing instruction-select pass to add additional analysis
dependencies.
---
Full diff: https://github.com/llvm/llvm-project/pull/95724.diff
2 Files Affected:
- (modified) llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h (+2-2)
- (modified) llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp (+2-8)
``````````diff
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
index cada7f30072e2..8017f09aa3c8b 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
@@ -49,8 +49,8 @@ class InstructionSelect : public MachineFunctionPass {
MachineFunctionProperties::Property::Selected);
}
- InstructionSelect(CodeGenOptLevel OL);
- InstructionSelect();
+ InstructionSelect(CodeGenOptLevel OL = CodeGenOptLevel::Default,
+ char &PassID = ID);
bool runOnMachineFunction(MachineFunction &MF) override;
diff --git a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
index 4cb1d01f3e8ca..9a27728dcb4dd 100644
--- a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -62,14 +62,8 @@ INITIALIZE_PASS_END(InstructionSelect, DEBUG_TYPE,
"Select target instructions out of generic instructions",
false, false)
-InstructionSelect::InstructionSelect(CodeGenOptLevel OL)
- : MachineFunctionPass(ID), OptLevel(OL) {}
-
-// In order not to crash when calling getAnalysis during testing with -run-pass
-// we use the default opt level here instead of None, so that the addRequired()
-// calls are made in getAnalysisUsage().
-InstructionSelect::InstructionSelect()
- : MachineFunctionPass(ID), OptLevel(CodeGenOptLevel::Default) {}
+InstructionSelect::InstructionSelect(CodeGenOptLevel OL, char &PassID)
+ : MachineFunctionPass(PassID), OptLevel(OL) {}
void InstructionSelect::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<TargetPassConfig>();
``````````
</details>
https://github.com/llvm/llvm-project/pull/95724
More information about the llvm-commits
mailing list