[llvm-bugs] [Bug 50399] New: Miscompile with opt -correlated-propagation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 18 23:58:41 PDT 2021


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

            Bug ID: 50399
           Summary: Miscompile with opt -correlated-propagation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24873
  --> https://bugs.llvm.org/attachment.cgi?id=24873&action=edit
bbi-56214_2.ll reproducer

Reproduce with
 opt -correlated-propagation -S -o - bbi-56214_2.ll

The store in %cond.end32 is changed from
  store i64 %i10, i64* %arrayidx12, align 1                          ; store 0
to
  store i64 %sub18, i64* %arrayidx12, align 1
which I think is wrong.

In the last iteration of the loop the value 0 chould be written but now we
instead write %sub18 which actually is a poison value!

I've done some annotations in the input ll-file about the value of different
temporaries which I think shows that the change done by the pass is wrong.

I suspect that the fact that %sub18 is poison isn't handled correctly.

This starts happening with commit a917fb89dc28:

    [LVI] Simplify and generalize handling of clamp patterns

    Instead of handling a number of special cases for selects, handle
    this generally when inferring ranges from conditions. We already
    infer ranges from `x + C pred C2` to `x`, so doing the same for
    `x pred C2` to `x + C` is straightforward.

-- 
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/20210519/46b7af86/attachment.html>


More information about the llvm-bugs mailing list