[llvm] Check hasOptSize() in shouldOptimizeForSize() (PR #112626)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 09:32:33 PDT 2024
================
@@ -44,7 +48,9 @@ bool llvm::shouldOptimizeForSize(const MachineBasicBlock *MBB,
MBFIWrapper *MBFIW,
PGSOQueryType QueryType) {
assert(MBB);
- if (!PSI || !MBFIW)
+ if (MBB->getParent()->getFunction().hasOptSize())
+ return true;
+ if (!MBFIW)
----------------
ellishg wrote:
Yes because `PSI` is checked in `shouldOptimizeForSizeImpl()` anyway.
https://github.com/llvm/llvm-project/blob/8417f6af54c8f6dcf5893ab1352b50bf33c5a1ba/llvm/include/llvm/Transforms/Utils/SizeOpts.h#L72-L76
https://github.com/llvm/llvm-project/pull/112626
More information about the llvm-commits
mailing list