<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 30, 2015 at 2:37 AM, guoqing zhang <span dir="ltr"><<a href="mailto:gqzhang81@gmail.com" target="_blank">gqzhang81@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8000001907349px">Hi,</span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">In PromoteMemoryToRegister.cpp, it seems to rely on the fact that the only users of bitcast/GEP instruction are lifetime intrinsics (llvm.lifetime.start/end). I did some searching in llvm/test folder, it seems to be true.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">However, by reading LLVM IR manual, I don't see any restriction stated on the possible user of bitcast/GEP instruction. So my question is who impose the restriction ? Is it Clang ?</div></div></blockquote><div><br></div><div>Use of GEPs and bitcasts is certainly not restricted to lifetime intrinsics. For example, they're used by loads and stores all the time.</div><div><br></div><div>PromoteMemoryToRegister.cpp tries to figure out whether allocas can be safely promoted to registers, and I assume the reasoning is that if an instruction is GEP'ing into stack-allocated memory for non-trivial purposes, it can't be promoted.</div><div><br></div><div> - Hans</div></div></div></div>