This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][InstrRef][NFC] Don't build mappings of values to locations for un-needed values
ClosedPublic

Authored by jmorse on Jan 31 2022, 4:27 AM.

Details

Summary

When finding locations for variable values at the start of a block, we build a large map of every value to every location, and then pick out the locations for values that are desired. This takes up quite a lot of time, because, unsurprisingly, there are usually more values in registers and stack slots than there are variables.

This patch instead creates a map of desired values to their locations, which are initially illegal locations. Then, as we examine every available value, we can select locations for values we care about, and ignore those that we don't. This substantially reduces the amount of work done (i.e., building a map up of values to locations that nothing wants or needs).

Geomean performance improvement of 1%: http://llvm-compile-time-tracker.com/compare.php?from=427eff43fcd470caa5cf44e10188c50f89b93af8&to=842aefd941f8e5f2d73b3178fdbbd7d27df9c55a&stat=instructions

Diff Detail

Event Timeline

jmorse created this revision.Jan 31 2022, 4:27 AM
jmorse requested review of this revision.Jan 31 2022, 4:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2022, 4:28 AM

Nice! I have one question inline but this SGTM.

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
323

Hmm... can ValuesPreferredLoc == ValueToLoc.end() ever be true now, with this patch?

jmorse added inline comments.Jan 31 2022, 9:47 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
323

Good point, I'll remove that when landing.

Orlando accepted this revision.Feb 1 2022, 12:45 AM

LGTM

This revision is now accepted and ready to land.Feb 1 2022, 12:45 AM
This revision was landed with ongoing or failed builds.Feb 1 2022, 10:58 AM
This revision was automatically updated to reflect the committed changes.