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

    <tr>
        <th>Summary</th>
        <td>
            crash due to using a new Transformation Pass
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    [](url)Hello,

I am new to llvm, I have written an llvm pass to insert a call to a specific function after each call Instruction.
This is the crash backtrace I got and I don't understand the problem. (the code of the pass is included here if that might help)

Thank you in advance.


Stack dump:
0.      Program arguments: opt-15 -load-pass-plugin lib/libInstrumentCall.so --passes=instr-call instrumentcall.ll
 #0 0x00007fcdb0f35451 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xf04451)
 #1 0x00007fcdb0f3318e llvm::sys::RunSignalHandlers() (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xf0218e)
 #2 0x00007fcdb0f35976 (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xf04976)
 #3 0x00007fcdafb0a520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007fcdb10c8340 llvm::Value::getName() const (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0x1097340)
 #5 0x00007fcdad9ccb6c InstrumentCall::runOnModule(llvm::Module&) /home/ss/llvm-tutor/lib/InstrumentCall.cpp:74:82
 #6 0x00007fcdad9cce0e InstrumentCall::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/ss/llvm-tutor/lib/InstrumentCall.cpp:97:30
 #7 0x00007fcdad9d4723 llvm::detail::PassModel<llvm::Module, InstrumentCall, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /usr/include/llvm-15/llvm/IR/PassManagerInternal.h:89:3
 #8 0x00007fcdb10a61b9 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0x10751b9)
 #9 0x0000562c08da8f37 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) (/usr/lib/llvm-15/bin/opt+0x22f37)
#10 0x0000562c08dbac04 main (/usr/lib/llvm-15/bin/opt+0x34c04)
#11 0x00007fcdafaf1d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#12 0x00007fcdafaf1e40 call_init ./csu/../csu/libc-start.c:128:20
#13 0x00007fcdafaf1e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#14 0x0000562c08da1905 _start (/usr/lib/llvm-15/bin/opt+0x1b905)
Segmentation fault (core dumped)


[InstrumentCall.zip](https://github.com/llvm/llvm-project/files/9707451/InstrumentCall.zip)



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNV9tu2zgQ_Rr7hbBB3aUHP6TpGjW22QZN0FeDoiiJW5oUeEmT_fodUk5luU633XSBDQRG1gxnzhwOOcNaNU-bRfZmkb1dxKXTYhFX75gQahFfL_DbBb4axx0iByTZF2QVEuLhAGK0Qz15YOiL5tYyiYgMEjQQY7wal4ZpiwiiRAj_gSAzMMpbTlHrJLVcwaTWMo0Yof2otpPGahdk69Hzfc8Ngsf2DFFNTI9qQj9bTSgDBJ0CD7KBt0bJRVxY5GTDtLH-o58yaFULdlgjCC-YUA1Dqh1lHqm3LqlwDWtQzzR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