[LLVMbugs] [Bug 10747] miscompiled extractelement instruction

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 26 10:18:19 PST 2011


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

Zoltan Varga <vargaz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #5 from Zoltan Varga <vargaz at gmail.com> 2011-12-26 12:18:19 CST ---
This is not entirely fixed, here is another testcase, which also fails since
r131183:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; ModuleID = 'temp.opt.bc'

define i32 @main() {
BB0:
  %r0 = alloca <4 x i32>, align 16
  %r1 = getelementptr <4 x i32>* %r0, i32 0, i32 3
  store i32 4, i32* %r1
  %r2 = getelementptr <4 x i32>* %r0, i32 0, i32 2
  store i32 3, i32* %r2
  %r3 = getelementptr <4 x i32>* %r0, i32 0, i32 1
  store i32 2, i32* %r3
  %r4 = getelementptr inbounds <4 x i32>* %r0, i32 0, i32 0
  store i32 1, i32* %r4
  %r7 = load <4 x i32>* %r0, align 1
  store i32 8, i32* %r1
  store i32 7, i32* %r2
  store i32 6, i32* %r3
  store i32 5, i32* %r4
  %r8 = load <4 x i32>* %r0, align 1
  %r9 = extractelement <4 x i32> %r7, i32 2
  %r10 = icmp eq i32 %r9, 3
  br i1 %r10, label %BB4, label %BB1

BB4:                                              ; preds = %BB0
  %r11 = extractelement <4 x i32> %r8, i32 2
  %r12 = icmp eq i32 %r11, 7
  br i1 %r12, label %BB6, label %BB1

BB6:                                              ; preds = %BB4
  %r13 = extractelement <4 x i32> %r7, i32 3
  %r14 = icmp eq i32 %r13, 4
  br i1 %r14, label %BB8, label %BB1

BB8:                                              ; preds = %BB6
  br label %BB1

BB1:                                              ; preds = %BB8, %BB6, %BB4,
%BB0
  %r17 = phi i32 [ 1, %BB0 ], [ 2, %BB4 ], [ 3, %BB6 ], [ 0, %BB8 ]
  ret i32 %r17
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

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

This should exit with exit code 0, but it exits with code 3.

It looks like this load:
  %r7 = load <4 x i32>* %r0, align 1
gets moved pasts the stores which alias it.

-- 
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