This is an archive of the discontinued LLVM Phabricator instance.

[BuildLibCalls] Noalias annotation
ClosedPublic

Authored by xbolva00 on Aug 14 2019, 5:43 AM.

Details

Summary

I think this is better solution than annotating callsites in IC/SLC.

Diff Detail

Event Timeline

xbolva00 created this revision.Aug 14 2019, 5:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2019, 5:43 AM
xbolva00 updated this revision to Diff 215094.Aug 14 2019, 5:47 AM
xbolva00 updated this revision to Diff 215095.
xbolva00 updated this revision to Diff 215099.Aug 14 2019, 5:57 AM
xbolva00 updated this revision to Diff 215100.Aug 14 2019, 6:02 AM

Added support for sprint, snprintf.

jdoerfert added inline comments.Aug 14 2019, 8:13 AM
lib/Transforms/Utils/BuildLibCalls.cpp
188

This makes sense.

263

I'm not sure what this means or what this is going to help, but maybe I just miss something.

307

Makes sense.

xbolva00 marked an inline comment as done.Aug 14 2019, 8:22 AM
xbolva00 added inline comments.
lib/Transforms/Utils/BuildLibCalls.cpp
263

Target buffer may not overlap with other args.

I can remove it, but some future optimizations based on noalias info would be weaker.

jdoerfert added inline comments.Aug 14 2019, 8:28 AM
lib/Transforms/Utils/BuildLibCalls.cpp
263

I was wrong, if that is the sprintf semantics, keep it.

xbolva00 marked an inline comment as done.Aug 14 2019, 8:41 AM
xbolva00 added inline comments.
lib/Transforms/Utils/BuildLibCalls.cpp
263

Yea :)

man sprintf

Some programs imprudently rely on code such as the following

    sprintf(buf, "%s some further text", buf);

to append text to buf.  However, the standards explicitly note that the
results are undefined if source and destination  buffers  overlap  when
calling  sprintf(), snprintf(), vsprintf(), and vsnprintf()...
This revision is now accepted and ready to land.Aug 14 2019, 9:35 AM
This revision was automatically updated to reflect the committed changes.
test/Other/cgscc-devirt-iteration.ll