Elide stores which are overwritten without being observed.
authorNirav Dave <niravd@google.com>
Tue, 16 May 2017 19:43:56 +0000 (19:43 +0000)
committerNirav Dave <niravd@google.com>
Tue, 16 May 2017 19:43:56 +0000 (19:43 +0000)
commitda8f2212731a3a12407a86a462ad84d5fcf86985
tree8decab0bf32886abb06e949293ebb525b2ccc286
parentd625bedb405b32e669566c1a2eceeddfc2ba2f5e
Elide stores which are overwritten without being observed.

Summary:
In SelectionDAG, when a store is immediately chained to another store
to the same address, elide the first store as it has no observable
effects. This is causes small improvements dealing with intrinsics
lowered to stores.

Test notes:

* Many testcases overwrite store addresses multiple times and needed
  minor changes, mainly making stores volatile to prevent the
  optimization from optimizing the test away.

* Many X86 test cases optimized out instructions associated with
  associated with va_start.

* Note that test_splat in CodeGen/AArch64/misched-stp.ll no longer has
  dependencies to check and can probably be removed and potentially
  replaced with another test.

Reviewers: rnk, john.brawn

Subscribers: aemerson, rengolin, qcolombet, jyknight, nemanjai, nhaehnle, javed.absar, llvm-commits

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

llvm-svn: 303198
23 files changed:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/ldst-zero.ll
llvm/test/CodeGen/AArch64/misched-stp.ll
llvm/test/CodeGen/AMDGPU/global-constant.ll
llvm/test/CodeGen/ARM/2011-02-04-AntidepMultidef.ll
llvm/test/CodeGen/ARM/2012-10-04-AAPCS-byval-align8.ll
llvm/test/CodeGen/ARM/dag-combine-ldst.ll
llvm/test/CodeGen/MSP430/vararg.ll
llvm/test/CodeGen/Mips/msa/bmzi_bmnzi.ll
llvm/test/CodeGen/PowerPC/ppcf128sf.ll
llvm/test/CodeGen/SPARC/32abi.ll
llvm/test/CodeGen/SPARC/64abi.ll
llvm/test/CodeGen/SystemZ/swift-return.ll
llvm/test/CodeGen/Thumb/stack-access.ll
llvm/test/CodeGen/Thumb2/ldr-str-imm12.ll
llvm/test/CodeGen/X86/arg-copy-elide.ll
llvm/test/CodeGen/X86/nontemporal.ll
llvm/test/CodeGen/X86/store-narrow.ll
llvm/test/CodeGen/X86/swift-return.ll
llvm/test/CodeGen/X86/win32-spill-xmm.ll
llvm/test/CodeGen/X86/win64_sibcall.ll
llvm/test/CodeGen/X86/win64_vararg.ll
llvm/test/CodeGen/X86/x86-64-ms_abi-vararg.ll