This is an archive of the discontinued LLVM Phabricator instance.

[InferAttrs] Mark some library functions as willreturn.
ClosedPublic

Authored by fhahn on Jan 14 2021, 5:59 AM.

Details

Summary

This patch marks some library functions as willreturn. On the first pass, I
excluded most functions that interact with streams/the filesystem.

Along with willreturn, it also adds nounwind to a set of math functions.
There probably are a few additional attributes we can add for those, but
that should be done separately.

Diff Detail

Event Timeline

fhahn created this revision.Jan 14 2021, 5:59 AM
fhahn requested review of this revision.Jan 14 2021, 5:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2021, 5:59 AM

Looks ok.

We also miss noundef on many libcalls, don’t we?

Looks ok.

We also miss noundef on many libcalls, don’t we?

We miss a lot of tings TBH. This week I realized malloc/free are not inaccesible_mem_only, which is not cool.

LGTM as well.

nikic added inline comments.Jan 14 2021, 11:42 AM
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
433

memcpy_chk is spec'd to abort on overflow, so possibly should not be willreturn?

jdoerfert added inline comments.Jan 14 2021, 1:51 PM
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
433

Right.

fhahn updated this revision to Diff 316868.Jan 15 2021, 1:19 AM
fhahn marked an inline comment as done.

Do not infer willreturn for __memcpy_chk.

Looks ok.

We also miss noundef on many libcalls, don’t we?

We miss a lot of tings TBH. This week I realized malloc/free are not inaccesible_mem_only, which is not cool.

Too many things missing to fix at once :(

Seems about reasonable to me.

nikic accepted this revision.Jan 15 2021, 1:32 AM

LGTM

This revision is now accepted and ready to land.Jan 15 2021, 1:32 AM
This revision was automatically updated to reflect the committed changes.