This is an archive of the discontinued LLVM Phabricator instance.

Migrate SimplifyLibCalls to new OptimizationRemarkEmitter
ClosedPublic

Authored by lenary on Jul 18 2017, 10:18 PM.

Details

Summary

This changes SimplifyLibCalls to use the new OptimizationRemarkEmitter
API.

In fact, as SimplifyLibCalls is only ever called via InstCombine,
(as far as I can tell) the OptimizationRemarkEmitter is added there,
and then passed through to SimplifyLibCalls later.

I have avoided changing any remark text.

This closes PR33787

Diff Detail

Repository
rL LLVM

Event Timeline

lenary created this revision.Jul 18 2017, 10:18 PM
lenary updated this revision to Diff 107304.Jul 19 2017, 7:59 AM

Fixes failing pass manager tests

I also ran clang-format on my changes.

fhahn added a comment.Jul 19 2017, 8:09 AM

LGTM with one comment, but I think it would be good for @anemet to have a look too.

lib/Transforms/InstCombine/InstCombineInternal.h
22 ↗(On Diff #107304)

Is this required? It looks like your are only using references to OptimizationRemarkEmitter in the header file, so the forward declaration at line 46 should be enough.

davide requested changes to this revision.Jul 19 2017, 8:11 AM
davide added a subscriber: davide.

Please add a test exercising this codepath (you can take inspiration from the ones in GVN or LV)

This revision now requires changes to proceed.Jul 19 2017, 8:11 AM
lenary updated this revision to Diff 107312.Jul 19 2017, 8:43 AM
lenary edited edge metadata.

Moves header inclusion based on fhahn's comment

Please add a test exercising this codepath (you can take inspiration from the ones in GVN or LV)

Working on it

lib/Transforms/InstCombine/InstCombineInternal.h
22 ↗(On Diff #107304)

Ah, it's probably not, but without it i'll need one in InstructionCombining.cpp which I missed.

anemet edited edge metadata.Jul 19 2017, 9:22 AM

I have no further comment beyond Florian's and Davide's comments. Thanks for working on this!

Hi @lenary, what's the status of this one?

Thanks,

Davide

Hi @lenary, what's the status of this one?

The status is I need to write a further test and probably update this patch against trunk. I'll do that this evening after work.

lenary updated this revision to Diff 108215.Jul 25 2017, 9:39 PM
  • Fix Failing tests, Run Clang-format
  • Move Header Inclusion
  • Added Test for simplify-lib-calls
lenary updated this revision to Diff 108217.Jul 25 2017, 10:00 PM
lenary marked an inline comment as done.
  • Fix Failing tests, Run Clang-format
  • Move Header Inclusion
  • Added Test for simplify-lib-calls
  • Fix pass manager tests

Ok, I think this is done.

anemet accepted this revision.Jul 25 2017, 10:11 PM

LGTM with a minor request. Thanks!

test/Transforms/Util/libcalls-opt-remarks.ll
1–2 ↗(On Diff #108217)

Please also test this from the new pass manager. See the lines for example in Davide's TailCall patch for the second invocation of opt with -passes=.

lenary updated this revision to Diff 108220.Jul 25 2017, 10:20 PM
lenary marked an inline comment as done.
  • Add test with new PM

This should address your latest comment @anemet

anemet accepted this revision.Jul 25 2017, 10:29 PM

Really minor nit below. No need to upload the patch after this change, just go ahead and land it.

test/Transforms/Util/libcalls-opt-remarks.ll
4–5 ↗(On Diff #108220)

Assuming the old PM stuff will be removed at some point, it would be good to test the YAML output in this case too.

@anemet I don't have commit privileges, and apparently something is broken with -pass-remarks-output=... (when used with -passes=...) in that -pass-remarks-output=- works when i test it at the command line (ie the yaml is printed to stdout), but if i give it a filename, then it doesn't actually leave a file with that name behind. It seems out-of-scope of this commit to trace that issue.

@anemet I don't have commit privileges, and apparently something is broken with -pass-remarks-output=... (when used with -passes=...) in that -pass-remarks-output=- works when i test it at the command line (ie the yaml is printed to stdout), but if i give it a filename, then it doesn't actually leave a file with that name behind. It seems out-of-scope of this commit to trace that issue.

OK, I'll commit it. As discussed, please file a bug for this. Thanks.

fhahn removed a subscriber: fhahn.Jul 26 2017, 11:32 AM
This revision was automatically updated to reflect the committed changes.