Issue |
120168
|
Summary |
opt dot-cfg pass print wrong dbg number or I misuse this pass?
|
Labels |
new issue
|
Assignees |
|
Reporter |
tomgu1991
|
Hi, all, I use the following command to print cfg of llvm IR, but got the wrong dbg! number.
```cpp
//
// Created
//
void foo();
void bar();
void test1(int x) { foo(); }
void test2(int x) { bar(); }
```
```shell
clang -S -g -emit-llvm -Xclang -disable-O0-optnone -fno-discard-value-names test.cpp -o test.ll
opt -passes='dot-cfg' test.ll -S -o test_opt.ll
```
In the test_opt.ll(the same as test.ll) test1 is correct, as follows
<img width="1131" alt="Image" src="" />
But, in the test_opt.ll, test2 is the following: !dbg! is from 21 to 23
```
; Function Attrs: mustprogress noinline uwtable
define dso_local void @_Z5test2i(i32 noundef %x) #0 !dbg !19 {
entry:
%x.addr = alloca i32, align 4
store i32 %x, ptr %x.addr, align 4
call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !20, metadata !DIExpression()), !dbg !21
call void @_Z3barv(), !dbg !22
ret void, !dbg !23
}
!16 = !DILocation(line: 8, column: 16, scope: !10)
!17 = !DILocation(line: 8, column: 21, scope: !10)
!18 = !DILocation(line: 8, column: 28, scope: !10)
!19 = distinct !DISubprogram(name: "test2", linkageName: "_Z5test2i", scope: !1, file: !1, line: 10, type: !11, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !14)
!20 = !DILocalVariable(name: "x", arg: 1, scope: !19, file: !1, line: 10, type: !13)
!21 = !DILocation(line: 10, column: 16, scope: !19)
!22 = !DILocation(line: 10, column: 21, scope: !19)
!23 = !DILocation(line: 10, column: 28, scope: !19)
```
However, the dbg in dot is from 16 to 18,
<img width="1131" alt="Image" src="" />
So, is it a bug in opt dot-cfg pass or I misuse this?
Thanks!
zuxing
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs