This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyLibCalls] Add NoUndef/NonNull/Dereferenceable attributes to iprintf/siprintf
ClosedPublic

Authored by Ka-Ka on Oct 18 2022, 12:41 AM.

Details

Summary

When SimplifyLibCalls fail to optimize printf and sprintf it add
NoUndef/NonNull/Dereferenceable attributes. This patch add the same attributes
if SimplifyLibCalls optimize printf/sprintf into the integer only
iprintf/siprintf.

Diff Detail

Event Timeline

Ka-Ka created this revision.Oct 18 2022, 12:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 12:41 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Ka-Ka requested review of this revision.Oct 18 2022, 12:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 12:41 AM
Ka-Ka retitled this revision from [SimplifyLibCalls] Add NoUndef/NonNull/Dereferenceable attributes to iprintf/isprintf to [SimplifyLibCalls] Add NoUndef/NonNull/Dereferenceable attributes to iprintf/siprintf.Oct 18 2022, 12:52 AM
Ka-Ka edited the summary of this revision. (Show Details)
Ka-Ka added a reviewer: bjope.
nikic added a subscriber: nikic.Oct 18 2022, 12:57 AM
nikic added inline comments.
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
3039–3040

Can we just move this call higher up?

Ka-Ka updated this revision to Diff 468446.Oct 18 2022, 1:14 AM
Ka-Ka marked an inline comment as done.

Moved call annotateNonNullNoUndefBasedOnAccess()

Ka-Ka added a reviewer: nikic.Oct 18 2022, 1:16 AM
nikic accepted this revision.Oct 18 2022, 6:30 AM

LGTM. Ideally we'd annotate these independently of the transform, but this change is fine in itself.

This revision is now accepted and ready to land.Oct 18 2022, 6:30 AM
This revision was landed with ongoing or failed builds.Oct 18 2022, 7:37 AM
This revision was automatically updated to reflect the committed changes.