Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[llvm] Use llvm::find_if (NFC) #139654

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

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot llvmbot added backend:AMDGPU PGO Profile Guided Optimizations labels May 13, 2025
@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-pgo

@llvm/pr-subscribers-backend-amdgpu

Author: Kazu Hirata (kazutakahirata)

Changes

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

3 Files Affected:

  • (modified) llvm/lib/ProfileData/Coverage/CoverageMapping.cpp (+2-2)
  • (modified) llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp (+3-4)
  • (modified) llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp (+10-12)
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index d3fe218c19a14..dd74eb054a34c 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -260,8 +260,8 @@ void MCDCRecord::findIndependencePairs() {
   // Will be replaced to shorter expr.
   unsigned TVTrueIdx = std::distance(
       TV.begin(),
-      std::find_if(TV.begin(), TV.end(),
-                   [&](auto I) { return (I.second == MCDCRecord::MCDC_True); })
+      llvm::find_if(TV,
+                    [&](auto I) { return (I.second == MCDCRecord::MCDC_True); })
 
   );
   for (unsigned I = TVTrueIdx; I < NumTVs; ++I) {
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
index eab76bb79c969..f0d63f523088b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
@@ -386,10 +386,9 @@ bool LiveRegOptimizer::optimizeLiveType(
         Value *NextDeadValue = PHIWorklist.pop_back_val();
         VisitedPhis.insert(NextDeadValue);
         auto OriginalPhi =
-            std::find_if(PhiNodes.begin(), PhiNodes.end(),
-                         [this, &NextDeadValue](PHINode *CandPhi) {
-                           return ValMap[CandPhi] == NextDeadValue;
-                         });
+            llvm::find_if(PhiNodes, [this, &NextDeadValue](PHINode *CandPhi) {
+              return ValMap[CandPhi] == NextDeadValue;
+            });
         // This PHI may have already been removed from maps when
         // unwinding a previous Phi
         if (OriginalPhi != PhiNodes.end())
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp
index c1626b4fac869..5027705ef61de 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp
@@ -229,18 +229,16 @@ class PreloadKernelArgInfo {
     // If we fail to preload any implicit argument we know we don't have SGPRs
     // to preload any subsequent ones with larger offsets. Find the first
     // argument that we cannot preload.
-    auto *PreloadEnd =
-        std::find_if(ImplicitArgLoads.begin(), ImplicitArgLoads.end(),
-                     [&](const std::pair<LoadInst *, unsigned> &Load) {
-                       unsigned LoadSize =
-                           DL.getTypeStoreSize(Load.first->getType());
-                       unsigned LoadOffset = Load.second;
-                       if (!canPreloadKernArgAtOffset(LoadOffset + LoadSize +
-                                                      ImplicitArgsBaseOffset))
-                         return true;
-
-                       return false;
-                     });
+    auto *PreloadEnd = llvm::find_if(
+        ImplicitArgLoads, [&](const std::pair<LoadInst *, unsigned> &Load) {
+          unsigned LoadSize = DL.getTypeStoreSize(Load.first->getType());
+          unsigned LoadOffset = Load.second;
+          if (!canPreloadKernArgAtOffset(LoadOffset + LoadSize +
+                                         ImplicitArgsBaseOffset))
+            return true;
+
+          return false;
+        });
 
     if (PreloadEnd == ImplicitArgLoads.begin())
       return;

@kazutakahirata kazutakahirata merged commit 510c8a2 into llvm:main May 13, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_std_find_if_llvm branch May 13, 2025 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AMDGPU PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.