I just have two questions regarding the following small piece of code:
if (var > start*end) {
arr[var] = arr[var-1];
}
else {
arr[var] = arr[var+1];
}
1. Why does llvm put the address computation in the branched blocks instead
of the common dominator?
2. Why does the AliasAnalysis return MayAlias instead of MustAlias?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120529/8ac8bddb/attachment.html>
The answer to both your questions probably depends on the optimizations and other compiler flags you used. For example, the default version of alias analysis is -no-aa which doesn't do anything but return 'may alias'. Regards, Roel On 29/05/12 20:55, Ryan Taylor wrote:> I just have two questions regarding the following small piece of code: > > if (var > start*end) { > arr[var] = arr[var-1]; > } > else { > arr[var] = arr[var+1]; > } > > 1. Why does llvm put the address computation in the branched blocks > instead of the common dominator? > 2. Why does the AliasAnalysis return MayAlias instead of MustAlias? > > Thanks.
Oh, I am talking about the stores (not the loads, obviously), fyi. Also,
I'm curious why this simple code change:
int temp=0;
if (var > start*end) {
//arr[var] = arr[var-1];
temp = arr[var-1];
}
else {
temp = arr[var+1];
//arr[var] = arr[var+1];
}
arr[var] = temp;
Produces such different results?
On Tue, May 29, 2012 at 11:55 AM, Ryan Taylor <ryta1203 at gmail.com>
wrote:
> I just have two questions regarding the following small piece of code:
>
> if (var > start*end) {
> arr[var] = arr[var-1];
> }
> else {
> arr[var] = arr[var+1];
> }
>
> 1. Why does llvm put the address computation in the branched blocks
> instead of the common dominator?
> 2. Why does the AliasAnalysis return MayAlias instead of MustAlias?
>
> Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120530/e15fbd4c/attachment.html>
Maybe this is a better question: What is the most exhaustive AA algo that I can currently use with LLVM 3.1? On Tue, May 29, 2012 at 11:55 AM, Ryan Taylor <ryta1203 at gmail.com> wrote:> I just have two questions regarding the following small piece of code: > > if (var > start*end) { > arr[var] = arr[var-1]; > } > else { > arr[var] = arr[var+1]; > } > > 1. Why does llvm put the address computation in the branched blocks > instead of the common dominator? > 2. Why does the AliasAnalysis return MayAlias instead of MustAlias? > > Thanks. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120530/45125ebe/attachment.html>
I try to answer your question ,first: Address compution located in branch block is Good, that. Will reduce register pressure; may be you can consider lazy code motion optimization as example. Second, Ryan Taylor-5 wrote> I just have two questions regarding the following small piece of code: > > if (var > start*end) { > arr[var] = arr[var-1]; > } > else { > arr[var] = arr[var+1]; > } > > 1. Why does llvm put the address computation in the branched blocks > instead > of the common dominator? > 2. Why does the AliasAnalysis return MayAlias instead of MustAlias? > > Thanks. > > _______________________________________________ > LLVM Developers mailing list> LLVMdev at .uiuc> http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- View this message in context: http://llvm.1065342.n5.nabble.com/Aliasing-Question-tp37015p63318.html Sent from the LLVM - Dev mailing list archive at Nabble.com.