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

            Bug ID: 50615
           Summary: Miscompile with "[X86FixupLEAs] Transform the sequence
                    LEA/SUB to SUB/SUB"
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: max.kazant...@azul.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

Created attachment 24925
  --> https://bugs.llvm.org/attachment.cgi?id=24925&action=edit
Resulting assembly (good and bad)

The miscompile is caused by the following patch:

commit 1b748faf2bae246e2fc77d88420df13c2e60f4df
Author: Guozhi Wei <car...@google.com>
Date:   Tue Jun 1 10:31:30 2021 -0700

    [X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

    This patch transforms the sequence

        lea (reg1, reg2), reg3
        sub reg3, reg4

    to two sub instructions

        sub reg1, reg4
        sub reg2, reg4

    Similar optimization can also be applied to LEA/ADD sequence.
    The modifications to TwoAddressInstructionPass is to ensure the operands of
ADD
    instruction has expected order (the dest register of LEA should be src
register of ADD).

    Differential Revision: https://reviews.llvm.org/D101970


The prior revision of this patch was reverted due to a miscompile. We are sill
observing a miscompile, original test is written in Java and I could not easily
make a C++ repro. In attachment - resulting assembly for bad (current trunk)
and good (with the problematic patch reverted) cases, and llc logs with
-print-after-all/print-before-all for each of them

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to