In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
authorNirav Dave <niravd@google.com>
Thu, 13 Oct 2016 19:20:16 +0000 (19:20 +0000)
committerNirav Dave <niravd@google.com>
Thu, 13 Oct 2016 19:20:16 +0000 (19:20 +0000)
commit4b369572435797b49186347a6c9d4500bbfe895a
tree00c07626228eaf08eb77484e8d5f4ba5ae8d9de0
parent3d01ad116c85af0ba75656d6d7874dd9fda98dec
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.

   Retrying after upstream changes.

   Simplify Consecutive Merge Store Candidate Search

   Now that address aliasing is much less conservative, push through
   simplified store merging search which only checks for parallel stores
   through the chain subgraph. This is cleaner as the separation of
   non-interfering loads/stores from the store-merging logic.

   Whem merging stores, search up the chain through a single load, and
   finds all possible stores by looking down from through a load and a
   TokenFactor to all stores visited. This improves the quality of the
   output SelectionDAG and generally the output CodeGen (with some
   exceptions).

   Additional Minor Changes:

       1. Finishes removing unused AliasLoad code
       2. Unifies the the chain aggregation in the merged stores across
       code paths
       3. Re-add the Store node to the worklist after calling
       SimplifyDemandedBits.
       4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
       arbitrary, but seemed sufficient to not cause regressions in
       tests.

   This finishes the change Matt Arsenault started in r246307 and
   jyknight's original patch.

   Many tests required some changes as memory operations are now
   reorderable. Some tests relying on the order were changed to use
   volatile memory operations

   Noteworthy tests:

    CodeGen/AArch64/argument-blocks.ll -
      It's not entirely clear what the test_varargs_stackalign test is
      supposed to be asserting, but the new code looks right.

    CodeGen/AArch64/arm64-memset-inline.lli -
    CodeGen/AArch64/arm64-stur.ll -
    CodeGen/ARM/memset-inline.ll -

      The backend now generates *worse* code due to store merging
      succeeding, as we do do a 16-byte constant-zero store efficiently.

    CodeGen/AArch64/merge-store.ll -
      Improved, but there still seems to be an extraneous vector insert
      from an element to itself?

    CodeGen/PowerPC/ppc64-align-long-double.ll -
      Worse code emitted in this case, due to the improved store->load
      forwarding.

    CodeGen/X86/dag-merge-fast-accesses.ll -
    CodeGen/X86/MergeConsecutiveStores.ll -
    CodeGen/X86/stores-merging.ll -
    CodeGen/Mips/load-store-left-right.ll -
      Restored correct merging of non-aligned stores

    CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
      Improved. Correctly merges buffer_store_dword calls

    CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
      Improved. Sidesteps loading a stored value and
      merges two stores

    CodeGen/X86/pr18023.ll -
      This test has been removed, as it was asserting incorrect
      behavior. Non-volatile stores *CAN* be moved past volatile loads,
      and now are.

    CodeGen/X86/vector-idiv.ll -
    CodeGen/X86/vector-lzcnt-128.ll -
      It's basically impossible to tell what these tests are actually
      testing. But, looks like the code got better due to the memory
      operations being recognized as non-aliasing.

    CodeGen/X86/win32-eh.ll -
      Both loads of the securitycookie are now merged.

    CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot-compute.ll -
      This test appears to work but no longer exhibits the spill behavior.

Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle

Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, dsanders, resistor, tstellarAMD, t.p.northover, spatel

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

llvm-svn: 284151
70 files changed:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AArch64/argument-blocks.ll
llvm/test/CodeGen/AArch64/arm64-abi-varargs.ll
llvm/test/CodeGen/AArch64/arm64-abi.ll
llvm/test/CodeGen/AArch64/arm64-memset-inline.ll
llvm/test/CodeGen/AArch64/arm64-stur.ll
llvm/test/CodeGen/AArch64/merge-store.ll
llvm/test/CodeGen/AArch64/vector_merge_dep_check.ll
llvm/test/CodeGen/AMDGPU/cvt_f32_ubyte.ll
llvm/test/CodeGen/AMDGPU/debugger-insert-nops.ll
llvm/test/CodeGen/AMDGPU/merge-stores.ll
llvm/test/CodeGen/AMDGPU/private-element-size.ll
llvm/test/CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll
llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot-compute.ll
llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll
llvm/test/CodeGen/ARM/2012-10-04-AAPCS-byval-align8.ll
llvm/test/CodeGen/ARM/alloc-no-stack-realign.ll
llvm/test/CodeGen/ARM/ifcvt10.ll
llvm/test/CodeGen/ARM/memset-inline.ll
llvm/test/CodeGen/ARM/static-addr-hoisting.ll
llvm/test/CodeGen/BPF/undef.ll
llvm/test/CodeGen/MSP430/Inst16mm.ll
llvm/test/CodeGen/Mips/cconv/arguments-float.ll
llvm/test/CodeGen/Mips/cconv/arguments-varargs.ll
llvm/test/CodeGen/Mips/fastcc.ll
llvm/test/CodeGen/Mips/load-store-left-right.ll
llvm/test/CodeGen/Mips/micromips-li.ll
llvm/test/CodeGen/Mips/mips64-f128.ll
llvm/test/CodeGen/Mips/mno-ldc1-sdc1.ll
llvm/test/CodeGen/Mips/msa/i5_ld_st.ll
llvm/test/CodeGen/Mips/o32_cc_byval.ll
llvm/test/CodeGen/Mips/o32_cc_vararg.ll
llvm/test/CodeGen/PowerPC/anon_aggr.ll
llvm/test/CodeGen/PowerPC/complex-return.ll
llvm/test/CodeGen/PowerPC/jaggedstructs.ll
llvm/test/CodeGen/PowerPC/ppc64-align-long-double.ll
llvm/test/CodeGen/PowerPC/structsinmem.ll
llvm/test/CodeGen/PowerPC/structsinregs.ll
llvm/test/CodeGen/SystemZ/unaligned-01.ll
llvm/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll
llvm/test/CodeGen/Thumb/stack-access.ll
llvm/test/CodeGen/X86/2010-09-17-SideEffectsInChain.ll
llvm/test/CodeGen/X86/2012-11-28-merge-store-alias.ll
llvm/test/CodeGen/X86/MergeConsecutiveStores.ll
llvm/test/CodeGen/X86/avx512-mask-op.ll
llvm/test/CodeGen/X86/chain_order.ll
llvm/test/CodeGen/X86/clear_upper_vector_element_bits.ll
llvm/test/CodeGen/X86/combiner-aa-0.ll [deleted file]
llvm/test/CodeGen/X86/combiner-aa-1.ll [deleted file]
llvm/test/CodeGen/X86/copy-eflags.ll
llvm/test/CodeGen/X86/dag-merge-fast-accesses.ll
llvm/test/CodeGen/X86/dont-trunc-store-double-to-float.ll
llvm/test/CodeGen/X86/extractelement-legalization-store-ordering.ll
llvm/test/CodeGen/X86/i256-add.ll
llvm/test/CodeGen/X86/i386-shrink-wrapping.ll
llvm/test/CodeGen/X86/live-range-nosubreg.ll
llvm/test/CodeGen/X86/merge-consecutive-loads-128.ll
llvm/test/CodeGen/X86/merge-consecutive-loads-256.ll
llvm/test/CodeGen/X86/merge-store-partially-alias-loads.ll
llvm/test/CodeGen/X86/pr18023.ll [deleted file]
llvm/test/CodeGen/X86/split-store.ll
llvm/test/CodeGen/X86/stores-merging.ll
llvm/test/CodeGen/X86/vector-compare-results.ll
llvm/test/CodeGen/X86/vector-lzcnt-128.ll
llvm/test/CodeGen/X86/vector-shuffle-variable-128.ll
llvm/test/CodeGen/X86/vector-shuffle-variable-256.ll
llvm/test/CodeGen/X86/win32-eh.ll
llvm/test/CodeGen/XCore/varargs.ll