[llvm-dev] [SDAG] Recovering pointer types
Nemanja Ivanovic via llvm-dev
llvm-dev at lists.llvm.org
Mon Dec 26 07:38:25 PST 2016
Thank you once again David and thanks for your patience.
I am certainly shifting gears to look at the front end in this case, but
here's a bit more clarification of the situation I'm facing.
The natural alignment for vectors on my target (PPC64) is 16. So if the
parameter is a pointer to a vector, the alignment on the parameter as well
as the load will be 16 and everything is fine. However, what I'd like to
have happen is that if the vector load is from a pointer to a scalar cast
to a pointer to a vector, that the alignment on the scalar pointer be
propagated to the vector load.
Namely,
vector char foo(vector int *a) {
return *(vector char *)a; // The alignment on the load should be 16
(same as that on the parameter)
}
whereas
vector char foo(int *a) {
return *(vector char *)a; // The alignment on the load should be weaker
(same as that on the parameter)
}
I will continue to look at what needs to be changed in the FE and will
consider posting the question on cfe-dev if I can't get anywhere.
On Mon, Dec 26, 2016 at 3:57 PM, David Chisnall <David.Chisnall at cl.cam.ac.uk
> wrote:
> On 26 Dec 2016, at 15:49, Nemanja Ivanovic <nemanja.i.ibm at gmail.com>
> wrote:
> >
> > David, thank you for the prompt response.
> > I originally implemented this with a check of getAlignment(). However,
> both getAlignment() and getOriginalAlignment() on the <4 x i32> load return
> the stronger alignment (16) rather than the alignment that the i32*
> parameter would have (4).
> >
> > So I am a bit stuck in terms of how to verify the original alignment.
>
> It sounds as if the problem here is actually in the front end. For your
> target, the alignment of <4 x i32> is 4, and so the load should have
> alignment 4. For some reason, it’s being promoted to 16. If this is
> clang, then it has probably decided that all 4-way vectors for your target
> must be naturally aligned. You can change that in the TargetInfo object (I
> can’t remember if it’s the Basic or CodeGen one that you want for this) for
> your target.
>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161226/4754b9b5/attachment.html>
More information about the llvm-dev
mailing list