This is an archive of the discontinued LLVM Phabricator instance.

[AggressiveInstCombine] Enable also for -O2
ClosedPublic

Authored by xbolva00 on Apr 5 2023, 5:33 AM.

Details

Summary

Next step after https://reviews.llvm.org/D113179

Recently a set of patches by @anton-afanasyev improved many cases (better and cleaner vectorized code) thanks to improvements to AIC's TruncInstCombine (IC cannot handle it) motivated by real examples in bug reports. There was a discussion that -O2 could benefit from AIC as well, but discussion then stalled, so I would like restart it, with new numbers from LLVM compile time tracker.

As -O2 pipeline is not tracked by LLVM compile time tracker, I disabled AIC for -O3 to get an idea how expensive is it. Without AIC, I observed that geomean was cca -0.10%. Given that it seems like AIC is quite cheap, heavily tested by -O3 pipeline, I am proposing to enable it also with -O2 and similar to improve quality to vectorized code.

https://llvm-compile-time-tracker.com/compare.php?from=a1df5abef5f27646c809c7b85cf6170eb68f7735&to=e1ba6068f58c6ca862b920b8750faccb42a5843c&stat=instructions:u

Diff Detail

Event Timeline

xbolva00 created this revision.Apr 5 2023, 5:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 5:33 AM
xbolva00 requested review of this revision.Apr 5 2023, 5:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 5:33 AM
xbolva00 removed 1 blocking reviewer(s): nikic.Apr 5 2023, 5:33 AM
xbolva00 edited the summary of this revision. (Show Details)
nikic accepted this revision.Apr 5 2023, 5:39 AM

LGTM

llvm/lib/Passes/PassBuilderPipelines.cpp
508–509

This check is not needed, O1 is handled separately above.

This revision is now accepted and ready to land.Apr 5 2023, 5:39 AM
xbolva00 updated this revision to Diff 511103.Apr 5 2023, 7:45 AM

Drop unnecessary check.

anton-afanasyev accepted this revision.Apr 5 2023, 7:50 AM

LGTM, thanks for resurrecting this.

This revision was landed with ongoing or failed builds.Apr 5 2023, 7:51 AM
This revision was automatically updated to reflect the committed changes.