[X86FixupLEAs] Sub register usage of LEA dest should block LEA/SUB optimization
authorGuozhi Wei <carrot@google.com>
Fri, 11 Jun 2021 16:43:52 +0000 (09:43 -0700)
committerGuozhi Wei <carrot@google.com>
Fri, 11 Jun 2021 16:45:56 +0000 (09:45 -0700)
commitf35bcea1d4748889b8240defdf00cb7a71cbe070
tree6e51afb7dc38a7699a65b347beda4f6af10b047a
parentf84dbd2f2befb628ac2ac151fed495d70a2d05be
[X86FixupLEAs] Sub register usage of LEA dest should block LEA/SUB optimization

In function searchALUInst, sub register usage of LEA dest should also block LEA/SUB optimization, otherwise the sub register usage gets an undefined value.

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

Differential Revision: https://reviews.llvm.org/D103922
llvm/lib/Target/X86/X86FixupLEAs.cpp
llvm/test/CodeGen/X86/lea-opt2.ll