This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Fix dependency analysis in checkMergeStoreCandidatesForDependencies
ClosedPublic

Authored by bjope on Feb 3 2022, 1:20 PM.

Details

Summary

In the aftermath of D116895 a problem was found in the analysis of
dependencies between store merge candidates in
checkMergeStoreCandidatesForDependencies, that is needed to avoid
the cycles are introduced in the DAG.

In the past it has been enough (or assumed to be enough) to start
scanning from non-chain operands when analysing the store merge
candidates for dependencies, assuming that the analysis of chain
dependencies performed when finding the candidates would cover
up for potential dependencies that exist involving the chain operands.
It was however discovered that one could end up with scenarios such
as descibed in the aarch64-checkMergeStoreCandidatesForDependencies.ll
test case, when the dependency between two stores is given by a mix
of chain operand dependencies and non-chain operand dependencies.

The fix in this patch make sure that we also account for chain operand
dependencies when doing the more elaborate analysis in
checkMergeStoreCandidatesForDependencies, no longer relying on that
the earlier check involving chain operands is enough.

Diff Detail

Event Timeline

bjope created this revision.Feb 3 2022, 1:20 PM
bjope requested review of this revision.Feb 3 2022, 1:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 1:20 PM
niravd accepted this revision.Feb 3 2022, 2:05 PM

LGTM.

This revision is now accepted and ready to land.Feb 3 2022, 2:05 PM
This revision was landed with ongoing or failed builds.Feb 4 2022, 12:09 AM
This revision was automatically updated to reflect the committed changes.
RKSimon added a subscriber: RKSimon.Jan 3 2023, 8:01 AM

@bjope This has been identified as the cause of a major compile time regression - https://github.com/llvm/llvm-project/issues/59800 - please can you take a look?

Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 8:01 AM
bjope added a comment.Jan 3 2023, 2:27 PM

@bjope This has been identified as the cause of a major compile time regression - https://github.com/llvm/llvm-project/issues/59800 - please can you take a look?

Thanks for the heads up @RKSimon.
IIRC this fix was done to avoid some ICE (LLVM unreachable). So the fix was just to make the analysis correct.
I can take a look to see if I can find something to improve.