[llvm] [BasicBlockUtils] Remove redundant llvm.dbg instructions after blocks to reduce compile time (PR #89069)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 01:50:53 PDT 2024


================
@@ -0,0 +1,51 @@
+; RUN: opt < %s -S -mtriple=riscv64 -passes=loop-unroll | FileCheck %s
+
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
+target triple = "riscv64"
+
+define i64 @d(i1 %tobool.not, i32 %add, i64 %conv23) #0 {
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %for.body, %entry
+  ; There should be only one "llvm.dbg.vale" after loop unrolling
+  ; CHECK: tail call void @llvm.dbg.value(metadata i32 0, metadata !13, metadata !DIExpression()), !dbg !17
+  ; CHECK: ret i64 5
+
+  %k.045 = phi i64 [ 0, %entry ], [ %k.046, %for.body ]
+  tail call void @llvm.dbg.value(metadata i32 0, metadata !13, metadata !DIExpression()), !dbg !17
+  %k.046 = add nuw nsw i64 %k.045, 1
+  %exitcond = icmp ne i64 %k.046, 5
+  br i1 %exitcond, label %for.body, label %for.end22
+
+for.end22:                                        ; preds = %for.body
+  ret i64 %k.046
+}
+
+; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
+declare void @llvm.dbg.value(metadata, metadata, metadata) #1
+
+attributes #0 = { "target-cpu"="generic-rv64" }
----------------
fhahn wrote:

not needed?

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


More information about the llvm-commits mailing list