This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Move statepoint intrinsic handling from visitCall to visitCallBase
ClosedPublic

Authored by skatkov on Mar 2 2021, 10:38 PM.

Details

Summary

statepoint intrinsic can be used in invoke context, so it should be handled in visitCallBase
to cover both call and invoke.

Diff Detail

Event Timeline

skatkov created this revision.Mar 2 2021, 10:38 PM
skatkov requested review of this revision.Mar 2 2021, 10:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2021, 10:38 PM

Do they actually ever throw though? Can they?

Do they actually ever throw though? Can they?

Yes, they can throw.
See https://llvm.org/docs/Statepoints.html#gc-statepoint. As an example,
"Note that semantically the statepoint still represents a call or invoke to ‘target’, and the nop sequence after patching is expected to represent an operation equivalent to a call or invoke to ‘target’."

reames accepted this revision.Mar 3 2021, 11:46 AM

LGTM

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
2176

Add default: break.

Otherwise, you'll get uncovered-switch warnings on many build bots.

2267

OT: It looks like we could sink CreateWithReplacementBundle to the CallSite base and simplify some code here. Might be a good cleanup.

This revision is now accepted and ready to land.Mar 3 2021, 11:46 AM
reames added inline comments.Mar 3 2021, 12:24 PM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
2267

I went ahead and did this since it was easy. Make sure you rebase over 99f54173.