[LLVMdev] LLVM BUG for x86 code generation ?
Sebastien DELDON-GNB
sebastien.deldon at st.com
Wed Nov 17 07:40:54 PST 2010
HI All,
when I compiled attached .ll file with llc 2.8 as follows:
llc -O0 -march=x86 llvmfails.ll -o llvmfails.s
gcc -m32 llvmfails.s -o llvmfails
./llvmfails
the executable exits with the expected message: "SUCCESS", whereas if I use -O1 instead of -O0 for LLC, it prints out FAILS.
llc -O0 -march=x86 llvmfails.ll -o llvmfails.s
gcc -m32 llvmfails.s -o llvmfails
./llvmfails
As far as I can tell code generation for select instruction is not correct, It seems that sign-extension propagation convert a sign-extension into a zero-extend.
Routine to look at is:
@result = internal global i32 0
define void @test() {
L.entry:
%__.I0000610 = alloca i32
call void @init()
%0 = load i32* @t
%1 = icmp eq i32 %0, 0
%2 = zext i1 %1 to i32
%3 = trunc i32 %2 to i1
%4 = load i8* @uc
%5 = zext i8 %4 to i32
%6 = load i8* @sc
%7 = sext i8 %6 to i32
%8 = select i1 %3, i32 %5, i32 %7
store i32 %8, i32* %__.I0000610
%9 = load i32* %__.I0000610
call void @seti(i32* @result, i32 %9)
ret void
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvmfails.ll
Type: application/octet-stream
Size: 1722 bytes
Desc: llvmfails.ll
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101117/b7c9d50c/attachment.obj>
More information about the llvm-dev
mailing list