This is an archive of the discontinued LLVM Phabricator instance.

[InferAttrs] Mark frexp and modf as memory(argmem: write)
ClosedPublic

Authored by dwoodwor-intel on Apr 11 2023, 1:16 PM.

Details

Summary

These two math library functions can't write to errno, but they do
produce two results and store the second result to a pointer passed as
their second argument. Appropriately marking them as
memory(argmem: write) enables more optimizations on calls to them.

Diff Detail

Event Timeline

dwoodwor-intel created this revision.Apr 11 2023, 1:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 1:16 PM
dwoodwor-intel requested review of this revision.Apr 11 2023, 1:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 1:16 PM
xbolva00 accepted this revision.Apr 11 2023, 1:21 PM
This revision is now accepted and ready to land.Apr 11 2023, 1:21 PM

I don't have commit access; @xbolva00, can you merge this for me? Please use Daniel Woodworth <daniel.woodworth@intel.com> as my name/email address

It's been a week, so it's time for a review ping.

@xbolva00, does this change needs more approvals? Should I nominate someone else to merge it?

Yes, please, as I would be able to commit it for you only next week.

vitalybuka added inline comments.
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
481–482

this is not true with sanitizers, interceptors may check metadata

Maybe we can add TargetLibraryInfo::hasSanitizer() and use it here

efriedma added inline comments.Aug 2 2023, 4:44 PM
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
481–482

If this is actually an issue, it would impact every libcall we mark with memory attributes; please move the discussion elsewhere (maybe a Discourse thread).