<div dir="auto">Good to know, thanks for the info.<div dir="auto"><br></div><div dir="auto">- Stefanos</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 14, 2020, 00:35 Nuno Lopes via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_-3801887814384722092WordSection1"><p class="MsoNormal">You are right that it<span style="font-family:"Times New Roman",serif">’</span>s mostly a convenience for the front-ends. So they don<span style="font-family:"Times New Roman",serif">’</span>t have to deal with boring things like padding and sizing things.<u></u><u></u></p><p class="MsoNormal">Otherwise it adds no semantic value. Object aliasing is not field sensitive in LLVM, so it doesn<span style="font-family:"Times New Roman",serif">’</span>t matter. Though someone may want to add support for that in the future for languages where it<span style="font-family:"Times New Roman",serif">’</span>s ok to do so.<u></u><u></u></p><p class="MsoNormal">FWIW, Alive2<span style="font-family:"Times New Roman",serif">’</span>s GEP instruction works over bytes only (pairs of constant * %reg). Though I<span style="font-family:"Times New Roman",serif">’</span>m not sure I would advocate to change LLVM<span style="font-family:"Times New Roman",serif">’</span>s representation.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Nuno<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><b>From:</b> Nikita Popov<br><b>Sent:</b> 13 July 2020 21:08<br><b>To:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>><br><b>Subject:</b> [llvm-dev] Why are GEPs type based?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">Hi,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I've been wondering why LLVMs GEP instructions are based on types, rather than encoding the raw address calculation as a base pointer plus some scaled offsets (still in the form of a GEP, to retain provenance).<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The type information does not seem particularly useful (shouldn't be used as an optimization base, because struct layouts lie), but increases the non-canonical IR space (there are many ways to encode the same GEP) and increases compile-time (optimizations need to constantly decompose GEPs, e.g. to get constant offsets).<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">What am I missing here?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Nikita,<u></u><u></u></p></div><div><p class="MsoNormal">Regards<u></u><u></u></p></div></div></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>