]> granicus.if.org Git - llvm/commit
[x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)
authorSanjay Patel <spatel@rotateright.com>
Thu, 18 Jul 2019 12:48:01 +0000 (12:48 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 18 Jul 2019 12:48:01 +0000 (12:48 +0000)
commit301cca3f354879fd2447fe0f37deea78e0498177
treea255bbed28f757e605c14e5de1ba51fc185c85a0
parente06702594259d8449c7d6e82173ac2c6fb26562f
[x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)

LEA doesn't affect flags, so use it more liberally to replace an ADD when
we know that the ADD operands affect flags.

In the motivating example from PR40483:
https://bugs.llvm.org/show_bug.cgi?id=40483
...this lets us avoid duplicating a math op just to avoid flag conflict.

As mentioned in the TODO comments, this heuristic can be extended to
fire more often if that leads to more improvements.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366431 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelDAGToDAG.cpp
test/CodeGen/X86/combine-sbb.ll