[llvm] [LV] Fix emission of debug message in legality check (PR #101924)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 08:32:26 PDT 2024


================
@@ -0,0 +1,35 @@
+; This test asserts that we don't emit both
+; successful and unsuccessful message about vectorization.
+
+; REQUIRES: asserts
+; RUN: opt -passes=loop-vectorize -debug -disable-output < %s 2>&1 | FileCheck %s
+; CHECK-NOT: LV: We can vectorize this loop
+; CHECK: LV: Not vectorizing: Cannot prove legality
+; CHECK-NOT: LV: We can vectorize this loop
+
+ at a = global [32000 x i32] zeroinitializer, align 4
+ at b = global [32000 x i32] zeroinitializer, align 4
+
+define void @foo() {
+entry:
+  %load_a_gep = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4
+  %val_a = load i32, ptr @a, align 4
+  br label %for.body
+
+for.cond.cleanup:                                 ; preds = %for.body
+  ret void
+
+for.body:                                         ; preds = %entry, %for.body
+  %0 = phi i32 [ %val_a, %entry ], [ %add6, %for.body ]
+  %1 = phi i32 [ %load_a_gep, %entry ], [ %2, %for.body ]
+  %indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.body ]
----------------
fhahn wrote:

```suggestion
  %iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.body ]
```

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


More information about the llvm-commits mailing list