<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">The mail subject mentioned "address space", I don't know if Siddharth want to check getPointerAddressSpace equal or not.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Regards,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-16 5:12 GMT+08:00 Sanjoy Das via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Adding this assert SGTM, but it looks like something like this is already there?<br>
<br>
static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,<br>
ArrayRef<Value *> IdxList,<br>
const Twine &NameStr = "",<br>
Instruction *InsertBefore = nullptr) {<br>
unsigned Values = 1 + unsigned(IdxList.size());<br>
if (!PointeeType)<br>
PointeeType =<br>
cast<PointerType>(Ptr-><wbr>getType()->getScalarType())-><wbr>getElementType();<br>
else<br>
assert(<br>
PointeeType ==<br>
cast<PointerType>(Ptr-><wbr>getType()->getScalarType())-><wbr>getElementType());<br>
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,<br>
NameStr, InsertBefore);<br>
}<br>
<br>
Or did I misunderstand what you're suggesting?<br>
<br>
-- Sanjoy<br>
<div><div class="h5"><br>
On Fri, Oct 13, 2017 at 3:59 PM, Siddharth Bhat via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> The GEP constructor does not assert that the source and destination types<br>
> match. Of course, this is incorrect and causes random failures somewhere<br>
> down the line.<br>
><br>
> Could I add general sanity checks to the GEP constructor?<br>
><br>
> In general, is an Instruction allowed to be in an inconsistent state? If so,<br>
> is there some well known method to "verify" whether an instruction is<br>
> consistent or not?<br>
><br>
> Thanks,<br>
> ~Siddharth<br>
> --<br>
> Sending this from my phone, please excuse any typos!<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div>
</div>