<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Is there a recommended way to retrieve the original type from an AllocaInst object?<div><br></div><div>For example, I am creating alloca instructions using the IRBuilder interface like:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span style="color: #4f8187">alloca = builder</span>.<span style="color: #411b7f">CreateAlloca</span>( <span style="color: #733ba7">Type</span>::<span style="color: #411b7f">getDoubleTy</span>( <span style="color: #4f8187">context</span> ), <span style="color: #3527d4">0</span>, variableName.<span style="color: #411b7f">c_str</span>() );</div></div><div><br></div><div>and I place the alloca into a symbol table.</div><div><br></div><div>Later when I am generating instructions for an assignment operation, I want to check the type of the variable allocated with the CreateAlloca instruction so I can see if I need to do type conversion before the store instruction, However, I cannot simply use:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(65, 27, 127); ">alloca<span style="color: #000000">-></span>getType<span style="color: #000000">()-></span>isDoubleTy<span style="color: #000000">() etc.</span></div></div><div><br></div><div>because this doesn't return true in the above case. The ID of the Ty member of the VTy member of the alloca is PointerTyID instead of DoubleTyID as the construction for <span class="Apple-style-span" style="color: rgb(79, 129, 135); font-family: Menlo; font-size: 11px; ">AllocaInst<span style="color: #000000">::</span>AllocaInst<span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; "> seems to create a PointerType pointing to the original type.</span></span></div><div><br></div><div>I was hoping for a member function of the alloca that would return the original type that was passed to CreateAlloca. I can test for a PointerTyID and then perform a cast to PointerType and then call the getElementType() function on the PointerType but that seems a bit messy. </div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Curtis</div></body></html>