[llvm-dev] 回复: How to create vector pointer type?

Celine via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 22 05:47:19 PDT 2019

Thank you very much for this detail information~

------------------ 原始邮件 ------------------
发件人: "Tim Northover"<t.p.northover at gmail.com>;
发送时间: 2019年10月22日(星期二) 凌晨0:17
收件人: "Celine"<595602881 at qq.com>;
抄送: "llvm-dev"<llvm-dev at lists.llvm.org>;
主题: Re: [llvm-dev] How to create vector pointer type?

Hi Celine,

On Mon, 21 Oct 2019 at 05:24, Celine via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Then meet the following error:
> Assertion failed: ResultElementType == cast<PointerType>(getType()->getScalarType())->getElementType(), file D:\cygwin64\home\celine\clang-102\llvm\include\llvm/IR/Instructions.h, line 958

Both of your functions look sensible to me, but this assertion is from
within GetElementPtrInst, so it's happening after you've done
something with these types. You probably replaced a Value with a
different one with this new type (or mutated it in place). That leaves
the IR in an inconsistent state E.g. one operand of an add could be
i16 and the other i32, or in this case a GEP thinks it's operating on
an i16* to produce another i16*, but it's actually operating on a <16
x i16>*, which would produce another <16 x i16>*.

If you're trying to change the type of a Value you generally have to
recreate its whole chain of users until you can reunify the types. If
this is vectorizing a loop, for example, the whole loop data-path
would probably need to be recreated with the new vector type, and
surrounded by pointer bitcasts ot <16 x i16>* at the beginning (and
back to i16* at the end if anyone cares about the final pointer).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191022/5f6dc5ff/attachment.html>

More information about the llvm-dev mailing list