Page MenuHomePhabricator

[ConstFold] Simplify a load's GEP operand through local aliases
ClosedPublic

Authored by aeubanks on Apr 22 2021, 12:26 PM.

Details

Summary

MSVC-style RTTI produces loads through a GEP of a local alias which
itself is a GEP. Currently we aren't able to devirtualize any virtual
calls when MSVC RTTI is enabled.

This patch attempts to simplify a load's GEP operand by calling
SymbolicallyEvaluateGEP() with an option to look through local aliases.

Diff Detail

Event Timeline

aeubanks created this revision.Apr 22 2021, 12:26 PM
aeubanks requested review of this revision.Apr 22 2021, 12:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2021, 12:26 PM
rnk added a comment.Apr 26 2021, 6:49 PM

Should we go forward with something in the direction of D101103 instead, or is this still the way forward?

llvm/lib/IR/Value.cpp
624–625 ↗(On Diff #339756)

Do we need checks for non-interposability on the alias and aliasee here?

aeubanks updated this revision to Diff 340992.Apr 27 2021, 2:42 PM

properly handle non-interposable aliases, add tests

aeubanks updated this revision to Diff 345237.May 13 2021, 11:32 AM

rebase
add comments

rnk added inline comments.Tue, May 25, 11:52 AM
llvm/lib/Analysis/ConstantFolding.cpp
874–881

We talked about moving the alias handling here rather than adding an IR helper.

aeubanks updated this revision to Diff 348054.Wed, May 26, 12:37 PM

move everything out of Value into ConstantFolding.cpp

aeubanks edited the summary of this revision. (Show Details)Wed, May 26, 12:37 PM
rnk accepted this revision.Wed, May 26, 4:19 PM

lgtm

This revision is now accepted and ready to land.Wed, May 26, 4:19 PM
This revision was landed with ongoing or failed builds.Thu, May 27, 4:04 PM
This revision was automatically updated to reflect the committed changes.