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

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 15:19:20 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]]
----------------
ElvisWang123 wrote:

Updated with `[[LOAD]]`. We cannot use `DEBUGLOC-NEXT` since there are some debug information between instructions.

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


More information about the llvm-commits mailing list