This is an archive of the discontinued LLVM Phabricator instance.

Add helper func to get first non-alloca position
ClosedPublic

Authored by sebastian-ne on Aug 24 2022, 6:19 AM.

Details

Summary

The LLVM performance tips suggest that allocas should be placed at the
beginning of the entry block. So far, llvm doesn’t provide any helper to
find that position.

Add BasicBlock::getFirstNonPHIOrDbgOrAlloca and IRBuilder::SetInsertPointPastAllocas(Function*)
that get an insert position after the (static) allocas at the start of a
function and use it in ShadowStackGCLowering.

Diff Detail

Event Timeline

sebastian-ne created this revision.Aug 24 2022, 6:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 6:19 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
sebastian-ne requested review of this revision.Aug 24 2022, 6:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 6:19 AM
nhaehnle accepted this revision.Sep 8 2022, 5:02 AM

There is technically a subtle difference in that the loops that are replaced now skip debug instructions as well as allocas. Does this matter in practice? I suspect not. LGTM

This revision is now accepted and ready to land.Sep 8 2022, 5:02 AM
This revision was automatically updated to reflect the committed changes.