Skip to content

Commit 42b551a

Browse files
committed
Pass CodeGenOptLevel to MachineSMEABI pass (part of #149065)
Change-Id: Idef5b1e2a45585f97897fc11c4f237996edb7c8b
1 parent 7d60680 commit 42b551a

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

llvm/lib/Target/AArch64/AArch64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ FunctionPass *createAArch64CleanupLocalDynamicTLSPass();
6060
FunctionPass *createAArch64CollectLOHPass();
6161
FunctionPass *createSMEABIPass();
6262
FunctionPass *createSMEPeepholeOptPass();
63-
FunctionPass *createMachineSMEABIPass();
63+
FunctionPass *createMachineSMEABIPass(CodeGenOptLevel);
6464
ModulePass *createSVEIntrinsicOptsPass();
6565
InstructionSelector *
6666
createAArch64InstructionSelector(const AArch64TargetMachine &,

llvm/lib/Target/AArch64/AArch64TargetMachine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,8 @@ bool AArch64PassConfig::addGlobalInstructionSelect() {
792792
}
793793

794794
void AArch64PassConfig::addMachineSSAOptimization() {
795-
if (EnableNewSMEABILowering && TM->getOptLevel() != CodeGenOptLevel::None)
796-
addPass(createMachineSMEABIPass());
795+
if (TM->getOptLevel() != CodeGenOptLevel::None && EnableNewSMEABILowering)
796+
addPass(createMachineSMEABIPass(TM->getOptLevel()));
797797

798798
if (TM->getOptLevel() != CodeGenOptLevel::None && EnableSMEPeepholeOpt)
799799
addPass(createSMEPeepholeOptPass());
@@ -826,7 +826,7 @@ bool AArch64PassConfig::addILPOpts() {
826826

827827
void AArch64PassConfig::addPreRegAlloc() {
828828
if (TM->getOptLevel() == CodeGenOptLevel::None && EnableNewSMEABILowering)
829-
addPass(createMachineSMEABIPass());
829+
addPass(createMachineSMEABIPass(CodeGenOptLevel::None));
830830

831831
// Change dead register definitions to refer to the zero register.
832832
if (TM->getOptLevel() != CodeGenOptLevel::None &&

llvm/lib/Target/AArch64/MachineSMEABIPass.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ getZAStateBeforeInst(const TargetRegisterInfo &TRI, MachineInstr &MI,
176176
struct MachineSMEABI : public MachineFunctionPass {
177177
inline static char ID = 0;
178178

179-
MachineSMEABI() : MachineFunctionPass(ID) {}
179+
MachineSMEABI(CodeGenOptLevel OptLevel = CodeGenOptLevel::Default)
180+
: MachineFunctionPass(ID), OptLevel(OptLevel) {}
180181

181182
bool runOnMachineFunction(MachineFunction &MF) override;
182183

@@ -282,6 +283,8 @@ struct MachineSMEABI : public MachineFunctionPass {
282283
LiveRegs PhysLiveRegsAtExit = LiveRegs::None;
283284
};
284285

286+
CodeGenOptLevel OptLevel = CodeGenOptLevel::Default;
287+
285288
// All pass state that must be cleared between functions.
286289
struct PassState {
287290
SmallVector<BlockInfo> Blocks;
@@ -299,6 +302,7 @@ struct MachineSMEABI : public MachineFunctionPass {
299302
const AArch64FunctionInfo *AFI = nullptr;
300303
const TargetInstrInfo *TII = nullptr;
301304
MachineRegisterInfo *MRI = nullptr;
305+
MachineLoopInfo *MLI = nullptr;
302306
};
303307

304308
void MachineSMEABI::collectNeededZAStates(SMEAttrs SMEFnAttrs) {
@@ -839,4 +843,6 @@ bool MachineSMEABI::runOnMachineFunction(MachineFunction &MF) {
839843
return true;
840844
}
841845

842-
FunctionPass *llvm::createMachineSMEABIPass() { return new MachineSMEABI(); }
846+
FunctionPass *llvm::createMachineSMEABIPass(CodeGenOptLevel OptLevel) {
847+
return new MachineSMEABI(OptLevel);
848+
}

0 commit comments

Comments
 (0)