This is an archive of the discontinued LLVM Phabricator instance.

[InlineCost]Account for switch instructons when the switch condition could be simplified as a result of inlines.
ClosedPublic

Authored by mingmingl on Jun 2 2023, 9:36 PM.

Diff Detail

Event Timeline

mingmingl created this revision.Jun 2 2023, 9:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 9:36 PM
mingmingl requested review of this revision.Jun 2 2023, 9:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 9:36 PM
kazu accepted this revision.Jun 5 2023, 12:55 PM

See the comment about isa_and_present above.

llvm/lib/Analysis/InlineCost.cpp
859–860

May I suggest something like this?

if (isa_and_present<ConstantInt>(SimplifiedValues.lookup(SI->getCondition())))

This is for consistency with the BranchInst handling just a few lines above.

isa_and_present is a successor of isa_and_nonnull, which I *think* will be deprecated.

This revision is now accepted and ready to land.Jun 5 2023, 12:55 PM
mingmingl updated this revision to Diff 557147.Sep 20 2023, 2:10 PM
mingmingl retitled this revision from [InlineCost]Account for switch instructons when the switch condition could be simplified as a result of inlines. to [InlineCost]Account for switch instructons when the switch condition could besimplified as a result of inlines..

address feedback.

mingmingl retitled this revision from [InlineCost]Account for switch instructons when the switch condition could besimplified as a result of inlines. to [InlineCost]Account for switch instructons when the switch condition could be simplified as a result of inlines..Sep 20 2023, 2:10 PM
This revision was landed with ongoing or failed builds.Sep 20 2023, 2:49 PM
This revision was automatically updated to reflect the committed changes.