<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57961>57961</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Dataflow graph generation pass fails to run due to segmentation fault.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sansquoi
      </td>
    </tr>
</table>

<pre>
    [LLVM-CFG-DFG-pass.zip](https://github.com/llvm/llvm-project/files/9640070/LLVM-CFG-DFG-pass.zip)

Trying to run https://github.com/PL97/LLVM-CFG-DFG-pass with legacy pass manager (enable-new-pm=0) on simple C file.

Results in:
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: opt -load ../DFGPass/build/DFG/libLLVMDFG.so -enable-new-pm=0 -DFGPass test.ll -o main.dot
1.      Running pass 'DFG Pass Analyse' on module 'test.ll'.
 #0 0x00007f87d9e5bd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01)
 #1 0x00007f87d9e59a3e llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3da3e)
 #2 0x00007f87d9e5c236 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe40236)
 #3 0x00007f87d8b05520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f87d9e65e51 llvm::Value::print(llvm::raw_ostream&, bool) const (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe49e51)
 #5 0x00007f87d69c55d0 llvm::operator<<(llvm::raw_ostream&, llvm::Value const&) (../DFGPass/build/DFG/libLLVMDFG.so+0x205d0)
 #6 0x00007f87d69c452a (anonymous namespace)::DFGPass::writeFileByGraphGlobal(Mode) DFG.cpp:0:0
 #7 0x00007f87d69c40ae (anonymous namespace)::DFGPass::runOnModule(llvm::Module&) DFG.cpp:0:0
 #8 0x00007f87d9f96f66 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xf7af66)
 #9 0x000000000043468b main (/usr/lib/llvm-14/bin/opt+0x43468b)
#10 0x00007f87d8aecd90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#11 0x00007f87d8aece40 call_init ./csu/../csu/libc-start.c:128:20
#12 0x00007f87d8aece40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#13 0x000000000041a785 _start (/usr/lib/llvm-14/bin/opt+0x41a785)
Segmentation fault (core dumped)


Attached files show my running script and edited code I'm using.
>From what I can see, the code fails at Value* p = (*node_iter)->va; at line 165 and if(isa<Instruction>(*p)) at line 168.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVslu4zgQ_Rr5Qkigdungg7NOgAQTdBp9NSiJkjlDkRqSasfz9VOkvMntCToxbJni8urVI1lVlWx2Sy-9eX7-8eLfPjz6d_AbiNbBv2zw0jsvKjbGDNqLV170AN-Omc1YBbXs4YXzn4c_f1DyL1obeG0Zpxr-yyzBOMfQuo4elR6-8_Bqen5XOyY6ZCRSo0AfGH19LvNrmGgLsxCnHal3yHX0RJCOKgROUEEqTn1Bt_7Qe_EdsCqRFEizfuAU3SJLOjjn843qkRuNmLA0XNfr8_3q7R7pseqZQQRVY4cUHaQylvandWJaj04oREQDdmo-NhSZDUW1InqDKlL_bRSpD7zeDHSgZuyHIyMMQ-Wrkp0iPSKqG3sqjCWB5GCQzyVpUBCACRDpFSSBVjUy3kw9lhKrrJDwEmiJ_F9kQv5-JTJUm4Bz5EvQlYmgkWbiEFoO30Yh7PY53b0oh1XILVsJwneaQpeVu5fNCHLD2x4OWnvvoDPGCL9j-ORtkTclTasGh8iJBw7HK73TU-NVMWGcHN-tPrC_p0mKbNdSG0UJSJ550S0oa-xuw6zJYXi-F9k6S3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