Recommit r265309 after fixed an invalid memory reference bug happened
authorWei Mi <wmi@google.com>
Wed, 6 Apr 2016 15:41:07 +0000 (15:41 +0000)
committerWei Mi <wmi@google.com>
Wed, 6 Apr 2016 15:41:07 +0000 (15:41 +0000)
commit18293bef4e4efaafff57da67cef87ea47dc26cae
tree979c8be87f939b1a7c5c65feeb71ed537bb3424c
parent506f295a109918ae7449688e5d6eb0c024f895d0
Recommit r265309 after fixed an invalid memory reference bug happened
when DenseMap growed and moved memory. I verified it fixed the bootstrap
problem on x86_64-linux-gnu but I cannot verify whether it fixes
the bootstrap error on clang-ppc64be-linux. I will watch the build-bot
result closely.

Replace analyzeSiblingValues with new algorithm to fix its compile
time issue. The patch is to solve PR17409 and its duplicates.

analyzeSiblingValues is a N x N complexity algorithm where N is
the number of siblings generated by reg splitting. Although it
causes siginificant compile time issue when N is large, it is also
important for performance since it removes redundent spills and
enables rematerialization.

To solve the compile time issue, the patch removes analyzeSiblingValues
and replaces it with lower cost alternatives containing two parts. The
first part creates a new spill hoisting method in postOptimization of
register allocation. It does spill hoisting at once after all the spills
are generated instead of inside every instance of selectOrSplit. The
second part queries the define expr of the original register for
rematerializaiton and keep it always available during register allocation
even if it is already dead. It deletes those dead instructions only in
postOptimization. With the two parts in the patch, it can remove
analyzeSiblingValues without sacrificing performance.

Differential Revision: http://reviews.llvm.org/D15302

llvm-svn: 265547
16 files changed:
llvm/include/llvm/CodeGen/LiveRangeEdit.h
llvm/lib/CodeGen/InlineSpiller.cpp
llvm/lib/CodeGen/LiveRangeEdit.cpp
llvm/lib/CodeGen/RegAllocBase.cpp
llvm/lib/CodeGen/RegAllocBase.h
llvm/lib/CodeGen/RegAllocBasic.cpp
llvm/lib/CodeGen/RegAllocGreedy.cpp
llvm/lib/CodeGen/RegAllocPBQP.cpp
llvm/lib/CodeGen/Spiller.h
llvm/lib/CodeGen/SplitKit.cpp
llvm/lib/CodeGen/SplitKit.h
llvm/test/CodeGen/AArch64/aarch64-deferred-spilling.ll [deleted file]
llvm/test/CodeGen/X86/fp128-compare.ll
llvm/test/CodeGen/X86/hoist-spill.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/new-remat.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll