<div dir="ltr">Hi,<div>I want to convert a function pointer call in the IR of MPlayer to a function call. For example, I have the following line:</div><div><div>...</div><div>%10 = tail call i32 %7(%struct.demuxer* nonnull %0, i32 %1, i8* %2) #7, !dbg !863222</div></div><div>...</div><div>I want to set the target which is stored in %7 to a real function called "demux_lavf_control()" with the following definition:</div><div>...</div><div><div>define internal i32 @demux_lavf_control(%struct.<wbr>demuxer.2657* nocapture readonly, i32, i8* nocapture) #0 !dbg !963916 {</div></div><div>...</div><div>I wrote a function pass and found the mentioned function pointer call (here, stored in "CallInstr") and set the call target as follows:</div><div>...</div><div><div>Module *theModule = F.getParent();</div><div>Function *targetFunc = theModule->getFunction("demux_<wbr>lavf_control");</div><div>CalIInstr->setCalledFunction(<wbr>targetFunc);</div></div><div>...</div><div>"F" is the function containing the call. But it leads to the following error:</div><div><div>...</div><div>Call parameter type does not match function signature!</div><div>%struct.demuxer* %0</div><div> %struct.demuxer.2657*  %10 = tail call i32 @demux_lavf_control(%struct.<wbr>demuxer* nonnull %0, i32 %1, i8* %2) #7, !dbg !863222</div><div>LLVM ERROR: Broken function found, compilation aborted!</div></div><div>...</div><div>The [names:types] of call operands before the change is:</div><div>...</div><div><div>[:%struct.demuxer*] </div><div>[:i32] </div><div>[:i8*] </div><div>[:i32 (%struct.demuxer*, i32, i8*)*] </div></div><div>...</div><div>And after the change is:</div><div>...</div><div><div>[:%struct.demuxer*] </div><div>[:i32] </div><div>[:i8*] </div><div>[demux_lavf_control:i32 (%struct.demuxer.2657*, i32, i8*)*] </div></div><div>...</div><div>How can I solve the problem?</div><div>Thanks in advance!</div></div>