<div dir="ltr">Yes, I can write up some next steps that should be parallelizable.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 10, 2021 at 10:25 AM Madhur Amilkanthwar <<a href="mailto:madhur13490@gmail.com">madhur13490@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Speaking of which, I think it would be useful if we can document the progress of migration to opaque pointers somewhere. Going one step ahead, if we have identified fine level items to do (than high level items on opaque poonters page), it would be easy for people to pick up. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 10, 2021, 10:48 PM David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Re: Opaque pointers - yeah, sorry I've left that lingering for years. <a class="gmail_plusreply" id="gmail-m_-1758889135074533439m_1705235278915166844plusReplyChip-1" href="mailto:aeubanks@google.com" rel="noreferrer" target="_blank">+Arthur Eubanks</a> has picked that up recently (& credit to a few others too - <a class="gmail_plusreply" id="gmail-m_-1758889135074533439m_1705235278915166844plusReplyChip-2" href="mailto:jyknight@google.com" rel="noreferrer" target="_blank">+James Y Knight</a>, <a class="gmail_plusreply" id="gmail-m_-1758889135074533439m_1705235278915166844plusReplyChip-5" href="mailto:t.p.northover@gmail.com" rel="noreferrer" target="_blank">+Tim Northover</a>, <a class="gmail_plusreply" id="gmail-m_-1758889135074533439m_1705235278915166844plusReplyChip-6" href="mailto:arsenm2@gmail.com" rel="noreferrer" target="_blank">+Matt Arsenault</a> etc along the way) & seems to be making good progress.<br><br>(& agreed - it's crossed my mind that gep starts to look "strange" once pointers are typeless - but I wouldn't want to get ahead of ourselves and start removing gep in favor of more raw pointer arithmetic while we still haven't fully transitioned to opaque pointers)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 9, 2021 at 9:19 AM Chris Lattner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Nikita Popov wrote a great block post last week: “<a href="https://www.npopov.com/2021/06/02/Design-issues-in-LLVM-IR.html" rel="noreferrer" target="_blank">Design issues in LLVM IR</a>” that I just found.  It is well framed and nicely written, it seems like a good idea to discuss this on llvm-dev.  :-)<div><br></div><div>Here are my 2c for what it is worth:<div><br></div><div>a) I completely agree we should continue to invest in fixing the core of LLVM.  There are long standing issues that we should fix, and not doing so slows things down, leads to worse quality of results, etc.</div></div><div><br></div><div>b) I completely agree with his framing on canonicalization and its value.  I think that LLVM has historically taken this a bit too far (e.g. loop transformations, the old IndVar/LSR dichotomy among others) but many of those have already been walked back.</div><div><br></div><div>c) I completely agree we need to continue to march towards opaque pointers, I’m a fan of this work.</div><div><br></div><div>d) I’m less enthused about eliminating type based GEP.  The post is right that indexing computations are expensive, but that is largely due to the algorithms used, not the IR structure.  If this was the thing to fix, then we should fix other aspects of the design.  The thing that I’m particularly concerned about is array indexes: I think we need to preserve the ability to do simple dependence analysis and other array subscript indexing analyses in the middle end.  I think the sweet spot is to drop types from pointers, but keep them on GEPs.  Alternatively, finish the typeless pointer migration and then evaluate what to do with GEPs only when that completes.</div><div><br></div><div>e) Constant Expressions are a disaster.  In addition to the problem identified, there are also many annoying cases to deal with, eg. When constexprs exist in phi nodes, trapping constexprs, etc.  In my opinion, the fix is to eliminate them entirely, in a few steps:</div><div><br></div><div>    1) Introduce a new “RelocatableConstant” object which is *not* a mirror of all the IR operations in LLVM, but is instead designed to be used in global variables and allows the standard “globalpointer+offset” pattern that object files support, and we should add a new MachoRelocatableConstant class to represent the “(gv1-gv2+offset)” relocations macho supports.  The presence of this would make codegen and frontends easier to write, and get rid of all the fiddly pattern matching stuff.  I think we need to talk about whether “offset” is a byte offset, or whether it is a series of (constant integer) field indexes in a GEP like operation.  I would argue for the later to make inter procedural optimizations easier to write, but it is debatable.</div><div><br></div><div>    2) Move the general constant folding API off of ConstantExpr to somewhere else, it never should have been there for reasons pointed out in the blog.</div><div><br></div><div>    3) Eliminate ConstExpr: after #1, we don’t need a mirror of the LLVM IR in constant nodes.  Constant folding should be a failable operation and would return the primitive nodes like ConstantInt.  The asmparser / byte code parser could auto upgrade general unfolded constexprs to instructions when in a function and to [Macho]RelocatableConstant</div><div><br></div><div>In any case, I’d love to see progress on any of these.  I’d personally love to see the typeless pointers land because we’re in an unfortunate in-between state, and we should close off partial transitions.</div><div><br></div><div>-Chris</div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">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>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">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>
</blockquote></div>