[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


================
@@ -346,7 +346,7 @@ bool PPCTTIImpl::isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE,
   SchedModel.init(ST);
 
   // Do not convert small short loops to CTR loop.
-  unsigned ConstTripCount = SE.getSmallConstantTripCount(L);
+  unsigned ConstTripCount = SE.getSmallConstantTripCount(L).value_or(0);
----------------
nikic wrote:

value_or doesn't seem useful here, given the only uses on the line below.

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


More information about the llvm-commits mailing list