[llvm] [Transforms] Use a range-based for loop (NFC) (PR #105769)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 19:10:27 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/105769.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp (+2-5)
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
index 77d67a2ce0f380..1f9c3837cc06dc 100644
--- a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
+++ b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
@@ -331,12 +331,9 @@ bool PlaceSafepointsPass::runImpl(Function &F, const TargetLibraryInfo &TLI) {
// and b) edges to distinct loop headers. We need to insert pools on
// each.
SetVector<BasicBlock *> Headers;
- for (unsigned i = 0; i < Term->getNumSuccessors(); i++) {
- BasicBlock *Succ = Term->getSuccessor(i);
- if (DT.dominates(Succ, Term->getParent())) {
+ for (BasicBlock *Succ : successors(Term->getParent()))
+ if (DT.dominates(Succ, Term->getParent()))
Headers.insert(Succ);
- }
- }
assert(!Headers.empty() && "poll location is not a loop latch?");
// The split loop structure here is so that we only need to recalculate
``````````
</details>
https://github.com/llvm/llvm-project/pull/105769
More information about the llvm-commits
mailing list