Commit Graph

13 Commits

Author SHA1 Message Date
Michael Kuperstein
86978b73fc [InferAttributes] Don't access parameters that don't exist.
Check for the correct number of parameters before querying their type.
This fixes PR30455.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 23:10:31 +00:00
Andrew Kaylor
2f75f99d2f Recommitting r275284: add support to inline __builtin_mempcpy
Patch by Sunita Marathe

Third try, now following fixes to MSan to handle mempcy in such a way that this commit won't break the MSan buildbots. (Thanks, Evegenii!)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:23:18 +00:00
Andrew Kaylor
e60e6f6702 Reverting r276771 due to MSan failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276824 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 01:19:24 +00:00
Andrew Kaylor
04defbca9e Re-committing r275284: add support to inline __builtin_mempcpy
Patch by Sunita Marathe

Differential Revision: http://reviews.llvm.org/D21920



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 17:23:13 +00:00
Andrew Kaylor
b9ed6a643a Reverting r275284 due to platform-specific test failures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 19:09:16 +00:00
Andrew Kaylor
c949e6e642 Fix for Bug 26903, adds support to inline __builtin_mempcpy
Patch by Sunita Marathe

Differential Revision: http://reviews.llvm.org/D21920



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 17:25:11 +00:00
Ahmed Bougacha
242270d704 [TLI] Also cover Linux 64 libfunc (stat64, ...) prototype checking.
My script missed those in r270750.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270763 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 21:16:33 +00:00
Ahmed Bougacha
c863f71a62 [TLI] Fix NumParams==0 prototype checking typo.
There was a typo in r267758. It caused invalid accesses when
given something like "void @free(...)", as NumParams == 0, and
we then try to look at the 0th parameter.

Turns out, most of these were untested; add both attribute
and missing-prototype checks for all libc libfuncs.

Differential Revision: http://reviews.llvm.org/D20543

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270750 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 20:22:45 +00:00
Ahmed Bougacha
18fc933b03 [InferAttrs] Mark memset_pattern16 params nocapture.
Differential Revision: http://reviews.llvm.org/D19471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 19:04:43 +00:00
David Majnemer
54136ef7b3 [NVPTX] Infer __nvvm_reflect as nounwind, readnone
This patch simply mirrors the attributes we give to @llvm.nvvm.reflect
to the __nvvm_reflect libdevice call.  This shaves about 30% of the code
in libdevice away because of CSE opportunities.  It's also helps us
figure out that libdevice implementations of transcendental functions
don't have side-effects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265060 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31 21:29:57 +00:00
Philip Reames
ef80e8aad9 [BasicAA] Remove special casing of memset_pattern16 in favor of generic attribute inference
Most of the properties of memset_pattern16 can be now covered by the generic attributes and inferred by InferFunctionAttrs.  The only exceptions are:
- We don't yet have a writeonly attribute for the first argument.
- We don't have an attribute for modeling the access size facts encoded in MemoryLocation.cpp.  

Differential Revision: http://reviews.llvm.org/D15879



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 04:53:16 +00:00
Philip Reames
e14c161b0e [MemoryBuiltins] Remove isOperatorNewLike by consolidating non-null inference handling
This patch removes the isOperatorNewLike predicate since it was only being used to establish a non-null return value and we have attributes specifically for that purpose with generic handling. To keep approximate the same behaviour for existing frontends, I added the various operator new like (i.e. instances of operator new) to InferFunctionAttrs. It's not really clear to me why this isn't handled in Clang, but I didn't want to break existing code and any subtle assumptions it might have.

Once this patch is in, I'm going to start separating the isAllocLike family of predicates. These appear to be being used for a mixture of things which should be more clearly separated and documented. Today, they're being used to indicate (at least) aliasing facts, CSE-ability, and default values from an allocation site.

Differential Revision: http://reviews.llvm.org/D15820



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 22:49:23 +00:00
Chandler Carruth
d97964253e [attrs] Extract the pure inference of function attributes into
a standalone pass.

There is no call graph or even interesting analysis for this part of
function attributes -- it is literally inferring attributes based on the
target library identification. As such, we can do it using a much
simpler module pass that just walks the declarations. This can also
happen much earlier in the pass pipeline which has benefits for any
number of other passes.

In the process, I've cleaned up one particular aspect of the logic which
was necessary in order to separate the two passes cleanly. It now counts
inferred attributes independently rather than just counting all the
inferred attributes as one, and the counts are more clearly explained.

The two test cases we had for this code path are both ... woefully
inadequate and copies of each other. I've kept the superset test and
updated it. We need more testing here, but I had to pick somewhere to
stop fixing everything broken I saw here.

Differential Revision: http://reviews.llvm.org/D15676

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-27 08:41:34 +00:00