[llvm-bugs] [Bug 28540] New: Miscompile involving AssertZext on x86-64

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 13 11:37:52 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28540

            Bug ID: 28540
           Summary: Miscompile involving AssertZext on x86-64
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: eli.friedman at gmail.com
                CC: llvm-bugs at lists.llvm.org, mkuper at google.com
    Classification: Unclassified

Testcase:

define void @f(i64 %a, i64* %x, i64* %y) { 
; CHECK-LABEL: main
; CHECK: movl %ecx, %eax
; CHECK: ret
  %aa = and i64 %a, -1152921504606781441
  store i64 %aa, i64* %y
  %trunc = trunc i64 %aa to i32
  br label %l
l:
  %ext = zext i32 %trunc to i64
  store i64 %ext, i64* %x
  ret void
}

define i32 @main() { 
    %x = alloca i64
    %y = alloca i64
    call void @f(i64 -1, i64* %x, i64* %y)
    %yy = load i64, i64* %x
    %c = icmp slt i64 %yy, 0
    br i1 %c, label %abort, label %end

abort:
    call void @abort()
    unreachable

end:
    ret i32 0
}

declare void @abort()


Aborts with "llc", runs successfully with "llc -O0", trunk LLVM on Linux
x86-64.

Inspired by r221672 / bug 20494. The def32 pattern is extremely fragile.

-- 
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/20160713/8bff08ec/attachment.html>


More information about the llvm-bugs mailing list