Skip to content

Commit 934338f

Browse files
committed
Use F.hasOptSize() instead of checking optsize directly
1 parent 2f8c926 commit 934338f

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ void MachineFunction::init() {
211211
ConstantPool = new (Allocator) MachineConstantPool(getDataLayout());
212212
Alignment = STI->getTargetLowering()->getMinFunctionAlignment();
213213

214-
// FIXME: Use Function::hasOptSize().
215-
if (!F.getAlign() && !F.hasFnAttribute(Attribute::OptimizeForSize))
214+
if (!F.getAlign() && !F.hasOptSize())
216215
Alignment = std::max(Alignment,
217216
STI->getTargetLowering()->getPrefFunctionAlignment());
218217

llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4261,8 +4261,7 @@ std::optional<unsigned> ARMBaseInstrInfo::getOperandLatencyImpl(
42614261
// instructions).
42624262
if (Latency > 0 && Subtarget.isThumb2()) {
42634263
const MachineFunction *MF = DefMI.getParent()->getParent();
4264-
// FIXME: Use Function::hasOptSize().
4265-
if (MF->getFunction().hasFnAttribute(Attribute::OptimizeForSize))
4264+
if (MF->getFunction().hasOptSize())
42664265
--Latency;
42674266
}
42684267
return Latency;

llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ bool HexagonCopyToCombine::runOnMachineFunction(MachineFunction &MF) {
457457
TII = ST->getInstrInfo();
458458

459459
const Function &F = MF.getFunction();
460-
bool OptForSize = F.hasFnAttribute(Attribute::OptimizeForSize);
460+
bool OptForSize = F.hasOptSize();
461461

462462
// Combine aggressively (for code size)
463463
ShouldCombineAggressively =

llvm/lib/Target/Hexagon/HexagonMask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool HexagonMask::runOnMachineFunction(MachineFunction &MF) {
7676
HII = HST.getInstrInfo();
7777
const Function &F = MF.getFunction();
7878

79-
if (!F.hasFnAttribute(Attribute::OptimizeForSize))
79+
if (!F.hasOptSize())
8080
return false;
8181
// Mask instruction is available only from v66
8282
if (!HST.hasV66Ops())

llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ static bool PGOMemOPSizeOptImpl(Function &F, BlockFrequencyInfo &BFI,
456456
if (DisableMemOPOPT)
457457
return false;
458458

459-
if (F.hasFnAttribute(Attribute::OptimizeForSize))
459+
if (F.hasOptSize())
460460
return false;
461461
MemOPSizeOpt MemOPSizeOpt(F, BFI, ORE, DT, TLI);
462462
MemOPSizeOpt.perform();

llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ bool LibCallsShrinkWrap::perform(CallInst *CI) {
498498

499499
static bool runImpl(Function &F, const TargetLibraryInfo &TLI,
500500
DominatorTree *DT) {
501-
if (F.hasFnAttribute(Attribute::OptimizeForSize))
501+
if (F.hasOptSize())
502502
return false;
503503
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
504504
LibCallsShrinkWrap CCDCE(TLI, DTU);

0 commit comments

Comments
 (0)