[llvm-bugs] [Bug 27792] New: Very recent regression when optimizing i128

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 17 11:01:45 PDT 2016


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

            Bug ID: 27792
           Summary: Very recent regression when optimizing i128
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: yyc1992 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

According to our (julia) buildbot, this happened within the last 24 hours

http://buildbot.e.ip.saba.us:8010/builders/nightly_llvmsvn-x64
http://buildbot.e.ip.saba.us:8010/builders/nightly_llvmsvn-x86

So far all of the failing tests seems to be related to 128bit integer handling.
It is unclear if there is a single issue but one of the reduced test case is
(this is the code we emit for sign check)

```
define i32 @f(i128) {
top:
  %1 = lshr i128 %0, 127
  %2 = trunc i128 %1 to i1
  %3 = xor i1 %2, true
  br i1 %3, label %pass, label %fail

fail:                                             ; preds = %top
  ret i32 0

pass:                                             ; preds = %top
  ret i32 1
}
```

For -O1 to -O3 with opt on x64, this is mis-optimized to

```
yuyichao% usr/bin/opt -O3 -S -o - a.ll
; ModuleID = 'a.ll'
source_filename = "a.ll"

; Function Attrs: norecurse nounwind readnone
define i32 @f(i128) #0 {
top:
  %1 = icmp sgt i128 %0, 18446744073709551615
  %. = zext i1 %1 to i32
  ret i32 %.
}

attributes #0 = { norecurse nounwind readnone }
```

Where `18446744073709551615` is the 64 bits representation of `-1`. The code is
correct if it is an 128 bits `-1` (which is what LLVM 3.8 optimized it to in a
similar case (not for this case))

-- 
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/20160517/023b471f/attachment.html>


More information about the llvm-bugs mailing list