Optimizing redundant load away
Hal Finkel
hfinkel at anl.gov
Tue Sep 2 10:33:29 PDT 2014
----- Original Message -----
> From: "Tilmann Scheller" <t.scheller at samsung.com>
> To: llvm-commits at cs.uiuc.edu
> Sent: Tuesday, September 2, 2014 12:22:04 PM
> Subject: Optimizing redundant load away
>
> 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?
I'd tend to think that GVN should get this.
-Hal
>
> 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list