Skip to content

Commit dbc3df1

Browse files
committed
[RISCV] Remove unnecessary call to MachineFunction::getSubtarget. NFC
RISCVInstrInfo already caches a reference to the subtarget object that owns it. We can use that.
1 parent e8ab413 commit dbc3df1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,10 +1474,8 @@ unsigned RISCVInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const {
14741474

14751475
if (!MI.memoperands_empty()) {
14761476
MachineMemOperand *MMO = *(MI.memoperands_begin());
1477-
const MachineFunction &MF = *MI.getParent()->getParent();
1478-
const auto &ST = MF.getSubtarget<RISCVSubtarget>();
1479-
if (ST.hasStdExtZihintntl() && MMO->isNonTemporal()) {
1480-
if (ST.hasStdExtCOrZca() && ST.enableRVCHintInstrs()) {
1477+
if (STI.hasStdExtZihintntl() && MMO->isNonTemporal()) {
1478+
if (STI.hasStdExtCOrZca() && STI.enableRVCHintInstrs()) {
14811479
if (isCompressibleInst(MI, STI))
14821480
return 4; // c.ntl.all + c.load/c.store
14831481
return 6; // c.ntl.all + load/store

0 commit comments

Comments
 (0)