This is an archive of the discontinued LLVM Phabricator instance.

[Assignment Tracking] Choose better passes for RemoveRedundantDbgInstrs call
ClosedPublic

Authored by Orlando on Feb 21 2023, 6:58 AM.

Details

Summary

Enabling assignment tracking without this patch, a significant amount of additional compiler run time comes from the RemoveRedundantDbgInstrs call in InstCombine. This patch reduces compiler run time by choosing better places to call RemoveRedundantDbgInstrs.

In non-assignment-tracking builds, RemoveRedundantDbgInstrs is called by InstCombine if LowerDbgDeclare makes a change (i.e. it is _sometimes_ called). In assignment tracking builds LowerDbgDeclare doesn't do anything. We still need to clean up redundant intrinsics to avoid a large performance hit due to the number of instructions, so the current approach is to have InstCombine _always_ call RemoveRedundantDbgInstrs.

Instrumenting the compiler to run RemoveRedundantDbgInstrs after every pass and dump the numbers and building CTMark/tramp3d-v4 indicates that SROA and LoopVectorize give us a bigger bang (number removed) for buck (times pass is run).

The compile time tracker reports that this patch reduces the number of instructions retired building CTMark projects by an average of 1.1%.

Diff Detail

Event Timeline

Orlando created this revision.Feb 21 2023, 6:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 6:58 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Orlando requested review of this revision.Feb 21 2023, 6:58 AM
scott.linder accepted this revision.Feb 21 2023, 10:25 AM

Seems reasonable to me! LGTM with a small nit

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
10611–10612

nit, formatting

This revision is now accepted and ready to land.Feb 21 2023, 10:25 AM
This revision was landed with ongoing or failed builds.Feb 22 2023, 8:29 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review.

N.B. I had to fix up a couple of extra tests before landing.