<div dir="ltr">Sorry. You probably mean pointerType::getUnqual(<span style="font-size:12.8000001907349px">VectorType::</span><span style="font-size:12.8000001907349px">get(Type::getDoubleTy(LLVMContext), 2)</span>);</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 16, 2015 at 1:46 AM, mats petersson <span dir="ltr"><<a href="mailto:mats@planetcatfish.com" target="_blank">mats@planetcatfish.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The result of getelementptr is a pointer to double, you want a pointer<br>
to 2 x double, not a type of 2 x double *.<br>
<br>
So, you need to make a pointer to a 2 x double (writing from memory,<br>
so syntax may be off, but conceptually this should be right)<br>
vecPtrTy = Type::getUnqualPtr(VectorType:get(Type::getDoubleTy(), 2));<br>
<br>
--<br>
Mats<br>
<br>
On 16 April 2015 at 08:46, zhi chen <<a href="mailto:zchenhn@gmail.com">zchenhn@gmail.com</a>> wrote:<br>
> Does anyone know how to instrument double* to <2 x doulbe>*, e.g., 2.2 --><br>
> <2.2, 2.2>?<br>
> For example, I want to change the following IR code<br>
><br>
> %arrayidx1 = getelementptr inbounds [100 x double]* @main.B, i32 0, i32<br>
> %i.021<br>
> %1 = load double* %arrayidx1, align 4, !tbaa !0<br>
><br>
> to:<br>
><br>
> %arrayidx1 = getelementptr inbounds [100 x double]* @main.B, i32 0, i32<br>
> %i.021<br>
> %1 = bitcast double* %arrayidx1 to <2 x double>*<br>
> %2 = load <2 x double>* %1, align 4<br>
><br>
> what I right now doing is:<br>
> Assume pInst is %1 = load double* %arrayidx1, align 4, !tbaa !0<br>
><br>
> Value *loadValue = pInst->getOperand(0);<br>
> Type *vecTy = VectorType::get(Type::getDoublePtrTy(currF->getContext()), 2);<br>
> Value *emptyVec = UndefValue::get(vecTy);<br>
> Type* u32Ty = Type::getInt32Ty(currF->getContext());<br>
> Value *index0 =  ConstantInt::get(u32Ty, 0);<br>
> Value *index1 =  ConstantInt::get(u32Ty, 1);<br>
><br>
> Instruction *InsertVal = InsertElementInst::Create(emptyVec, loadValue,<br>
> index0, "");<br>
> InsertVal = InsertElementInst::Create(emptyVec, loadValue, index1, "");<br>
> InsertVal->insertBefore(pInst);<br>
><br>
> It turned out that the way I am doing is not right because the output is <2<br>
> x double*>. Any help will be appreciated!<br>
><br>
> BTW, can I use bitcastInst (if so, how?) or I have to use insertelementInst?<br>
><br>
> Thanks,<br>
> Zhi<br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="color:rgb(51,51,51)">PhD Student</span><br></div><div><font color="#333333">Department of Computer Science</font></div><div><font color="#333333">University of California, Irvine</font></div></div></div></div></div>
</div>