This is an archive of the discontinued LLVM Phabricator instance.

[CodeGenPrepare] Fix counting uses when folding addresses into memory instructions
ClosedPublic

Authored by chill on Feb 13 2023, 2:46 AM.

Details

Summary

The counter of the number of instructions seen in FindAllMemoryUses
is reset after returning from a recursive invocation of FindAllMemoryUses
to the value it had before the call. In effect, depending on the shape of the uses
graph, the function may scan up to 2^N-1 instructions where N is the scan limit
(MaxMemoryUsesToScan). This does not look intuitive or intended.

This patch changes the counting to just count the scanned instructions, independent
of the shape of the references.

Diff Detail

Event Timeline

chill created this revision.Feb 13 2023, 2:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2023, 2:46 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
chill requested review of this revision.Feb 13 2023, 2:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2023, 2:46 AM
chill edited the summary of this revision. (Show Details)Feb 13 2023, 6:24 AM
mkazantsev added inline comments.
llvm/test/CodeGen/Generic/addr-use-count.ll
1

Precommit test and use utils/update_llc_test_checks.py script to show what changed?

270

Do we really need so many cases to demonstrate what's going on?

mkazantsev accepted this revision.Mar 28 2023, 9:58 AM
This revision is now accepted and ready to land.Mar 28 2023, 9:58 AM
This revision was landed with ongoing or failed builds.Mar 30 2023, 6:18 AM
This revision was automatically updated to reflect the committed changes.