Page MenuHomePhabricator

[MS] Emit S_HEAPALLOCSITE debug info

Authored by akhuang on Apr 16 2019, 3:19 PM.



This emits labels around heapallocsite calls and S_HEAPALLOCSITE debug
info in codeview. Currently only changes FastISel, so emitting labels still
needs to be implemented in SelectionDAG.

Event Timeline

akhuang created this revision.Apr 16 2019, 3:19 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 16 2019, 3:19 PM
akhuang updated this revision to Diff 195475.Apr 16 2019, 3:21 PM

remove comment

akhuang updated this revision to Diff 195478.Apr 16 2019, 3:45 PM

more typos

akhuang updated this revision to Diff 195480.Apr 16 2019, 3:58 PM

Fix test case

hans added a comment.Apr 17 2019, 9:59 AM

I don't really know about the functionality here, just adding a few comments on the code itself.


I don't really know this code, but does this also work for void pointers, i.e. the if statement in the old code was unnecessary?


Is it not set with your new code though?


Is the cast necessary? Couldn't the tuple member be made a DIType* in the first place?


Does llc have a "-fast-isel" flag or similar that could be used instead, to make it more clear that it's fast-isel that's significant for the test?


I guess the ModuleID and source_filename are unnecessary, so I'd dro pthem.


Both sets of attributes seem unnecessary so could probably be removed.

akhuang updated this revision to Diff 195783.Apr 18 2019, 10:43 AM
akhuang marked 4 inline comments as done.

Removed extraneous information from test; changed type to DIType

akhuang added inline comments.Apr 18 2019, 10:43 AM

I think getOrCreateType returns null if it gets a void type, so it doesn't quite work for void pointers. In theory we shouldn't be getting void pointers here since the type should be cast to something but that hasn't been implemented yet.


Changed the tuple member to be a DIType.

rnk added inline comments.Apr 18 2019, 1:13 PM

I think in practice void will be pretty common, so I think we want to leave this as it is, and come up with some other workaround in CodeViewDebug.cpp. We can leave this as is and have the CodeViewDebug.cpp code interpret an empty tuple as a void type.

In hindsight, I think this "void is null" convention wasn't such a good idea, since we can't pass it through APIs like Instruction::setMetadata.


I think you could make addCodeViewHeapAllocSite take an MDNode* and then do this cast inside, and if the cast fails, see if it's the special empty tuple that means void, and put a null DIType* in the pointer.

akhuang updated this revision to Diff 195818.Apr 18 2019, 2:52 PM
akhuang marked 2 inline comments as done.
  • Pass void metadata as null DIType
akhuang updated this revision to Diff 195821.Apr 18 2019, 3:08 PM
akhuang marked 2 inline comments as done.
  • Changed test case back to original
akhuang marked an inline comment as done.Apr 18 2019, 3:10 PM
akhuang added inline comments.

I couldn't find a flag that makes llc use fast-isel; it should soon work for both cases though.

rnk accepted this revision.Apr 18 2019, 3:22 PM

lgtm with a minor whitespace issue


Please revert the white space only change to this file.


I guess it's reasonable to treat any non-DIType as "void". The only other reasonable thing to do would be to report an error, but it's not worth it.


FWIW, -O0 is the typical way to enable fast isel in other codegen tests, so even if it's opaque, it's consistent.

This revision is now accepted and ready to land.Apr 18 2019, 3:22 PM
akhuang updated this revision to Diff 195877.Apr 19 2019, 8:34 AM

whitespace fix

This revision was automatically updated to reflect the committed changes.