[llvm-dev] What is HexagonCommonGEP.cpp for?

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 14 06:11:15 PDT 2017


On 6/14/2017 7:44 AM, 陳韋任 via llvm-dev wrote:
> 
>    Skim through Hexagon backend, I notice there is HexagonCommonGEP.cpp 
> which seems
> try to do something on `getelementptr` LLVM instruction. But what 
> exactly it want to do?
> Anyone knows?

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.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list