[llvm] [ConstraintElim] Add lower bounds for all inductions in a loop header. (PR #216764)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 09:07:05 PDT 2026
================
@@ -965,6 +974,84 @@ static void dumpConstraint(ArrayRef<int64_t> C,
}
#endif
+/// Splits the induction phi \p PN into the start value, coming from the loop
+/// predecessor \p LoopPred, and the step value, coming from inside the loop.
+/// Returns {nullptr, nullptr} if \p PN has other incoming values.
+static std::pair<Value *, Value *> getStartAndStep(const PHINode &PN,
+ const BasicBlock *LoopPred) {
+ assert(PN.getBasicBlockIndex(LoopPred) >= 0 &&
+ "LoopPred must be a predecessor of the phi's block");
+ if (PN.getNumIncomingValues() != 2)
+ return {nullptr, nullptr};
+ unsigned StartIdx = PN.getIncomingBlock(0) == LoopPred ? 0 : 1;
+ return {PN.getIncomingValue(StartIdx), PN.getIncomingValue(1 - StartIdx)};
+}
+
+std::pair<bool, bool> State::getNonDecreasingInfo(PHINode &PN, Value *Start,
----------------
dtcxzyw wrote:
Start is unused.
https://github.com/llvm/llvm-project/pull/216764
More information about the llvm-commits
mailing list