[llvm] [VPlan] Improve code using m_APInt (NFC) (PR #161683)
    Florian Hahn via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Oct 20 01:49:51 PDT 2025
    
    
  
================
@@ -1472,11 +1472,8 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
   if (!Plan.getVectorLoopRegion())
     return false;
 
-  if (!Plan.getTripCount()->isLiveIn())
-    return false;
-  auto *TC = dyn_cast_if_present<ConstantInt>(
-      Plan.getTripCount()->getUnderlyingValue());
-  if (!TC || !BestVF.isFixed())
+  const APInt *TC;
+  if (!match(Plan.getTripCount(), m_APInt(TC)) || !BestVF.isFixed())
----------------
fhahn wrote:
while touching this, can also re-order to first check cheaper BestVF.isFixed()`?
```suggestion
  if (!BestVF.isFixed() || !match(Plan.getTripCount(), m_APInt(TC)))
```
https://github.com/llvm/llvm-project/pull/161683
    
    
More information about the llvm-commits
mailing list