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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 02:25:03 PDT 2024


================
@@ -88,9 +88,8 @@ void HexagonTTIImpl::getPeelingPreferences(Loop *L, ScalarEvolution &SE,
                                            TTI::PeelingPreferences &PP) {
   BaseT::getPeelingPreferences(L, SE, PP);
   // Only try to peel innermost loops with small runtime trip counts.
-  if (L && L->isInnermost() && canPeel(L) &&
-      SE.getSmallConstantTripCount(L) == 0 &&
-      SE.getSmallConstantMaxTripCount(L) > 0 &&
+  if (L && L->isInnermost() && canPeel(L) && !SE.getSmallConstantTripCount(L) &&
+      SE.getSmallConstantMaxTripCount(L) &&
       SE.getSmallConstantMaxTripCount(L) <= 5) {
----------------
artagnon wrote:

`std::optional<T>::operator<=(const optional<T>& opt, const T& value)` returns true when `opt` is `std::nullopt`, so this won't work.

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


More information about the llvm-commits mailing list