[PATCH] D75016: [X86][TwoAddressInstructionPass] Teach tryInstructionCommute to continue checking for commutable FMA operands in more cases.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 00:39:13 PST 2020


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Previously we would only check for another commutable operand

  if the first commute was an aggressive commute.
  
  But if we have two kill operands and neither is tied to the def
  at the start, we should consider both operands as the one to
  use as the new def.
  
  This improves the loop in the fma-commute-loop.ll test. This
  test is derived from a post from discourse here
  https://llvm.discourse.group/t/unnecessary-vmovapd-instructions-generated-can-you-hint-in-favor-of-vfmadd231pd/582
  
  I haven't commited the test yet as I wasn't sure if I should
  try to simplify it even more. But I'm showing the current
  diff here for reviewing this patch.
  
  It does degrade some of the fastmath tests, but that's probably
  just due to the known problems with our decision making
  with physical register constraints from above and below on small
  code with multiple two address instructions.


https://reviews.llvm.org/D75016

Files:
  llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
  llvm/test/CodeGen/X86/fma-commute-loop.ll
  llvm/test/CodeGen/X86/recip-fastmath.ll
  llvm/test/CodeGen/X86/recip-fastmath2.ll
  llvm/test/CodeGen/X86/sqrt-fastmath.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75016.246100.patch
Type: text/x-patch
Size: 14961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200223/d5ccb453/attachment.bin>


More information about the llvm-commits mailing list