-
Notifications
You must be signed in to change notification settings - Fork 140
Open
Description
I have noticed multiple times on different IR fragments that addDefUseEdges() fails with certain llvm.dbg.value functions.
The problem seems to arise when the first argument of llvm.dbg.value is not a pointer.
For example:
call void @llvm.dbg.value(metadata %struct.rsa_st* %0, metadata !1062, metadata !DIExpression()), !dbg !1090
call void @llvm.dbg.value(metadata i32 undef, metadata !1063, metadata !DIExpression()), !dbg !1090
The first one works perfectly, but the second one fails (see trace bellow).
dg/lib/llvm/LLVMDependenceGraph.cpp
Lines 1265 to 1275 in dc3615d
| if (val) { | |
| auto *nd = dg->getNode(&I); | |
| auto *ndop = dg->getNode(val); | |
| assert(nd && "Do not have a node for a dbg intrinsic"); | |
| assert(ndop && "Do not have a node for an operand of a dbg " | |
| "intrinsic"); | |
| // add a use edge such that we preserve | |
| // the debugging intrinsic when we preserve | |
| // the value it is talking about | |
| nd->addUseDependence(ndop); | |
| } |
When looking at addDefUseEdges() I noticed that ndop is a null pointer in the second case.
The IR fragment was compiled with Clang 14.0.0 and
-Og -gflags.Any ideas what the problem could be or how I could help figure it out?
trace when compiled with debug info:
#0 0x00007d087963fd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-14/lib/libLLVM-14.so.1+0xe3fd01)
#1 0x00007d087963da0c llvm::sys::RunSignalHandlers() (/usr/lib/llvm-14/lib/libLLVM-14.so.1+0xe3da0c)
#2 0x00007d0879640236 (/usr/lib/llvm-14/lib/libLLVM-14.so.1+0xe40236)
#3 0x00007d0878042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007d08780969fc __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#5 0x00007d08780969fc __pthread_kill_internal ./nptl/./nptl/pthread_kill.c:78:10
#6 0x00007d08780969fc pthread_kill ./nptl/./nptl/pthread_kill.c:89:10
#7 0x00007d0878042476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007d08780287f3 abort ./stdlib/./stdlib/abort.c:81:7
#9 0x00007d087802871b _nl_load_domain ./intl/./intl/loadmsgcat.c:1177:9
#10 0x00007d0878039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007d087f9bcde2 dg::LLVMDependenceGraph::addDefUseEdges(bool) /home/wito/dg/lib/llvm/LLVMDependenceGraph.cpp:1274:41
#12 0x00006183458e2489 dg::llvmdg::LLVMDependenceGraphBuilder::computeDependencies(std::unique_ptr<dg::LLVMDependenceGraph, std::default_delete<dg::LLVMDependenceGraph> >&&) /home/wito/dg/include/dg/llvm/LLVMDependenceGraphBuilder.h:235:38
#13 0x00006183458e6bd4 Slicer::computeDependencies() /home/wito/dg/tools/include/dg/tools/llvm-slicer.h:105:58
#14 0x00006183458e6ebc Slicer::mark(std::set<dg::LLVMNode*, std::less<dg::LLVMNode*>, std::allocator<dg::LLVMNode*> >&) /home/wito/dg/tools/include/dg/tools/llvm-slicer.h:132:34
#15 0x00006183458d6677 main /home/wito/dg/tools/llvm-slicer.cpp:267:9
#16 0x00007d0878029d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#17 0x00007d0878029e40 call_init ./csu/../csu/libc-start.c:128:20
#18 0x00007d0878029e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#19 0x00006183458d5725 _start (/home/wito/dg/build/tools/llvm-slicer+0xb9725)
Metadata
Metadata
Assignees
Labels
No labels