[PATCH] D143644: [SCEV] Add a test where the trip count can't be calculated

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 00:29:47 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf79a5fb9df42: [Test][SCEV] Add a test where the trip count can't be calculated (authored by Maksim Kazantsev mkazantsev at azul.com <mkazantsev at dev3.azulsystems.com>).

Changed prior to commit:
  https://reviews.llvm.org/D143644?vs=496108&id=496857#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143644/new/

https://reviews.llvm.org/D143644

Files:
  llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll


Index: llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll
===================================================================
--- llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll
+++ llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll
@@ -575,5 +575,37 @@
   ret void
 }
 
+; TODO: Even though %num is known to divide by 4, and the loop's IV advances by 4, SCEV can't compute the trip count.
+define void @test_trip_multiple_4_vectorized_iv(i32 %num) {
+; CHECK-LABEL: 'test_trip_multiple_4_vectorized_iv'
+; CHECK-NEXT:  Classifying expressions for: @test_trip_multiple_4_vectorized_iv
+; CHECK-NEXT:    %u = urem i32 %num, 4
+; CHECK-NEXT:    --> (zext i2 (trunc i32 %num to i2) to i32) U: [0,4) S: [0,4)
+; CHECK-NEXT:    %i.010 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+; CHECK-NEXT:    --> {0,+,4}<%for.body> U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %inc = add i32 %i.010, 4
+; CHECK-NEXT:    --> {4,+,4}<%for.body> U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_trip_multiple_4_vectorized_iv
+; CHECK-NEXT:  Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
+; CHECK-NEXT:  Loop %for.body: Unpredictable predicated backedge-taken count.
+;
+entry:
+  %u = urem i32 %num, 4
+  %cmp = icmp eq i32 %u, 0
+  tail call void @llvm.assume(i1 %cmp)
+  br label %for.body
+
+for.body:
+  %i.010 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+  %inc = add i32 %i.010, 4
+  %cmp2 = icmp ult i32 %inc, %num
+  br i1 %cmp2, label %for.body, label %exit
+
+exit:
+  ret void
+}
+
 declare void @llvm.assume(i1)
 declare void @llvm.experimental.guard(i1, ...)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143644.496857.patch
Type: text/x-patch
Size: 1948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230213/a2b8e811/attachment.bin>


More information about the llvm-commits mailing list