This is an archive of the discontinued LLVM Phabricator instance.

[MSAN] Convert ActualFnStart to be a particular Instruction *, not BB
ClosedPublic

Authored by guiand on Aug 14 2020, 11:27 AM.

Details

Summary
This allows us to add addtional instrumentation before the function start,
without splitting the first BB. Removes the BB splitting for KMSAN's prologue.

Diff Detail

Event Timeline

guiand created this revision.Aug 14 2020, 11:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2020, 11:27 AM
guiand requested review of this revision.Aug 14 2020, 11:27 AM
guiand added a reviewer: vitalybuka.
eugenis added inline comments.Aug 14 2020, 12:04 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
1085–1086

Could you also change insertKmsanPrologue to get rid of BB splitting?
I'm thinking set ActualFnStart = F.getEntryBlock().getFirstNonPHI() in advance, then simply insert all the KMSan stuff into IRBuilder<>(ActualFnStart).

guiand updated this revision to Diff 285750.Aug 14 2020, 1:29 PM
guiand edited the summary of this revision. (Show Details)

Remove BB splitting for KMSAN

eugenis accepted this revision.Aug 14 2020, 1:48 PM

LGTM

This revision is now accepted and ready to land.Aug 14 2020, 1:48 PM
guiand updated this revision to Diff 285755.Aug 14 2020, 2:00 PM

Move removeUnreachableBlocks before inserting the prologue. This makes sure there's no issue with the ActualFnStart instruction being deleted before the visitor loop.

eugenis accepted this revision.Aug 14 2020, 2:38 PM

LGTM++