Fix the ExecutionDepsFix pass to handle AVX instructions.
authorAndrew Trick <atrick@apple.com>
Mon, 14 Oct 2013 22:19:03 +0000 (22:19 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 14 Oct 2013 22:19:03 +0000 (22:19 +0000)
commita6a9ac5aa1092067e6e1546226d8bdd6a4bfcf99
treed28e7ac2e1333f9dc7af9c1f71719d94cba35483
parent966772931eea7cdc3cdd7199e304d667aa344bd7
Fix the ExecutionDepsFix pass to handle AVX instructions.

This pass is needed to break false dependencies. Without it, unlucky
register assignment can result in wild (5x) swings in
performance. This pass was trying to handle AVX but not getting it
right. AVX doesn't have partial register defs, it has unused register
reads in which the high bits of a source operand are copied into the
unused bits of the dest.

Fixing this requires conservative liveness analysis. This is awkard
because the pass already has its own pseudo-liveness. However, proper
liveness is expensive, and we would like to use a generic utility to
compute it. The fix only invokes liveness on-demand. It is rare to
detect a case that needs undef-read dependence breaking, but when it
happens, it can be needed many times within a very large block.

I think the existing heuristic which uses a register window of 16 is
too conservative for loop-carried false dependencies. If the loop is a
reduction. The out-of-order engine may be able to execute several loop
iterations in parallel. However, I'll leave this tuning exercise for
next time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192635 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/ExecutionDepsFix.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h
lib/Target/X86/X86RegisterInfo.cpp