[llvm] [VPlan] Add SCEV support for abs intrinsic (PR #195678)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 21:55:13 PDT 2026


================
@@ -258,6 +258,13 @@ const SCEV *vputils::getSCEVExprForVPValue(const VPValue *V,
     return CreateSCEV({LHSVal, RHSVal}, [&](ArrayRef<SCEVUse> Ops) {
       return SE.getSMinExpr(Ops[0], Ops[1]);
     });
+  const APInt *IsIntMinPoison;
+  if (match(V, m_Intrinsic<Intrinsic::abs>(m_VPValue(LHSVal),
+                                           m_APInt(IsIntMinPoison))) &&
+      IsIntMinPoison->getBitWidth() == 1)
+    return CreateSCEV({LHSVal}, [&](ArrayRef<SCEVUse> Ops) {
+      return SE.getAbsExpr(Ops[0], IsIntMinPoison->isOne());
----------------
madhur13490 wrote:

Agree that was not intentional. I am passing the flag is "false" explicitly and have added a comment to revisit in future. 

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


More information about the llvm-commits mailing list