This is an archive of the discontinued LLVM Phabricator instance.

[Statepoint Lowering] Handle the case with several gc.result
ClosedPublic

Authored by skatkov on Mar 10 2021, 10:48 PM.

Details

Summary

Recently gc.result has been marked with readnone instead of readonly and
this opens a door for different optimization to duplicate gc.result.
Statepoint lowering is not ready to see several gc.results.
The problem appears when there are gc.results with one located in the same
basic block and another located in other basic block.
In this case we need both export VR and fill local setValue.

Note that this case is not sufficient optimization done before CodeGen.
It is evident that local gc.result dominates all other gc.results and it is handled
by GVN and EarlyCSE.

But anyway, even if IR is not optimal Backend should not crash on a valid IR.

Diff Detail

Event Timeline

skatkov created this revision.Mar 10 2021, 10:48 PM
skatkov requested review of this revision.Mar 10 2021, 10:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2021, 10:48 PM
skatkov updated this revision to Diff 329852.Mar 10 2021, 11:00 PM

Fix test by removing dup of CHECK-LABEL.

There is method GCStatepointInst::getGCResult() which became invalid now.
You should either remove it or change to return vector (like getGCRelocates()` does) and use it here.
Personally I prefer latter.

There is method GCStatepointInst::getGCResult() which became invalid now.
You should either remove it or change to return vector (like getGCRelocates()` does) and use it here.
Personally I prefer latter.

I removed this method in this patch. No other users of it exists at the moment. In case it is required we can add it.

dantrushin accepted this revision.Mar 11 2021, 3:39 AM

Ah, my bad, I missed that :)
LGTM

This revision is now accepted and ready to land.Mar 11 2021, 3:39 AM
This revision was landed with ongoing or failed builds.Mar 11 2021, 3:53 AM
This revision was automatically updated to reflect the committed changes.