This is an archive of the discontinued LLVM Phabricator instance.

Move discriminator assignment to the right place.
ClosedPublic

Authored by danielcdh on Feb 26 2016, 4:23 PM.

Details

Diff Detail

Event Timeline

danielcdh updated this revision to Diff 49264.Feb 26 2016, 4:23 PM
danielcdh retitled this revision from to Move discriminator assignment to the right place..
danielcdh updated this object.
danielcdh added reviewers: dnovillo, davidxl.
danielcdh added a subscriber: llvm-commits.

I'm sure it's probably obvious, but you've not mentioned it here - why is
the "right place" the function, and not the module?

It was mentioned in the FIXME comment I just removed:

  • // FIXME: This seems completely wrong.
  • //
  • // 1. If two modules are generated in the same context, then the second
  • // Module will get different discriminators than it would have if it were
  • // generated in its own context.
  • // 2. If this function is called after round-tripping to bitcode instead of
  • // before, it will give a different (and potentially incorrect!) return.
  • //
  • // The discriminator should instead be calculated from local information
  • // where it's actually needed. This logic should be moved to
  • // AddDiscriminators::runOnFunction(), where it doesn't pollute the
  • // LLVMContext.

Ah, great - thanks! (& I'd read that, but was reading the patch backwards,
as though that comment was being added, looking at it in more detail the
patch does look great/going in the right direction to be sure - will leave
it to Diego or others to sign off on, though)

dnovillo accepted this revision.Feb 29 2016, 10:38 AM
dnovillo edited edge metadata.

LGTM. Thanks for the fix!

This revision is now accepted and ready to land.Feb 29 2016, 10:38 AM
danielcdh closed this revision.Feb 29 2016, 11:04 AM