[PATCH] D40193: [DAGCombine] Disable finding better chains for stores at O0

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 13:22:18 PST 2017


sdardis created this revision.

Unoptimized IR can have linear sequences of stores to an array, where the
initial GEP for the first store is formed from the pointer to the array, and the
GEP for each store after the first is formed from the previous GEP with some
offset in an inductive fashion.

The (large) resulting DAG when analyzed by DAGCombine undergoes an excessive
number of combines as each store node is examined every time its' offset node
is combined with any child of the offset. One of the transformations is
findBetterNeighborChains which assists MergeConsecutiveStores. The former
relies on repeated chain walking to do its' work, however MergeConsecutiveStores
is disabled at O0 which makes the transformation redundant.

Any optimization level other than O0 would invoke InstCombine which would
resolve the chain of GEPs into flat base + offset GEP for each store which
does not exhibit the repeated examination of each store to the array.

Disabling this optimization fixes an excessive compile time issue (30~ minutes
for the test case provided) at O0.


Repository:
  rL LLVM

https://reviews.llvm.org/D40193

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/Mips/dagcombine-store-gep-chain-slow.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40193.123408.patch
Type: text/x-patch
Size: 40460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171117/bee529f0/attachment.bin>


More information about the llvm-commits mailing list