This is an archive of the discontinued LLVM Phabricator instance.

[EarlyCSE] Don't eagerly optimize MemoryUses
ClosedPublic

Authored by nikic on Mar 18 2022, 2:08 AM.

Details

Summary

EarlyCSE currently optimizes all MemoryUses upfront. However, EarlyCSE only actually queries the clobbering memory access for a subset of uses, namely those where a CSE candidate has already been identified.

Delaying use optimization to the clobber query improves compile-time in practice: http://llvm-compile-time-tracker.com/compare.php?from=59191057243e34d85b644716ef2811bfea8efd1e&to=1dd3499045716e71bad61ccd70700e734a74d350&stat=instructions

This change is not NFC because EarlyCSE has a limit on the number of clobber queries (EarlyCSEMssaOptCap), in which case it falls back to the defining access. The defining access for uses will now no longer coincide with the optimized access. If there are performance regressions from this change, we should be able to address them by raising this limit.

Diff Detail

Event Timeline

nikic created this revision.Mar 18 2022, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2022, 2:08 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.Mar 18 2022, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2022, 2:08 AM
asbirlea accepted this revision.Mar 22 2022, 3:06 PM

I'm seeing no meaningful difference in performance from this as is. Let's see if there are other reports and we can increase the limit if this is the case.

This revision is now accepted and ready to land.Mar 22 2022, 3:06 PM
This revision was automatically updated to reflect the committed changes.