[llvm] 873a7bb - [Transforms] Use llvm::pred_size and llvm::predecessors (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 00:27:47 PST 2024
Author: Kazu Hirata
Date: 2024-01-24T00:27:35-08:00
New Revision: 873a7bb12949709ea406c8adc82cd69fc372527d
URL: https://github.com/llvm/llvm-project/commit/873a7bb12949709ea406c8adc82cd69fc372527d
DIFF: https://github.com/llvm/llvm-project/commit/873a7bb12949709ea406c8adc82cd69fc372527d.diff
LOG: [Transforms] Use llvm::pred_size and llvm::predecessors (NFC)
Added:
Modified:
llvm/lib/Transforms/Scalar/JumpThreading.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 8603c5cf9c022c..c58df063d8c539 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -1431,16 +1431,14 @@ bool JumpThreadingPass::simplifyPartiallyRedundantLoad(LoadInst *LoadI) {
array_pod_sort(AvailablePreds.begin(), AvailablePreds.end());
// Create a PHI node at the start of the block for the PRE'd load value.
- pred_iterator PB = pred_begin(LoadBB), PE = pred_end(LoadBB);
- PHINode *PN = PHINode::Create(LoadI->getType(), std::distance(PB, PE), "");
+ PHINode *PN = PHINode::Create(LoadI->getType(), pred_size(LoadBB), "");
PN->insertBefore(LoadBB->begin());
PN->takeName(LoadI);
PN->setDebugLoc(LoadI->getDebugLoc());
// Insert new entries into the PHI for each predecessor. A single block may
// have multiple entries here.
- for (pred_iterator PI = PB; PI != PE; ++PI) {
- BasicBlock *P = *PI;
+ for (BasicBlock *P : predecessors(LoadBB)) {
AvailablePredsTy::iterator I =
llvm::lower_bound(AvailablePreds, std::make_pair(P, (Value *)nullptr));
More information about the llvm-commits
mailing list