This is an archive of the discontinued LLVM Phabricator instance.

[X86] Use bundle for CALL_RVMARKER expansion.
ClosedPublic

Authored by fhahn on Dec 7 2021, 2:55 AM.

Details

Summary

This patch updates expandCALL_RVMARKER to wrap the call, marker and
objc runtime call in an instruction bundle. This ensures later passes,
like machine block placement, cannot break them up.

On AArch64, the instruction sequence is already wrapped in a bundle.
Keeping the whole instruction sequence together is highly desirable for
performance and outweighs potential other benefits from breaking the
sequence up.

Diff Detail

Event Timeline

fhahn created this revision.Dec 7 2021, 2:55 AM
fhahn requested review of this revision.Dec 7 2021, 2:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2021, 2:55 AM
fhahn updated this revision to Diff 392851.Dec 8 2021, 11:37 AM

Updated to only use bundles during expansion for Darwin platforms. This keeps it in sync with TargetMachine (for now the bundle expansion pass is only scheduled on Darwin platforms).

Updated to only use bundles during expansion for Darwin platforms. This keeps it in sync with TargetMachine (for now the bundle expansion pass is only scheduled on Darwin platforms).

Is it possible to pass a predicate functor to createUnpackMachineBundle? The functor would just check the presence of ObjC module flags or declarations of the ObjC ARC runtime functions in the module and UnpackMachineBundles::runOnMachineFunction would return early if they don't exist in the module.

I'm assuming the pass is enabled only on Darwin to avoid the overhead of running the pass when it's not needed.

fhahn updated this revision to Diff 393916.Dec 13 2021, 9:09 AM

Updated to only use bundles during expansion for Darwin platforms. This keeps it in sync with TargetMachine (for now the bundle expansion pass is only scheduled on Darwin platforms).

Is it possible to pass a predicate functor to createUnpackMachineBundle? The functor would just check the presence of ObjC module flags or declarations of the ObjC ARC runtime functions in the module and UnpackMachineBundles::runOnMachineFunction would return early if they don't exist in the module.

I'm assuming the pass is enabled only on Darwin to avoid the overhead of running the pass when it's not needed.

I updated the code to check for 2 runtime functions, but this requires including hard-coded runtime strings. Do you have any better ideas/suggestions?

Since the strings are used in other places (e.g., PreISelIntrinsicLowering.cpp) too, you could place them in a header in llvm/IR or llvm/Analysis. But I think it's okay to do so in a separate patch.

ahatanak accepted this revision.Dec 13 2021, 1:01 PM
This revision is now accepted and ready to land.Dec 13 2021, 1:01 PM
This revision was landed with ongoing or failed builds.Dec 14 2021, 2:53 AM
This revision was automatically updated to reflect the committed changes.