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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 03:08:45 PDT 2026


================
@@ -33,6 +34,47 @@ namespace {
   } while (0)
 
 using VPInstructionTest = VPlanTestBase;
+using VPlanSCEVTest = VPlanTestIRBase;
+
+TEST_F(VPlanSCEVTest, GetSCEVExprForVPValueAbs) {
+  const char *ModuleString = R"(
+define void @f(i32 %x) {
+entry:
+  br label %loop
+loop:
+  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
+  %iv.next = add nuw nsw i32 %iv, 1
+  %exit = icmp eq i32 %iv.next, 4
+  br i1 %exit, label %exit.block, label %loop
+exit.block:
+  ret void
+}
+)";
----------------
artagnon wrote:

Ah yes, we require it to construct PSE, although we're not using it in SE. I wonder if it's possible to construct an empty Function, and an empty Loop from it? A bit undecided on what to do about the misleading test function at the moment.

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


More information about the llvm-commits mailing list