[LLVMbugs] [Bug 1126] NEW: CBE miscompiles or crashes compiling programs with vectors

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jan 20 09:14:37 PST 2007


http://llvm.org/bugs/show_bug.cgi?id=1126

           Summary: CBE miscompiles or crashes compiling programs with
                    vectors
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: C
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: gordonhenriksen at mac.com


Noticed through inspection.

% cat cbev.ll
define <4 x i32> %foo(<4 x i32> %a, <4 x i32> %b) {
  %c = sub <4 x i32> %a, %b
  %d = add <4 x i32> %b, %c
  %e = mul <4 x i32> %c, %d
;  %f = udiv <4 x i32> %d, %e   ; Fails an assertion in CBackend.cpp
;  %g = sdiv <4 x i32> %e, %f   ; Same
  ret <4 x i32> %e
}
% llvm-as -o cbev.bc cbev.ll
% llc -march=c -o cbev.c cbev.bc
% tail -n 7 cbev.c
unsigned int foo(unsigned int ltmp_0_1[4], unsigned int ltmp_1_1[4])[4] {
  unsigned int ltmp_2_1[4];

  ltmp_2_1 = ltmp_0_1 - ltmp_1_1;
  return (ltmp_2_1*(ltmp_1_1 + ltmp_2_1));
}

% gcc -o cbev.o -c cbev.c
cbev.c:106: error: ‘foo’ declared as function returning an array
cbev.c:107: warning: conflicting types for built-in function ‘malloc’
cbev.c:129: error: ‘foo’ declared as function returning an array
cbev.c: In function ‘foo’:
cbev.c:132: error: incompatible types in assignment
cbev.c:133: error: invalid operands to binary +

An error message, inserting a vector lowering pass before the CBE, or fixing the codegen would all be 
improvements.

Emitting Altivec 'vector' types instead of arrays would make fixing the codegen relatively easy when 
targetting PowerPC, since Altivec provides operator overloads for vector ops.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list