[llvm-dev] Particular type of loop optimization
Gleison Souza via llvm-dev
llvm-dev at lists.llvm.org
Tue Feb 2 11:11:45 PST 2016
Hi all,
Firstly, thanks.
> What are you actually trying to achieve?
Please, take a look in the basic block below:
for.body: ; preds = %for.cond
%idxprom = sext i32 %i.0 to i64, !dbg !32
%0 = load i32*, i32** @vectorE, align 8, !dbg !32
%arrayidx = getelementptr inbounds i32, i32* %0, i64 %idxprom, !dbg !32
store i32 %i.0, i32* %arrayidx, align 4, !dbg !33
br label %for.inc, !dbg !32
I need to try remove this load of the loop. If I do this, all loads
of this code can’t generate alias.
running the second code, all loads haven’t alias, like you can see below:
for.body: ; preds = %for.cond
%idxprom = sext i32 %i.0 to i64, !dbg !35
%arrayidx = getelementptr inbounds i32, i32* %0, i64 %idxprom, !dbg !35
store i32 %i.0, i32* %arrayidx, align 4, !dbg !36
br label %for.inc, !dbg !35
I need to reduce the number of alias in the code.
I’ve tried to use this flags:
-mem2reg
-basicaa
-globalsmodref-aa
-tbaa
-scev-aa
-adce
-licm
-argpromotion
-gvn
-memcpyopt
-dse
-print-alias-sets
-count-aa
-aa-eval
Regards,
Gleison
2016-02-02 17:10 GMT-02:00 Gleison Souza <gleison14051994 at gmail.com>:
> Hi all,
>
> Firstly, thanks.
>
> > What are you actually trying to achieve?
>
> Please, take a look in the basic block below:
>
> for.body: ; preds = %for.cond
>
> %idxprom = sext i32 %i.0 to i64, !dbg !32
>
> %0 = load i32*, i32** @vectorE, align 8, !dbg !32
>
> %arrayidx = getelementptr inbounds i32, i32* %0, i64 %idxprom, !dbg !32
>
> store i32 %i.0, i32* %arrayidx, align 4, !dbg !33
>
> br label %for.inc, !dbg !32
>
> I need to try remove this load of the loop. If I do this, all loads
> of this code can’t generate alias.
> running the second code, all loads haven’t alias, like you can see below:
>
> for.body: ; preds = %for.cond
>
>
> %idxprom = sext i32 %i.0 to i64, !dbg !35
>
> %arrayidx = getelementptr inbounds i32, i32* %0, i64 %idxprom, !dbg !35
>
> store i32 %i.0, i32* %arrayidx, align 4, !dbg !36
>
> br label %for.inc, !dbg !35
>
> I need to reduce the number of alias in the code.
>
> I’ve tried to use this flags:
>
> -mem2reg
> -basicaa
> -globalsmodref-aa
> -tbaa
> -scev-aa
> -adce
> -licm
> -argpromotion
> -gvn
> -memcpyopt
> -dse
> -print-alias-sets
> -count-aa
> -aa-eval
>
> Regards,
>
> Gleison
>
> 2016-02-02 15:59 GMT-02:00 Caldarale, Charles R <
> Chuck.Caldarale at unisys.com>:
>
>> > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org]
>> > On Behalf Of mats petersson via llvm-dev
>> > Subject: Re: [llvm-dev] Particular type of loop optimization
>>
>> > I would have thought that [once it gets optimised enough], the compiler
>> does that, or
>> > something similar anyway [in particular `*aux++ = i;` would be what I'd
>> expect to see].
>>
>> Such an optimization cannot be made unless the compiler knows that the
>> area spanned by the accesses through vectorE does not include the location
>> of vectorE itself. Some TBAA information added to the IR-level loads and
>> stores should allow that.
>>
>> - Chuck
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160202/dc9ff887/attachment.html>
More information about the llvm-dev
mailing list