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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 02:28:14 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) {
----------------
nikic wrote:

```suggestion
      SE.getSmallConstantMaxTripCount(L) <= 5) {
```
I think that should work now? Calling the method twice is not great...

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


More information about the llvm-commits mailing list