[llvm] [LoopInterchange] Hoist isComputableLoopNest() in the control flow (PR #124247)

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 02:24:53 PST 2025


================
@@ -0,0 +1,125 @@
+; RUN: opt %s -passes='loop-interchange' -pass-remarks=loop-interchange -disable-output 2>&1 | FileCheck --allow-empty %s
+
+target triple = "aarch64-unknown-linux-gnu"
+
+; For the below test, backedge count cannot be computed. 
+; Computing backedge count requires only SCEV and should
+; not require dependence info. 
+;
+; void foo(int *a, int *neg, int *pos) {
+; int p = 0, q = 0;
+; for (unsigned int i = 0; i < 32; ++i) {
+;    for (unsigned int j = 0; j < 32; ++j) {
+;      if (a[i] < 0){
+;        neg[p++] = a[i];
+;      }
+;      else {
+;        pos[q++] = a[i];
+;      }
+;    }
+;  }
+;}
+
+; CHECK-NOT: Computed dependence info, invoking the transform.
+
+define dso_local void @_foo(ptr noundef %a, ptr noundef %neg, ptr noundef %pos) {
+entry:
+  %a.addr = alloca ptr, align 8
----------------
sjoerdmeijer wrote:

Nit pick on the test-case: could the IR be simplified? Will the IR be reduced if this is compiled with an higher optimisation level?

And another nitpick: maybe get rid of the 

     ; preds = %for.inc16, %entry

comments


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


More information about the llvm-commits mailing list