[llvm-dev] [SDAG] Recovering pointer types
Nemanja Ivanovic via llvm-dev
llvm-dev at lists.llvm.org
Mon Dec 26 05:58:54 PST 2016
I am wondering if there is a good/easy way to recover the original type of
a pointer parameter in the SDAG. Here's the problem that I am dealing with:
define <4 x i32> @test(i32* nocapture readonly %a) local_unnamed_addr #0 {
entry:
%0 = bitcast i32* %a to <4 x i32>*
%1 = load <4 x i32>, <4 x i32>* %0, align 16, !tbaa !2
ret <4 x i32> %1
}
The problem is that the alignment requirements on my target for a load of
an i32* are different from those on a <4 x i32>*. I don't see a way to
specify that with the DataLayout and when the SelectionDAG is built, the
bitcast goes away because both the source and destination types are the
same (i64 according to the DataLayout).
So I end up with this as the initial SDAG:
Initial selection DAG: BB#0 'test:entry'
SelectionDAG has 9 nodes:
t0: ch = EntryToken
t3: i64 = Constant<0>
t2: i64,ch = CopyFromReg t0, Register:i64 %vreg0
t5: v4i32,ch = load<LD16[%0](tbaa=<0x10038f18a98>)> t0, t2, undef:i64
t7: ch,glue = CopyToReg t0, Register:v4i32 %V2, t5
t8: ch = PPCISD::RET_FLAG t7, Register:v4i32 %V2, t7:1
What I would like to do is emit efficient code for cases where the
parameter pointer has the same alignment requirements as the load and emit
the conservative but less efficient code in other cases.
Nemanja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161226/8e4ddc17/attachment.html>
More information about the llvm-dev
mailing list