[LLVMdev] Missed optimization opportunity
Wesley Peck
peckw at wesleypeck.com
Wed Dec 29 08:25:23 PST 2010
On Dec 28, 2010, at 12:48 PM, Chris Lattner wrote:
> On Dec 28, 2010, at 9:39 AM, Lup Gratian wrote:
>> 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 = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
target triple = "i386-apple-darwin10.0.0"
define i32 @g(i32 %a) nounwind readnone ssp {
entry:
ret i32 15
}
--
Wesley Peck
University of Kansas
SLDG Laboratory
More information about the llvm-dev
mailing list