<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Sounds like you break a single getelementptr into a few smaller ones, then do CSE-like optimization?</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-14 21:11 GMT+08:00 Krzysztof Parzyszek 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"><span class="">On 6/14/2017 7:44 AM, 陳韋任 via llvm-dev wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   Skim through Hexagon backend, I notice there is HexagonCommonGEP.cpp which seems<br>
try to do something on `getelementptr` LLVM instruction. But what exactly it want to do?<br>
Anyone knows?<br>
</blockquote>
<br></span>
Each getelementptr is a chain that starts with a pointer, followed by an index, which together produce a new pointer. That new pointer coupled with the next index on the operand list produced yet another pointer, and so on. Each GEP can actually be broken up into shorter GEPs, where the next one starts at the address generated by the previous one. It is fairly common to have GEP instructions that in their entirety generate different pointers, but where the initial few pointers are identical. The core task of HexagonCommonGEP is to isolate the initial identical addresses into their own GEP instructions. It then does several other things, like finding the best placement of the commoned GEPs (with respect to loop invariance), etc.<span class="HOEnZb"><font color="#888888"><br>
<br>
-Krzysztof<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">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>
</font></span></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>