[llvm] [Target] Use llvm::max_element (NFC) (PR #137926)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 29 23:52:02 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-webassembly
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/137926.diff
2 Files Affected:
- (modified) llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp (+3-3)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (+1-2)
``````````diff
diff --git a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
index 7592634117dc1..9d07512b7d8a6 100644
--- a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -877,9 +877,9 @@ MipsDelaySlotFiller::selectSuccBB(MachineBasicBlock &B) const {
// Select the successor with the larget edge weight.
auto &Prob = getAnalysis<MachineBranchProbabilityInfoWrapperPass>().getMBPI();
- MachineBasicBlock *S = *std::max_element(
- B.succ_begin(), B.succ_end(),
- [&](const MachineBasicBlock *Dst0, const MachineBasicBlock *Dst1) {
+ MachineBasicBlock *S =
+ *llvm::max_element(B.successors(), [&](const MachineBasicBlock *Dst0,
+ const MachineBasicBlock *Dst1) {
return Prob.getEdgeProbability(&B, Dst0) <
Prob.getEdgeProbability(&B, Dst1);
});
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 794db887bd073..aac68b32da13a 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -2542,8 +2542,7 @@ SDValue WebAssemblyTargetLowering::LowerBUILD_VECTOR(SDValue Op,
};
auto GetMostCommon = [](auto &Counts) {
- auto CommonIt =
- std::max_element(Counts.begin(), Counts.end(), llvm::less_second());
+ auto CommonIt = llvm::max_element(Counts, llvm::less_second());
assert(CommonIt != Counts.end() && "Unexpected all-undef build_vector");
return *CommonIt;
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/137926
More information about the llvm-commits
mailing list