[llvm] [DebugInfo][LoopIdiomRecognize] Fix #82582: Wrong debug location update in processLoopStridedStore (PR #82723)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 01:24:57 PST 2024


================
@@ -0,0 +1,92 @@
+; RUN: opt < %s -passes=loop-idiom -S | FileCheck %s
+
+; Function Attrs: noinline nounwind uwtable
+define dso_local void @fun(ptr noundef %a) #0 !dbg !10 {
+
+; CHECK-LABEL: entry:
+; CHECK-NOT: call void @llvm.memset.p0.i64{{.*}}dbg {{![0-9]+}}
+entry:
+  tail call void @llvm.dbg.value(metadata ptr %a, metadata !16, metadata !DIExpression()), !dbg !17
+  tail call void @llvm.dbg.value(metadata i32 0, metadata !18, metadata !DIExpression()), !dbg !21
+  br label %for.body, !dbg !22
+
+for.body:                                         ; preds = %entry, %for.body
+  %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+  tail call void @llvm.dbg.value(metadata i32 %i.01, metadata !18, metadata !DIExpression()), !dbg !21
+  %idxprom = sext i32 %i.01 to i64, !dbg !23
+  %arrayidx = getelementptr inbounds double, ptr %a, i64 %idxprom, !dbg !23
+  store double 0.000000e+00, ptr %arrayidx, align 8, !dbg !26
+  %inc = add nsw i32 %i.01, 1, !dbg !27
+  tail call void @llvm.dbg.value(metadata i32 %inc, metadata !18, metadata !DIExpression()), !dbg !21
+  %cmp = icmp slt i32 %inc, 1000, !dbg !28
+  br i1 %cmp, label %for.body, label %for.end, !dbg !22, !llvm.loop !29
+
+for.end:                                          ; preds = %for.body
+  ret void, !dbg !32
+}
+
+; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+; Function Attrs: noinline nounwind uwtable
+define dso_local i32 @main() #0 !dbg !33 {
+entry:
+  %a = alloca [1000 x double], align 16
+  call void @llvm.dbg.declare(metadata ptr %a, metadata !36, metadata !DIExpression()), !dbg !40
+  %arraydecay = getelementptr inbounds [1000 x double], ptr %a, i64 0, i64 0, !dbg !41
+  call void @fun(ptr noundef %arraydecay), !dbg !42
+  ret i32 0, !dbg !43
+}
+
+; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
+declare void @llvm.dbg.value(metadata, metadata, metadata) #1
+
+attributes #0 = { noinline nounwind uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
----------------
OCHyams wrote:

We can probably remove these attributes?

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


More information about the llvm-commits mailing list