[LLVMbugs] [Bug 18862] wrong code at -O1 and above on x86_64-linux-gnu in 32-bit mode (for code with the "pack" pragma and bitfields)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 09:06:43 PDT 2014


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

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |michael.v.zolotukhin at gmail.
                   |                            |com,
                   |                            |spatel+llvm at rotateright.com
         Resolution|---                         |FIXED

--- Comment #1 from Sanjay Patel <spatel+llvm at rotateright.com> ---
This was a bug with hoisting a shift constant value. 

Solved with:
http://llvm.org/viewvc/llvm-project?view=revision&revision=207692

Reduced test case:

$ cat 18862.ll
target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
target triple = "i386-apple-macosx10.9.0"

@b = global { i32, i32, i32, i32, i8, [2 x i8] } { i32 0, i32 0, i32 0, i32 0,
i8 7, [2 x i8] undef }, align 8

define i32 @main() {
  %ashr = ashr i152 0, 128
  br label %for.body

for.body:
  %load1 = load i152* bitcast ({ i32, i32, i32, i32, i8, [2 x i8] }* @b to
i152*), align 8
  %shl2 = shl i152 %load1, 21
  %ashr3 = ashr i152 %shl2, 128
  %cast4 = trunc i152 %ashr3 to i32
  ret i32 %cast4
}

$ ./llc -O0 18862.ll -o - | clang -Wl,-no_pie -m32 -x assembler - ; ./a.out ;
echo $?
0

$ ./llc -O2 18862.ll -o - | clang -Wl,-no_pie -m32 -x assembler - ; ./a.out ;
echo $?
255

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140827/3299da54/attachment.html>


More information about the llvm-bugs mailing list