aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2024-10-28 09:45:03 -0700
committerGitHub <noreply@github.com>2024-10-28 09:45:03 -0700
commit6ab26eab4f1e06f2da7b3183c55666ad57f8866e (patch)
tree8d58cecc95cfea7a335f12e325e952263cb3db3e /llvm/lib/CodeGen/BranchFolding.cpp
parent92412c106f5275b4b385f7c2d882008181de2854 (diff)
downloadllvm-6ab26eab4f1e06f2da7b3183c55666ad57f8866e.zip
llvm-6ab26eab4f1e06f2da7b3183c55666ad57f8866e.tar.gz
llvm-6ab26eab4f1e06f2da7b3183c55666ad57f8866e.tar.bz2
Check hasOptSize() in shouldOptimizeForSize() (#112626)
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index 1dc2785..f8de136 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -645,11 +645,8 @@ ProfitableToMerge(MachineBasicBlock *MBB1, MachineBasicBlock *MBB2,
// we don't have to split a block. At worst we will be introducing 1 new
// branch instruction, which is likely to be smaller than the 2
// instructions that would be deleted in the merge.
- MachineFunction *MF = MBB1->getParent();
- bool OptForSize =
- MF->getFunction().hasOptSize() ||
- (llvm::shouldOptimizeForSize(MBB1, PSI, &MBBFreqInfo) &&
- llvm::shouldOptimizeForSize(MBB2, PSI, &MBBFreqInfo));
+ bool OptForSize = llvm::shouldOptimizeForSize(MBB1, PSI, &MBBFreqInfo) &&
+ llvm::shouldOptimizeForSize(MBB2, PSI, &MBBFreqInfo);
return EffectiveTailLen >= 2 && OptForSize &&
(FullBlockTail1 || FullBlockTail2);
}