Displaying 3 results from an estimated 3 matches for "r122603".
Did you mean:
r122607
2010 Dec 28
0
[LLVMdev] Missed optimization opportunity
...}
>
> I find it strange that it hasn't found that %add and %mul have the same value, %cmp would be then false, selecting and returning 15. If 'a' is replaced by a constant it works.
You're right, that is a missed optimization. I added it to the missed optimization notes in r122603. Did this come from a larger example, or was this just a test?
> I'm also curios which pass detects that c[10] and c[11] are 'a' in 'b = c[10] + c[11]' (it isn't instcombine, at -O1 getelementptr/load are still there).
There are several capable of picking this up, but...
2010 Dec 29
1
[LLVMdev] Missed optimization opportunity
...gt; I find it strange that it hasn't found that %add and %mul have the same value, %cmp would be then false, selecting and returning 15. If 'a' is replaced by a constant it works.
>
> You're right, that is a missed optimization. I added it to the missed optimization notes in r122603. Did this come from a larger example, or was this just a test?
Just as a note, if you run this example through the opt tool as well then the output is the expected "ret i32 15".
> clang -O3 -S -emit-llvm -o - example.c |opt -std-compile-opts -o - |llvm-dis
target datalayout = &q...
2010 Dec 28
2
[LLVMdev] Missed optimization opportunity
I recently downloaded LLVM 2.8 and started playing with the optimizations a
bit.
I saw something curious while trying the following function:
int g(unsigned int a) {
unsigned int c[100];
c[10] = a;
c[11] = a;
unsigned int b = c[10] + c[11];
if(b > a*2) a = 4;
else a = 8;
return a + 7;
}
The generated code, with -O3 activated, is
define i32 @g(i32 a) nounwind readnone {
%add = shl i32