Skip to content

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
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