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

           Summary: miscompiled extractelement instruction
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

define i32 @main() {
BB0:
  %0 = alloca <2 x i64>, align 16
  %1 = getelementptr <2 x i64>* %0, i32 0, i32 1
  store i64 6, i64* %1
  %2 = getelementptr inbounds <2 x i64>* %0, i32 0, i32 0
  store i64 1, i64* %2
  %3 = ptrtoint <2 x i64>* %0 to i64
  %4 = inttoptr i64 %3 to <2 x i64>*
  %5 = load <2 x i64>* %4, align 1
  store i64 4, i64* %1
  store i64 3, i64* %2
  %6 = extractelement <2 x i64> %5, i32 1
  %7 = trunc i64 %6 to i32
  ret i32 %7
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Compile using:
llvm-as -o temp.bc bug.ll && llc -march=x86-64 -o temp.s temp.bc && gcc temp.s
&& ./a.out

This should exit with exit code 6, but it exits with code 4.

This is with LLVM HEAD on x86-64.

This seems to be caused by revision 131183, i.e.:

Author: Nadav Rotem <[email protected]>
Date:   Wed May 11 14:40:50 2011 +0000

    Fixes a bug in the DAGCombiner.  LoadSDNodes have two values (data, chain).
    If there is a store after the load node, then there is a chain, which means
    that there is another user. Thus, asking hasOneUser would fail. Instead we
    ask hasNUsesOfValue on the 'data' value.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to