Page MenuHomePhabricator

[InferAttrs] Mark some library functions as willreturn.
AcceptedPublic

Authored by fhahn on Thu, Jan 14, 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.Thu, Jan 14, 5:59 AM
fhahn requested review of this revision.Thu, Jan 14, 5:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Jan 14, 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.Thu, Jan 14, 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.Thu, Jan 14, 1:51 PM
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
433

Right.

fhahn updated this revision to Diff 316868.Fri, Jan 15, 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.Fri, Jan 15, 1:32 AM

LGTM

This revision is now accepted and ready to land.Fri, Jan 15, 1:32 AM