This is an archive of the discontinued LLVM Phabricator instance.

[TLI] Unify LibFunc attribute inference. NFCI.
ClosedPublic

Authored by ab on Apr 24 2016, 12:49 PM.

Details

Summary

Now the pass is just a tiny wrapper around the util. This lets us reuse the logic elsewhere (done here for BuildLibCalls) instead of duplicating it.

I put it in BuildLibCalls.h. I think the next step is to have something like getOrInsertLibFunc that also sets the attributes.
I tried having this in TLI itself, but that doesn't feel right for an analysis. I also tried having the analysis return an AttributeSet that users would then apply; I think that's still a little awkward though. Thoughts?

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 54808.Apr 24 2016, 12:49 PM
ab retitled this revision from to [TLI] Unify LibFunc attribute inference. NFCI..
ab updated this object.
ab added reviewers: mehdi_amini, spatel, echristo.
ab added a subscriber: llvm-commits.
mehdi_amini accepted this revision.Apr 26 2016, 11:09 PM
mehdi_amini edited edge metadata.

Skimmed through, you remove a lot of lines, I like it ;)

LGTM.

lib/Transforms/Utils/BuildLibCalls.cpp
742 ↗(On Diff #54808)

Looks like we could refactor all of these under something like TLI::get(M, "strchr")?

This revision is now accepted and ready to land.Apr 26 2016, 11:09 PM
This revision was automatically updated to reflect the committed changes.
ab added a comment.Apr 27 2016, 12:14 PM

Thanks for the reviews!

lib/Transforms/Utils/BuildLibCalls.cpp
742 ↗(On Diff #54808)

Yup, I'm doing that next, separately.