[llvm] 8e8a620 - [RISCV][NFC] Minor cleanup in RISCVInstrInfo::getOutliningType
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 08:44:04 PDT 2022
Author: Kito Cheng
Date: 2022-08-24T23:42:34+08:00
New Revision: 8e8a62006ecae016cfc345c2ec97fb3574b76d61
URL: https://github.com/llvm/llvm-project/commit/8e8a62006ecae016cfc345c2ec97fb3574b76d61
DIFF: https://github.com/llvm/llvm-project/commit/8e8a62006ecae016cfc345c2ec97fb3574b76d61.diff
LOG: [RISCV][NFC] Minor cleanup in RISCVInstrInfo::getOutliningType
The only use of TM is checking result of TargetMachine::getFunctionSections,
check that directly instead of introdce a local variable.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 8f9e622654152..d24fd9a2f2808 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1412,8 +1412,6 @@ RISCVInstrInfo::getOutliningType(MachineBasicBlock::iterator &MBBI,
MI.getDesc().hasImplicitDefOfPhysReg(RISCV::X5))
return outliner::InstrType::Illegal;
- const auto &TM =
- static_cast<const RISCVTargetMachine &>(MI.getMF()->getTarget());
// Make sure the operands don't reference something unsafe.
for (const auto &MO : MI.operands()) {
if (MO.isMBB() || MO.isBlockAddress() || MO.isCPI() || MO.isJTI())
@@ -1422,7 +1420,8 @@ RISCVInstrInfo::getOutliningType(MachineBasicBlock::iterator &MBBI,
// pcrel-hi and pcrel-lo can't put in separate sections, filter that out
// if any possible.
if (MO.getTargetFlags() == RISCVII::MO_PCREL_LO &&
- (TM.getFunctionSections() || F.hasComdat() || F.hasSection()))
+ (MI.getMF()->getTarget().getFunctionSections() || F.hasComdat() ||
+ F.hasSection()))
return outliner::InstrType::Illegal;
}
More information about the llvm-commits
mailing list