[LLVMdev] Optimizer to remove duplicate loads?

Duncan Sands baldrick at free.fr
Sun Feb 24 00:02:38 PST 2013


Hi,

On 24/02/13 06:48, edA-qa mort-ora-y wrote:
> Which optimizer would remove duplicate, or unneeded loads?  In my
> generator I end up having a lot of the same load. For example here I
> keep loading "@pt" which will always be the same value.

in order to do this, the optimizers need to know that the call to
@trace_integer does not modify the contents of @pt.  Is it logically
possible for them to deduce this?  If not, no optimizer can do what
you want.

Ciao, Duncan.

>
>    %16 = load %1** @pt, align 8
>    %17 = getelementptr inbounds %1* %16, i64 0, i32 2, i32 0
>    %18 = load i32* %17, align 4
>    call void @trace_integer(i32 %18)
>    %19 = load %1** @pt, align 8
>    %20 = getelementptr inbounds %1* %19, i64 0, i32 2, i32 1
>    %21 = load i32* %20, align 4
>    call void @trace_integer(i32 %21)
>    %22 = load %1** @pt, align 8
>    %23 = getelementptr inbounds %1* %22, i64 0, i32 0
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list