Skip to content

Commit e2cd7f9

Browse files
committed
Remove llvm::shouldOptForSize()
1 parent e517cfc commit e2cd7f9

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "llvm/CodeGen/MachineInstr.h"
2525
#include "llvm/CodeGenTypes/LowLevelType.h"
2626
#include "llvm/IR/Function.h"
27+
#include "llvm/Transforms/Utils/SizeOpts.h"
2728
#include <bitset>
2829
#include <cstddef>
2930
#include <cstdint>
@@ -635,8 +636,12 @@ class GIMatchTableExecutor {
635636

636637
bool shouldOptForSize(const MachineFunction *MF) const {
637638
const auto &F = MF->getFunction();
638-
return F.hasOptSize() || F.hasMinSize() ||
639-
(PSI && BFI && CurMBB && llvm::shouldOptForSize(*CurMBB, PSI, BFI));
639+
if (F.hasOptSize())
640+
return true;
641+
if (CurMBB)
642+
if (auto *BB = CurMBB->getBasicBlock())
643+
return llvm::shouldOptimizeForSize(BB, PSI, BFI);
644+
return false;
640645
}
641646

642647
public:

llvm/include/llvm/CodeGen/GlobalISel/Utils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,6 @@ bool isConstFalseVal(const TargetLowering &TLI, int64_t Val, bool IsVector,
542542
/// TargetBooleanContents.
543543
int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector, bool IsFP);
544544

545-
/// Returns true if the given block should be optimized for size.
546-
bool shouldOptForSize(const MachineBasicBlock &MBB, ProfileSummaryInfo *PSI,
547-
BlockFrequencyInfo *BFI);
548-
549545
using SmallInstListTy = GISelWorkList<4>;
550546
void saveUsesAndErase(MachineInstr &MI, MachineRegisterInfo &MRI,
551547
LostDebugLocObserver *LocObserver,

llvm/lib/CodeGen/GlobalISel/Utils.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,11 +1619,6 @@ int64_t llvm::getICmpTrueVal(const TargetLowering &TLI, bool IsVector,
16191619
llvm_unreachable("Invalid boolean contents");
16201620
}
16211621

1622-
bool llvm::shouldOptForSize(const MachineBasicBlock &MBB,
1623-
ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) {
1624-
return llvm::shouldOptimizeForSize(MBB.getBasicBlock(), PSI, BFI);
1625-
}
1626-
16271622
void llvm::saveUsesAndErase(MachineInstr &MI, MachineRegisterInfo &MRI,
16281623
LostDebugLocObserver *LocObserver,
16291624
SmallInstListTy &DeadInstChain) {

0 commit comments

Comments
 (0)