<div dir="ltr"><div dir="ltr"><div>Hello LLVM Devs.</div><div><br></div><div>In my compiler I attach some arbitrary data to functions by creating BBs with inline assembly. However, these blocks are "unused" from LLVM point of view and get erased from the function.</div><div><br></div><div>To counter that I started adding checks for conditions that are guaranteed to be true or false. I ended up with calling @llvm.returnaddress(i32 0) intrinsic and comparing the result with 0. It worked well until in one function I had two such calls and SROA replaced one of checks with constant 1 and erased the BB.</div><div><br></div><div>I should probably stop trying to fool LLVM and "do it right", but don't have any idea how. Note that I can't use global variables for a reason, so the data has to be encoded in a BB using inline assembly. All I need is just prevent optimizations from erasing it.</div><div><br></div><div>Thanks in advance.<br></div></div></div>