This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] If a TokenFactor would be merged into its user, consider the user later.
ClosedPublic

Authored by niravd on Mar 12 2019, 8:53 AM.

Details

Summary

A number of optimizations are inhibited by single-use TokenFactors not
being merged into the TokenFactor using it. This makes we consider if
we can do the merge immediately.

Most tests changes here are due to the change in visitation causing
minor reorderings and associated reassociation of paired memory
operations.

CodeGen tests with non-reordering changes:

X86/aligned-variadic.ll -- memory-based add folded into stored leaq
value.

X86/constant-combiners.ll -- Optimizes out overlap between stores.

X86/pr40631_deadstore_elision -- folds constant byte store into
preceding quad word constant store.

Event Timeline

niravd created this revision.Mar 12 2019, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2019, 8:53 AM
courbet accepted this revision.Mar 13 2019, 8:39 AM

X86/constant-combiners.ll -- Optimizes out overlap between stores.

I don't see that one.

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1710

"If the sole user of this node is a token factor, we should ..."

This revision is now accepted and ready to land.Mar 13 2019, 8:39 AM
This revision was automatically updated to reflect the committed changes.

@niravd Hi Nirav, my team and I discovered a compile time regression due to this patch. I submitted a bug report for it, we would really appreciate if you could take a look at it:

https://github.com/llvm/llvm-project/issues/52858

Thank you in advance.