[llvm] SCEV: return std::nullopt for invalid TC (NFC) (PR #94162)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 09:22:33 PDT 2024


================
@@ -6822,8 +6822,8 @@ canFoldTermCondOfLoop(Loop *L, ScalarEvolution &SE, DominatorTree &DT,
   // the allowed cost with the loops trip count as best we can.
   const unsigned ExpansionBudget = [&]() {
     unsigned Budget = 2 * SCEVCheapExpansionBudget;
-    if (unsigned SmallTC = SE.getSmallConstantMaxTripCount(L))
-      return std::min(Budget, SmallTC);
+    if (std::optional<unsigned> SmallTC = SE.getSmallConstantMaxTripCount(L))
+      return std::min(Budget, *SmallTC);
----------------
artagnon wrote:

Yes.

https://github.com/llvm/llvm-project/pull/94162


More information about the llvm-commits mailing list