[LLVMbugs] [Bug 3434] New: Wrong x86 code generated
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Jan 28 13:35:28 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=3434
Summary: Wrong x86 code generated
Product: new-bugs
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: lennart at augustsson.net
CC: llvmbugs at cs.uiuc.edu
This is LLVM 2.6svn, rev 63214, generating code for x86.
The code below together with the test program should print 8.
It does print if 8 if optimized (with opt -std-compile-opts),
but with the code straight from the source it prints 1.
Looking at the generated assembly code it looks like the second loop, the one
with the compare instructions, has an empty body.
Maybe there's something wrong with my code, but since it works with
optimization I don't think so.
C code:
-------
#include <stdio.h>
int _fun1(int);
main()
{
printf("%d\n", _fun1(3));
}
LLVM code:
----------
define i32 @_fun1(i32) {
_L1:
br label %_L2
_L2:
%1 = phi i32 [ 0, %_L1 ], [ %6, %_L3 ]
%2 = phi <4 x i32> [ undef, %_L1 ], [ %5, %_L3 ]
%3 = icmp ne i32 %1, 4
br i1 %3, label %_L3, label %_L4
_L3:
%4 = extractelement <4 x i32> < i32 0, i32 1, i32 2, i32 3 >, i32 %1
%5 = insertelement <4 x i32> %2, i32 %0, i32 %1
%6 = add i32 %1, 1
br label %_L2
_L4:
br label %_L5
_L5:
%7 = phi i32 [ 0, %_L4 ], [ %14, %_L6 ]
%8 = phi <4 x i1> [ undef, %_L4 ], [ %13, %_L6 ]
%9 = icmp ne i32 %7, 4
br i1 %9, label %_L6, label %_L7
_L6:
%10 = extractelement <4 x i32> < i32 0, i32 1, i32 2, i32 3 >, i32 %7
%11 = extractelement <4 x i32> %2, i32 %7
%12 = icmp eq i32 %10, %11
%13 = insertelement <4 x i1> %8, i1 %12, i32 %7
%14 = add i32 %7, 1
br label %_L5
_L7:
%15 = bitcast <4 x i1> %8 to i4
%16 = zext i4 %15 to i32
ret i32 %16
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list