Skip to content

[NFC] Use the hasMinSize() instead of hasFnAttribute(Attribute::MinSize) #135328

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

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

shining1984
Copy link
Contributor

The other code all use the hasMinSize(), so I change the last two hasFnAttribute(Attribute::MinSize).

The other code all use the hasMinSize(), so I change the last two
hasFnAttribute(Attribute::MinSize).
@llvmbot
Copy link
Member

llvmbot commented Apr 11, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Ningning Shi(史宁宁) (shining1984)

Changes

The other code all use the hasMinSize(), so I change the last two hasFnAttribute(Attribute::MinSize).


Full diff: https://github.com/llvm/llvm-project/pull/135328.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/IPO/HotColdSplitting.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Scalar/JumpThreading.cpp (+1-1)
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
index 4b3f0e23903aa..3d8b7cbb59630 100644
--- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -199,7 +199,7 @@ static bool markFunctionCold(Function &F, bool UpdateEntryCount = false) {
     F.addFnAttr(Attribute::Cold);
     Changed = true;
   }
-  if (!F.hasFnAttribute(Attribute::MinSize)) {
+  if (!F.hasMinSize()) {
     F.addFnAttr(Attribute::MinSize);
     Changed = true;
   }
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index a518e02d762f6..ba598d8415b18 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -303,7 +303,7 @@ bool JumpThreadingPass::runImpl(Function &F_, FunctionAnalysisManager *FAM_,
   // size.
   if (BBDuplicateThreshold.getNumOccurrences())
     BBDupThreshold = BBDuplicateThreshold;
-  else if (F->hasFnAttribute(Attribute::MinSize))
+  else if (F->hasMinSize())
     BBDupThreshold = 3;
   else
     BBDupThreshold = DefaultBBDupThreshold;

@shining1984 shining1984 requested review from lenary and wangpc-pp April 11, 2025 08:38
@shining1984 shining1984 merged commit 37a86cb into llvm:main Apr 11, 2025
13 checks passed
@shining1984 shining1984 deleted the hasFnAttribute-minsize branch April 11, 2025 11:40
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
…ze) (llvm#135328)

The other code all use the hasMinSize(), so I change the last two
hasFnAttribute(Attribute::MinSize).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants