<div dir="ltr">Hi <div><br><div>I use BlockAddress to get the address of BasicBlock , </div><div><br></div><div>and I use GlobalVariable 's getInitializer() </div><div><br></div><div>to pass the address of BasicBlock to the global variable of my own program</div><div><br></div><div>and then I print it out.</div><div><br></div><div>But , I found that  BlockAddress is not always correct.</div><div><br></div><div>For example, some function's rsp (stack pointer) or other register is maintained by caller,</div><div><br></div><div>so  it would be like: </div><div><a href="https://i.imgur.com/Rwuy5ju.png">https://i.imgur.com/Rwuy5ju.png</a></div><div>  0x42c37a:      e8 c1 7a 00 00     call   433e40 <retrieve_url><br>  0x42c37f: 48 83 c4 20                add    rsp,0x20<br>  0x42c383: eb 00                    jmp    42c385 <main+0x16b5><br></div><div><br></div><div>What I want is the basic block which is "excatly" after the function call , 



0x42c37f



</div><div><br></div><div>I want BlockAddress give me 



0x42c37f.</div><div><br></div><div>But actually, the output my program print  out is  

0x42c383.</div><div><br></div><div>I guess "add    rsp,0x20" is seen as within the basic block  of the function call.</div><div><br></div><div>Maybe reset the rsp (stack pointer) is part of the function call.</div><div><br></div><div>Can I say there is bug in BlockAddress ?</div><div><br></div><div>Or there is some bug in LLVM's backend?</div><div><br></div><div>How to solve this problem?</div><div><br></div><div>Force clang/llvm not to use caller-saved convention or something like that ?</div><div><br></div><div>Thanks</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div>