[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 02:49:18 PDT 2024


================
@@ -0,0 +1,45 @@
+; RUN: opt < %s -S -passes=loop-unroll | FileCheck %s
+
+define i64 @d(i1 %tobool.not, i32 %add, i64 %conv23) {
+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
----------------
fhahn wrote:

Forgot to mention this earlier, but this checks that there is at least one call to `llvm.dbg.value`, not exactly one.

Multiple ways to go about this, .e.g 

```
CHECK: call void @llvm.dbg.value
CHECK-NOT:  call void @llvm.dbg.value
```

or matching the full generated IR using `llvm/utils/update_test_checks.py`

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


More information about the llvm-commits mailing list