-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC] Remove the unused hasMinSize() #133838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The 'hasOptSize()' is 'hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize()', so we don't need another 'hasMinSize()'.
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-backend-aarch64 Author: Ningning Shi(史宁宁) (shining1984) ChangesThe 'hasOptSize()' is 'hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize()', so we don't need another 'hasMinSize()'. Full diff: https://github.com/llvm/llvm-project/pull/133838.diff 4 Files Affected:
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index b3335d8710a65..e0be0d83f7513 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -16947,8 +16947,7 @@ bool AArch64TargetLowering::optimizeExtendOrTruncateConversion(
// transform unless the conversion is in a loop block guaranteed to execute
// and we are not optimizing for size.
Function *F = I->getParent()->getParent();
- if (!L || L->getHeader() != I->getParent() || F->hasMinSize() ||
- F->hasOptSize())
+ if (!L || L->getHeader() != I->getParent() || F->hasOptSize())
return false;
auto *SrcTy = dyn_cast<FixedVectorType>(I->getOperand(0)->getType());
@@ -28524,8 +28523,7 @@ bool AArch64TargetLowering::shouldLocalize(
if (Ty.getScalarSizeInBits() != 32 && Ty.getScalarSizeInBits() != 64)
break;
auto APF = MI.getOperand(1).getFPImm()->getValueAPF();
- bool OptForSize =
- MF.getFunction().hasOptSize() || MF.getFunction().hasMinSize();
+ bool OptForSize = MF.getFunction().hasOptSize();
if (isFPImmLegal(APF, EVT::getFloatingPointVT(Ty.getScalarSizeInBits()),
OptForSize))
return true; // Constant should be cheap.
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 56b1639143d8b..e88f33d6859ec 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -1332,7 +1332,7 @@ bool RISCVLegalizerInfo::legalizeCustom(
const Function &F = MF.getFunction();
// TODO: if PSI and BFI are present, add " ||
// llvm::shouldOptForSize(*CurMBB, PSI, BFI)".
- bool ShouldOptForSize = F.hasOptSize() || F.hasMinSize();
+ bool ShouldOptForSize = F.hasOptSize();
const ConstantInt *ConstVal = MI.getOperand(1).getCImm();
if (!shouldBeInConstantPool(ConstVal->getValue(), ShouldOptForSize))
return true;
diff --git a/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp b/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
index 450c191a896da..8f5540de6c16b 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
@@ -20,7 +20,7 @@ static bool shouldRunOnFunction(Function &F, ProfileSummaryInfo &PSI,
if (F.isDeclaration())
return false;
// Respect existing attributes.
- if (F.hasOptNone() || F.hasOptSize() || F.hasMinSize())
+ if (F.hasOptNone() || F.hasOptSize())
return false;
if (F.hasFnAttribute(Attribute::Cold))
return true;
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c3520dc95f8b4..55cc801e91452 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4729,8 +4729,7 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
return Result;
}
- if (OrigLoop->getHeader()->getParent()->hasOptSize() ||
- OrigLoop->getHeader()->getParent()->hasMinSize()) {
+ if (OrigLoop->getHeader()->getParent()->hasOptSize()) {
LLVM_DEBUG(
dbgs() << "LEV: Epilogue vectorization skipped due to opt for size.\n");
return Result;
|
@llvm/pr-subscribers-backend-risc-v Author: Ningning Shi(史宁宁) (shining1984) ChangesThe 'hasOptSize()' is 'hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize()', so we don't need another 'hasMinSize()'. Full diff: https://github.com/llvm/llvm-project/pull/133838.diff 4 Files Affected:
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index b3335d8710a65..e0be0d83f7513 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -16947,8 +16947,7 @@ bool AArch64TargetLowering::optimizeExtendOrTruncateConversion(
// transform unless the conversion is in a loop block guaranteed to execute
// and we are not optimizing for size.
Function *F = I->getParent()->getParent();
- if (!L || L->getHeader() != I->getParent() || F->hasMinSize() ||
- F->hasOptSize())
+ if (!L || L->getHeader() != I->getParent() || F->hasOptSize())
return false;
auto *SrcTy = dyn_cast<FixedVectorType>(I->getOperand(0)->getType());
@@ -28524,8 +28523,7 @@ bool AArch64TargetLowering::shouldLocalize(
if (Ty.getScalarSizeInBits() != 32 && Ty.getScalarSizeInBits() != 64)
break;
auto APF = MI.getOperand(1).getFPImm()->getValueAPF();
- bool OptForSize =
- MF.getFunction().hasOptSize() || MF.getFunction().hasMinSize();
+ bool OptForSize = MF.getFunction().hasOptSize();
if (isFPImmLegal(APF, EVT::getFloatingPointVT(Ty.getScalarSizeInBits()),
OptForSize))
return true; // Constant should be cheap.
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 56b1639143d8b..e88f33d6859ec 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -1332,7 +1332,7 @@ bool RISCVLegalizerInfo::legalizeCustom(
const Function &F = MF.getFunction();
// TODO: if PSI and BFI are present, add " ||
// llvm::shouldOptForSize(*CurMBB, PSI, BFI)".
- bool ShouldOptForSize = F.hasOptSize() || F.hasMinSize();
+ bool ShouldOptForSize = F.hasOptSize();
const ConstantInt *ConstVal = MI.getOperand(1).getCImm();
if (!shouldBeInConstantPool(ConstVal->getValue(), ShouldOptForSize))
return true;
diff --git a/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp b/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
index 450c191a896da..8f5540de6c16b 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
@@ -20,7 +20,7 @@ static bool shouldRunOnFunction(Function &F, ProfileSummaryInfo &PSI,
if (F.isDeclaration())
return false;
// Respect existing attributes.
- if (F.hasOptNone() || F.hasOptSize() || F.hasMinSize())
+ if (F.hasOptNone() || F.hasOptSize())
return false;
if (F.hasFnAttribute(Attribute::Cold))
return true;
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c3520dc95f8b4..55cc801e91452 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4729,8 +4729,7 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
return Result;
}
- if (OrigLoop->getHeader()->getParent()->hasOptSize() ||
- OrigLoop->getHeader()->getParent()->hasMinSize()) {
+ if (OrigLoop->getHeader()->getParent()->hasOptSize()) {
LLVM_DEBUG(
dbgs() << "LEV: Epilogue vectorization skipped due to opt for size.\n");
return Result;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The 'hasOptSize()' is 'hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize()', so we don't need another 'hasMinSize()'.
The 'hasOptSize()' is 'hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize()', so we don't need another 'hasMinSize()'.