<div dir="ltr">I think you need to get the arguments from the CallInst, not func. func is getting the arguments from the function defintion. If you want the arguments from the call site you want them from CallInst.<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 16, 2020 at 10:12 AM Abid Malik via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Hello,</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">I am using the following to capture the values of the arguments in a call function:</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"> for (auto &BB : F) {<br> for (auto &II : BB) {<br> if (CallInst *c = dyn_cast <CallInst> (&II)){<br> if ( Function *func = c->getCalledFunction()){<br> if ( func->getName() =="__kmpc_for_static_init_4" ||<br> func->getName() == "__kmpc_for_static_fini" )<br> {<br> errs() << func->getName();<br> errs() << "\n";<br> for(auto arg = func->arg_begin(); arg != func->arg_end(); ++arg) {<br> errs() << *arg << "\n";<br> if(auto* ci = dyn_cast<ConstantInt>(arg))<br> errs() << ci->getValue() << "\n";<br> }<br> }<br> }<br> }<br> }<br> }<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">I am looking for two specific calls for OMP in the *.ll file. For the following:</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">call void @__kmpc_for_static_init_4(%struct.ident_t* @0, i32 %17, i32 34, i32* %8, i32* %5, i32* %6, i32* %7, i32 1, i32 1)<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">I am able to see it and get the following:</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">__kmpc_for_static_init_4<br>%struct.ident_t* %0<br>i32 %1<br>i32 %2<br>i32* %3<br>i32* %4<br>i32* %5<br>i32* %6<br>i32 %7<br>i32 %8<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">The three arguments ( third ( schedule) and the last two; loop increment and chunk size are constant). The innermost loop should get them but it seems the test command fails on these three arguments. Also, the argument variable are different from the actual variable from the *.ll file.</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Any comments.</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Thanks,</div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Abid M. Malik<br>******************************************************<br><br> </div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>