Optimizing redundant load away
Tilmann Scheller
t.scheller at samsung.com
Tue Sep 2 10:22:04 PDT 2014
Hi,
quick question: I want to implement the transformation below and I'm wondering where in the middle-end this kind of transformation would fit in, any suggestions?
All instructions are in the same basic block:
%arrayidx = getelementptr inbounds [128 x float]* @heap, i32 0, i32 %ito
%a0 = load float* %arrayidx, align 4, !tbaa !3
%add = add i32 %ito, 1
%arrayidx1 = getelementptr inbounds [128 x float]* @heap, i32 0, i32 %add
%a1 = load float* %arrayidx1, align 4, !tbaa !3
; Use of %a0 and %a1 and no stores which would invalidate %a0 or %a1
...
; Do the following transformation (e.g. kill the redundant load):
%ito.addr.0 = select i1 %cmp, i32 %add, i32 %ito
%arrayidx2 = getelementptr inbounds [128 x float]* @heap, i32 0, i32 %ito.addr.0
%a2 = load float* %arrayidx2, align 4, !tbaa !3
-->
%a2 = select i1 %cmp, float %a1, float %a0
; Use of %a2
...
Thanks!
Regards,
Tilmann
More information about the llvm-commits
mailing list