This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Avoid repeated proveNoUnsignedWrapViaInduction calls.
ClosedPublic

Authored by fhahn on Jul 27 2022, 10:18 AM.

Details

Summary

At the moment, proveNoUnsignedWrapViaInduction may be called for the
same AddRec a large number of times via getZeroExtendExpr. This can have
a severe compile-time impact for very loop-heavy code. One one
particular workload, LSR takes ~51s without this patch, almost
exlusively in proveNoUnsignedWrapViaInduction. With this patch, the time
in LSR drops to ~0.4s.

If proveNoUnsignedWrapViaInduction failed to prove NUW the first time,
it is unlikely to succeed on subsequent tries and the cost doesn't seem
to be justified.

Besides drastically improving compile-time in some excessive cases, this
also has a slightly positive compile-time impact on CTMark:

NewPM-O3: -0.07%
NewPM-ReleaseThinLTO: -0.08%
NewPM-ReleaseLTO-g: -0.06

https://llvm-compile-time-tracker.com/compare.php?from=b435da027d7774c24cdb8c88d09f6b771e07fb14&to=f2729e33e8284b502f6c35a43345272252f35d12&stat=instructions

Diff Detail

Event Timeline

fhahn created this revision.Jul 27 2022, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 10:18 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn requested review of this revision.Jul 27 2022, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 10:18 AM
nikic accepted this revision.Jul 27 2022, 11:40 AM

LGTM

Would doing the same for the signed case make sense?

This revision is now accepted and ready to land.Jul 27 2022, 11:40 AM
This revision was landed with ongoing or failed builds.Jul 28 2022, 2:02 AM
This revision was automatically updated to reflect the committed changes.