[X86][TwoAddressInstructionPass] Teach tryInstructionCommute to continue checking...
authorCraig Topper <craig.topper@gmail.com>
Fri, 28 Feb 2020 04:53:17 +0000 (20:53 -0800)
committerCraig Topper <craig.topper@gmail.com>
Mon, 2 Mar 2020 00:38:08 +0000 (16:38 -0800)
commitb6e2796114d08aadfabe8c889b5d96e6bc4f5e0e
tree5d1ddce3f0a714e85f7a0d23b7e98c718ef0d937
parent211fb91f1067ecdf7c0b8a019bcf76554d813129
[X86][TwoAddressInstructionPass] Teach tryInstructionCommute to continue checking for commutable FMA operands in more cases.

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

Differential Revision: https://reviews.llvm.org/D75016
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