[llvm] [VPlan] Set debug location for VPReduction/VPWidenIntrinsicRecipe. (PR #120054)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 23:46:28 PST 2024


================
@@ -0,0 +1,34 @@
+; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -prefer-inloop-reductions -S | FileCheck %s -check-prefix DEBUGLOC
+
+; Testing the debug locations of the generated vector intstructions are same as
+; their scalar counterpart.
+
+define i32 @reduction_sum(ptr %A, ptr %B) {
+; DEBUGLOC-LABEL: define i32 @reduction_sum(
+; DEBUGLOC: vector.body:
+; DEBUGLOC:   = load <4 x i32>, ptr %{{.+}}, align 4, !dbg ![[LOADLOC:[0-9]+]]
+; DEBUGLOC:   = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %{{.+}}), !dbg ![[REDLOC:[0-9]+]]
+; DEBUGLOC: loop:
+; DEBUGLOC:   = load i32, ptr %{{.+}}, align 4, !dbg ![[LOADLOC]]
+; DEBUGLOC:   = add i32 %{{.+}}, %{{.+}}, !dbg ![[REDLOC]]
----------------
fhahn wrote:

```suggestion
; DEBUGLOC-NEXT:   = add i32 %{{.+}}, [[LOAD]], !dbg ![[REDLOC]]
```

to make sure we match the correct add?

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


More information about the llvm-commits mailing list