<div dir="ltr"><div><div>what about the memory address of e and f? can i get them?<br><br></div>Thank you and best,<br></div>Mo<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 10, 2017 at 5:02 PM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10 March 2017 at 15:49, Mohammad Norouzi <<a href="mailto:mnmomn@gmail.com">mnmomn@gmail.com</a>> wrote:<br>
> for (auto& A : cast<CallInst>(BI)->arg_<wbr>operands())<br>
> errs() << "--- " << A->getName() << "\n";<br>
<br>
</span>Ah, I see. You actually want "e" as a name. Unforuntately this isn't<br>
possible in general for a few reasons.<br>
<br>
First, release builds of LLVM drop most Value names for efficiency<br>
reasons. Without optimization your IR would just have numbers in the<br>
arg position: "call void @foo(i32 %3, i32 %4)". Even those numbers<br>
don't exist in memory, but are constructed as needed.<br>
<br>
Another confounding factor is that optimization will turn even that<br>
into a plain "call void @foo(i32 10, i32 22)" with no record of what<br>
the original arguments were.<br>
<br>
It gets even worse at the C level. If you saw "foo(a + b)", that<br>
argument doesn't really have a natural name. It's a temporary<br>
expression.<br>
<br>
So in general you shouldn't be relying on the name for any actual<br>
transformation you do.<br>
<br>
For debugging there are usually alternatives that might not be quite<br>
so convenient but do the job: Just dumping the argument is usually<br>
sufficient; with heroic effort you might be able to use any debug info<br>
that's present.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>