Avoid false dependencies of undef machine operands
authorMarina Yatsina <marina.yatsina@intel.com>
Thu, 11 Aug 2016 07:32:08 +0000 (07:32 +0000)
committerMarina Yatsina <marina.yatsina@intel.com>
Thu, 11 Aug 2016 07:32:08 +0000 (07:32 +0000)
commit88f0c31f13d6ad02dc6a5e2d1f37dd57b7e6b260
treef404da59828a8ce3a2a3570b405f1b3c48270241
parentb83e73bceb64590f0879a2ed03aa3803bea7daf8
Avoid false dependencies of undef machine operands

This patch helps avoid false dependencies on undef registers by updating the machine instructions' undef operand to use a register that the instruction is truly dependent on, or use a register with clearance higher than Pref.

Pseudo example:

loop:
xmm0 = ...
xmm1 = vcvtsi2sdl eax, xmm0<undef>
... = inst xmm0
jmp loop

In this example, selecting xmm0 as the undef register creates false dependency between loop iterations.
This false dependency cannot be solved by inserting an xor before vcvtsi2sdl because xmm0 is alive at the point of the vcvtsi2sdl instruction.
Selecting a different register instead of xmm0, especially a register that is not used in the loop, will eliminate this problem.

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

llvm-svn: 278321
llvm/lib/CodeGen/ExecutionDepsFix.cpp
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/avx512-cvt.ll
llvm/test/CodeGen/X86/break-false-dep.ll
llvm/test/CodeGen/X86/copy-propagation.ll
llvm/test/CodeGen/X86/half.ll
llvm/test/CodeGen/X86/sse-fsignum.ll
llvm/test/CodeGen/X86/vec_int_to_fp.ll