This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Disable finding better chains for stores at O0
ClosedPublic

Authored by sdardis on Nov 17 2017, 1:22 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis created this revision.Nov 17 2017, 1:22 PM
niravd edited edge metadata.Nov 17 2017, 1:48 PM

We definitely shouldn't be doing this at O0. We should probably add the same check for FindBetterChain as well.

niravd accepted this revision.Nov 17 2017, 1:49 PM

LGTM modulo added check.

This revision is now accepted and ready to land.Nov 17 2017, 1:49 PM
sdardis updated this revision to Diff 123483.Nov 18 2017, 3:11 PM

Updating for review comments.

The requested change has lead to some test changes, so I'll wait for additional comments before committing this.

I'm adding people who've touched those test files last for comments.

niravd accepted this revision.Nov 27 2017, 7:27 AM

LGTM.

This revision was automatically updated to reflect the committed changes.