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>
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
}
Can you confirm that ?
Best Regards
Seb
-------------- 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/20101118/613ab0bc/attachment.obj>
Hi Sebastian,> 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 > ./llvmfailsdoes the attached patch fix your problems? Ciao, Duncan. PS: In the future please open a bug report when reporting a bug. -------------- next part -------------- A non-text attachment was scrubbed... Name: llvmfails.diff Type: text/x-patch Size: 945 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101118/a2db3d96/attachment.bin>
Hi Duncan, I've patched LLVM 2.8 source tree, and it doesn't fix the problem on my side. Did you checked that your patch fixes the problem ? Best Regards Seb -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands Sent: Thursday, November 18, 2010 12:48 PM To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] LLVM BUG for x86 code generation ? Hi Sebastian,> 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 ./llvmfailsdoes the attached patch fix your problems? Ciao, Duncan. PS: In the future please open a bug report when reporting a bug.