[llvm] 3f5ee8a - [VPlan] Handle VPInstruction::Not in getSCEVExprForVPValue (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 3 14:33:09 PST 2026


Author: Florian Hahn
Date: 2026-01-03T22:32:52Z
New Revision: 3f5ee8aa76e7b97847d70c3b97117f3b6057bcd3

URL: https://github.com/llvm/llvm-project/commit/3f5ee8aa76e7b97847d70c3b97117f3b6057bcd3
DIFF: https://github.com/llvm/llvm-project/commit/3f5ee8aa76e7b97847d70c3b97117f3b6057bcd3.diff

LOG: [VPlan] Handle VPInstruction::Not in getSCEVExprForVPValue (NFC).

https://alive2.llvm.org/ce/z/jpLaJX

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
index 4fc9a3f20ff46..508323188b07d 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
@@ -117,6 +117,12 @@ const SCEV *vputils::getSCEVExprForVPValue(const VPValue *V,
     return CreateSCEV({LHSVal, RHSVal}, [&](ArrayRef<const SCEV *> Ops) {
       return SE.getMinusSCEV(Ops[0], Ops[1], SCEV::FlagAnyWrap, 0);
     });
+  if (match(V, m_Not(m_VPValue(LHSVal)))) {
+    // not X = xor X, -1 = -1 - X
+    return CreateSCEV({LHSVal}, [&](ArrayRef<const SCEV *> Ops) {
+      return SE.getMinusSCEV(SE.getMinusOne(Ops[0]->getType()), Ops[0]);
+    });
+  }
   if (match(V, m_Trunc(m_VPValue(LHSVal)))) {
     const VPlan *Plan = V->getDefiningRecipe()->getParent()->getPlan();
     Type *DestTy = VPTypeAnalysis(*Plan).inferScalarType(V);


        


More information about the llvm-commits mailing list