History log of /external/llvm/lib/Analysis/MemoryBuiltins.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
5e1d0d39db5fefe013f58c124a94694f96bce2f1 24-Oct-2013 Nuno Lopes <nunoplopes@sapo.pt> fix PR17635: false positive with packed structures
LLVM optimizers may widen accesses to packed structures that overflow the structure itself, but should be in bounds up to the alignment of the object

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
cee51c48030f37133ad4004d3e5c14d8ebfc91c4 03-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Rename DataLayout variables TD -> DL

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191927 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2f0843321016091dca890c819741e06f11ceb390 29-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> ObjectSizeOffsetEvaluator: Don't run into infinite recursion if we have a cyclic GEP.

Those can occur in dead code. PR17402.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191644 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
09b16f3bb5e2b4194268866e1e8c969335a7aec6 24-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> MemoryBuiltins: Remove posix_memalign from the list and replace it with a TODO.

This code isn't ready to deal with allocation functions where the return is not
the allocated pointer. The checks below will reject posix_memalign anyways.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
d44f9f2ff88cd03e3f944ecdd6373737d5acdb90 24-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> MemoryBuiltins: Reinstate optimizing (uninitialized) loads from operator new.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
989779ccc746eb7d7ab4774f25d7a3e1be14923e 24-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> MemoryBuiltins: Fix operator new bits.

We really don't want to optimize malloc return value checks away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
6629210aaf9d2e4fcbecc80b35f72108304da4b4 24-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> Teach MemoryBuiltins and InstructionSimplify that operator new never returns NULL.

This is safe per C++11 18.6.1.1p3: [operator new returns] a non-null pointer to
suitably aligned storage (3.7.4), or else throw a bad_alloc exception. This
requirement is binding on a replacement version of this function.

Brings us a tiny bit closer to eliminating more vector push_backs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
72c8331ec1437f8c33fff1dac1ea0ebb11009411 22-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Treat nothrow forms of ::operator delete and ::operator delete[] as
deallocation functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2253a2f52f3c46ae75cd05f5885acb987bd1d6b6 27-Jun-2013 Michael Gottesman <mgottesman@apple.com> Added support for the Builtin attribute.

The Builtin attribute is an attribute that can be placed on function call site that signal that even though a function is declared as being a builtin,

rdar://problem/13727199

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
eb351eb84945c64212b5e8582c09394542a7cc69 16-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Respect the 'nobuiltin' attribute when determining if a call is to a memory builtin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
8e4df489d0e02e0fbdd00ed829e70e5f21998162 09-Apr-2013 Nadav Rotem <nrotem@apple.com> Revert r176408 and r176407 to address PR15540.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179111 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
e43e2d8cf0a5a05a1d1ed5abbc2134834a9b06d2 09-Apr-2013 Nadav Rotem <nrotem@apple.com> Revert 179071 because it is not the right way to support non standard new/new[] operators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
0a9b452aa457ef911e5a6c327ae4b5596df55bca 09-Apr-2013 Nadav Rotem <nrotem@apple.com> c++ new operators are not malloc-like functions because they do not return uninitialized memory.
Users may overide new-operators and implement any function that they like.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
cacf97107972d0c9d29d14b8d67183c998d17d94 08-Mar-2013 Michael Ilseman <milseman@apple.com> Early exit from getAllocationData() and isFreeCall() for intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
9333ffb6db95e8ec2e34d2013c4fee47cecc8e91 08-Mar-2013 Michael Ilseman <milseman@apple.com> Remove trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
b1b6c170819120e535ef706f58041bb6caebe35d 07-Mar-2013 Jakub Staszak <kubastaszak@gmail.com> Simplify code. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176646 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
a9cd5164c404905a8109da5bfedea9d68960990d 07-Mar-2013 Jakub Staszak <kubastaszak@gmail.com> Change NULL to 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
b443a0aeac38e6fdce063224dfc746c269b0779d 02-Mar-2013 Nuno Lopes <nunoplopes@sapo.pt> recommit r172363 & r171325 (reverted in r172756)
This adds minimalistic support for PHI nodes to llvm.objectsize() evaluation

fingers crossed so that it does break clang boostrap again..

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2bc689c8461dfbaa4ca9a9cc4ae5bc59cb007329 02-Mar-2013 Nuno Lopes <nunoplopes@sapo.pt> add getUnderlyingObjectSize()
this is similar to getObjectSize(), but doesnt subtract the offset
tweak the BasicAA code accordingly (per PR14988)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
167ede898a6105e05fcd9d2ae5679fbf1744018f 17-Jan-2013 Bill Wendling <isanbard@gmail.com> Reverting r171325 & r172363. This was causing a mis-compile on the self-hosted LTO build bots.

Okay, here's how to reproduce the problem:

1) Build a Release (or Release+Asserts) version of clang in the normal way.

2) Using the clang & clang++ binaries from (1), build a Release (or
Release+Asserts) version of the same sources, but this time enable LTO ---
specify the `-flto' flag on the command line.

3) Run the ARC migrator tests:

$ arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ ./src/tools/clang/test/ARCMT/cxx-rewrite.mm

You'll see that the output isn't correct (the whitespace is off).

The mis-compile is in the function `RewriteBuffer::RemoveText' in the
clang/lib/Rewrite/Core/Rewriter.cpp file. When that function and RewriteRope.cpp
are compiled with LTO and the `arcmt-test' executable is regenerated, you'll see
the error. When those files are not LTO'ed, then the output of the `arcmt-test'
is fine.

It is *really* hard to get a testcase out of this. I'll file a PR with what I
have currently.

--- Reverse-merging r172363 into '.':
U include/llvm/Analysis/MemoryBuiltins.h
U lib/Analysis/MemoryBuiltins.cpp

--- Reverse-merging r171325 into '.':
U test/Transforms/InstCombine/objsize.ll
G include/llvm/Analysis/MemoryBuiltins.h
G lib/Analysis/MemoryBuiltins.cpp




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
29eb2cc00ca0bc4d218c6d034f90becfed999bcb 13-Jan-2013 Nuno Lopes <nunoplopes@sapo.pt> fix compile-time regression report by Joerg Sonnenberger:
cache result of Size/OffsetVisitor to speedup analysis of PHI nodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
0b8c9a80f20772c3793201ab5b251d3520b9cea3 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
0a9ff4cab3a3fc1179c37855717a54ae44a5312e 31-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> recommit r171298 (add support for PHI nodes to ObjectSizeOffsetVisitor). Hopefully with bugs corrected now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
44365353a415d37daae9df53fbf6a91677ed90d3 31-Dec-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert "add support for PHI nodes to ObjectSizeOffsetVisitor"

This reverts r171298. Breaks clang selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2e594fa85c809178ce598a9b4c3a3bf5e0e6a14e 31-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> revert r171306, since we cannot compare APInts with different bitwidths

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
a44766a4dd5783b2acfae83eb0428a19636cdd3a 31-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> minor code simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
41be2fb1f9e9b8f796effb81c2bee6cf397136cf 31-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> add support for GlobalAlias to ObjectSizeOffsetVisitor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
729e602082beee6ce248f6ab7bfdf734fbcf0e37 31-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> add support for PHI nodes to ObjectSizeOffsetVisitor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
98281a20503896349bd152e2dfe87435d3a6aada 30-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> convert a bunch of callers from DataLayout::getIndexedOffset() to GEP::accumulateConstantOffset().
The later API is nicer than the former, and is correct regarding wrap-around offsets (if anyone cares).
There are a few more places left with duplicated code, which I'll remove soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
034b94b17006f51722886b0f2283fb6fb19aca1f 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
ece6c6bb6329748b92403c06ac87f45c43485911 01-Nov-2012 Chandler Carruth <chandlerc@gmail.com> Revert the series of commits starting with r166578 which introduced the
getIntPtrType support for multiple address spaces via a pointer type,
and also introduced a crasher bug in the constant folder reported in
PR14233.

These commits also contained several problems that should really be
addressed before they are re-committed. I have avoided reverting various
cleanups to the DataLayout APIs that are reasonable to have moving
forward in order to reduce the amount of churn, and minimize the number
of commits that were reverted. I've also manually updated merge
conflicts and manually arranged for the getIntPtrType function to stay
in DataLayout and to be defined in a plausible way after this revert.

Thanks to Duncan for working through this exact strategy with me, and
Nick Lewycky for tracking down the really annoying crasher this
triggered. (Test case to follow in its own commit.)

After discussing with Duncan extensively, and based on a note from
Micah, I'm going to continue to back out some more of the more
problematic patches in this series in order to ensure we go into the
LLVM 3.2 branch with a reasonable story here. I'll send a note to
llvmdev explaining what's going on and why.

Summary of reverted revisions:

r166634: Fix a compiler warning with an unused variable.
r166607: Add some cleanup to the DataLayout changes requested by
Chandler.
r166596: Revert "Back out r166591, not sure why this made it through
since I cancelled the command. Bleh, sorry about this!
r166591: Delete a directory that wasn't supposed to be checked in yet.
r166578: Add in support for getIntPtrType to get the pointer type based
on the address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
aa76e9e2cf50af190de90bc778b7f7e42ef9ceff 24-Oct-2012 Micah Villmow <villmow@gmail.com> Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the
clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2fa8af224ea026f9432e833fd6f42a216423a010 09-Oct-2012 Bill Wendling <isanbard@gmail.com> Use the attribute enums to query if a function has an attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
060f20a0fa73d04b871e273fbf7b3e49a3e78b73 09-Oct-2012 Bill Wendling <isanbard@gmail.com> Remove more uses of the attribute enums by supplying appropriate query methods for them.
No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
3574eca1b02600bac4e625297f4ecf745f4c4f32 08-Oct-2012 Micah Villmow <villmow@gmail.com> Move TargetData to DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
8e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6 29-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Make MemoryBuiltins aware of TargetLibraryInfo.

This disables malloc-specific optimization when -fno-builtin (or -ffreestanding)
is specified. This has been a problem for a long time but became more severe
with the recent memory builtin improvements.

Since the memory builtin functions are used everywhere, this required passing
TLI in many places. This means that functions that now have an optional TLI
argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead
mallocs anymore if the TLI argument is missing. I've updated most passes to do
the right thing.

Fixes PR13694 and probably others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
168843c0137ad67c24a3930244a9c5f60add320d 17-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> MemoryBuiltins: Properly guard ObjectSizeOffsetVisitor against cycles in the IR.

The previous fix only checked for simple cycles, use a set to catch longer
cycles too.

Drop the broken check from the ObjectSizeOffsetEvaluator. The BoundsChecking
pass doesn't have to deal with invalid IR like InstCombine does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
823573a38137191678bf1c7194048ab51d39f33c 17-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Guard MemoryBuiltins against self-looping GEPs, which can occur in unreachable code due to constant propagation.

Fixes PR13621.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
e982de7be9e190cc2b0ef70a58bceb87d34b511e 27-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> fix PR13390: do not loop forever with self-referencing self instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
6e699bf38dd862331532bd6f74ec491bdfad5db9 25-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> revert r160742: it's breaking CMake build

original commit msg:
MemoryBuiltins: add support to determine the size of strdup'ed non-constant strings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
e3094283e38d9e6f6a4a7a14a3a5d0f2af67d5d5 25-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> MemoryBuiltins: add support to determine the size of strdup'ed non-constant strings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
9827c8e1c96950d17a4dbb7ef9d9036501c40c1b 24-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> teach objectsize about strdup() and strndup()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
c606c3ff911eddcbf8bab95e67c7d8c1f69a493e 21-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> baby steps toward fixing some problems with inbound GEPs that overflow, as discussed 2 months ago or so.
Make sure we do not emit index computations with NSW flags so that we dont get an undef value if the GEP overflows

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
0dff532fce434c3e9fdf9695aed8efeb5f752ed5 03-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> fold PHI nodes in SizeOffsetEvaluator whenever possible.
Unfortunately this change requires the cache map to hold WeakVHs instead

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
41a3f251346681e21171879dce409b2e6a3ba750 28-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> MemoryBuiltins:
- recognize C++ new(std::nothrow) friends
- ignore ExtractElement and ExtractValue instructions in size/offset analysis (all easy cases are probably folded away before we get here)
- also recognize realloc as noalias

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159356 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
e8742d084c54e9cd230fa03d368f0fedac2106cb 25-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> check for the NoAlias attribute through CallSite

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
d845c34170be5ece8aee3a1097849aa8ce9259cb 22-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> simplify code from previous commits (Thanks Duncan)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
eb7c6865cd8d44a882aa7c3e10e1d976f333344f 22-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> remove extractMallocCallFromBitCast, since it was tailor maded for its sole user. Update GlobalOpt accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2b3e9580536dfb5666b9d91e99baebf6d45bfa5f 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> Add support for invoke to the MemoryBuiltin analysid.
Update comments accordingly.

Make instcombine remove useless invokes to C++'s 'new' allocation function (test attached).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158937 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
ef22f04bad6f5037fd4cc4d144e0c418f6cb2edc 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> fix build in C++11 mode.
Thanks to Chandler for pointing out the problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
034dd6c6a118cf78ebfa6bf3496cd5b0df578a9e 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> hopefully fix the buildbots: some tests have wrong definitions of malloc and were crashing this code on 64 bits machines

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
9e72a79ef4a9fcda482ce0b0e1f0bd6a4f16cffd 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> refactor the MemoryBuiltin analysis:
- provide more extensive set of functions to detect library allocation functions (e.g., malloc, calloc, strdup, etc)
- provide an API to compute the size and offset of an object pointed by

Move a few clients (GVN, AA, instcombine, ...) to the new API.
This implementation is a lot more aggressive than each of the custom implementations being replaced.

Patch reviewed by Nick Lewycky and Chandler Carruth, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
cb348b9b45025393ec5b28eac8bb6773a9b603f6 04-May-2012 Nuno Lopes <nunoplopes@sapo.pt> remove calls to calloc if the allocated memory is not used (it was already being done for malloc)
fix a few typos found by Chad in my previous commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
252ef566e8734b6bcf46434d0a7954c9eda0bd96 03-May-2012 Nuno Lopes <nunoplopes@sapo.pt> add support for calloc to objectsize lowering

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
1db1c239fe1654f174fbddd70e104909d2ad5f5c 23-Nov-2011 Benjamin Kramer <benny.kra@googlemail.com> Validate the return type when checking if a function is malloc.

Fixes PR11426. Not sure if a test case with a "wrong" malloc would be useful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
ebb2189904564c7c6193e7f23904f1ced7975480 18-Jun-2011 Chris Lattner <sabre@nondot.org> simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
1ace169c3d2ffd6596e0533c37df206430e8b707 17-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Add comments for the demanglings. Correct mangled form of operator delete!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
42e72ca3d00dbe073fbb39e181caa7f0c4c171b7 15-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Add C++ global operator {new,new[],delete,delete[]}(unsigned {int,long}) to the
memory builtins as equivalent to malloc/free.

This is different from any attribute we have. For example, you can delete the
allocators when their result is unused, but you can't collapse two calls to the
same function, even if no global/memory state has changed in between. The
noalias return states that the result does not alias any other pointer, but
instcombine optimizes malloc() as though the result is non-null for the purpose
of eliminating unused pointers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
02680f946b8dcbeff3b8d7236030678551b15a6c 23-Jun-2010 Gabor Greif <ggreif@gmail.com> minor enhancement to llvm::isFreeCall API: return CallInst; no functional change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106686 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
e3401c4fae95bc69dada2a3f9080d9f15349af61 23-Jun-2010 Gabor Greif <ggreif@gmail.com> use ArgOperand getters


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106685 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
551754c4958086cc6910da7c950f2875e212f5cf 17-Apr-2010 Eric Christopher <echristo@apple.com> Revert 101465, it broke internal OpenGL testing.

Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
4ec2258ffb495d7ce00177e447740ef1123a27db 16-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
607a7ab3da72a2eb53553a520507cbb8068dd1d8 16-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101423 and r101397, they break llvm-gcc self-host on darwin10

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
2ff961f66816daab8bbc58a19025161d969821c2 15-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
9ee17208115482441953127615231c59a2f4d052 15-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101364, as it trips the linux nightlybot on some clang C++ tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
165dac08d1bb8428b32a5f39cdd3dbee2888987f 15-Apr-2010 Gabor Greif <ggreif@gmail.com> rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
60ad781c61815ca5b8dc2a45a102e1c8af65992f 26-Mar-2010 Gabor Greif <ggreif@gmail.com> rename use_const_iterator to const_use_iterator for consistency's sake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99564 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
f451cb870efcf9e0302d25ed05f4cac6bb494e42 10-Feb-2010 Dan Gohman <gohman@apple.com> Fix "the the" and similar typos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
3dbb9e64d6e9d1e8bf16f75ebe4fe59ffdf93dd3 18-Nov-2009 Dan Gohman <gohman@apple.com> Simplify ComputeMultiple so that it doesn't depend on TargetData.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
8e345a1c418608c49abb7c51a090bbb36f1273bc 10-Nov-2009 Victor Hernandez <vhernandez@apple.com> Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
9d0b704e3ea418441001dac4d1a56c2c224cdbf5 07-Nov-2009 Victor Hernandez <vhernandez@apple.com> Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.

Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
7b550ccfc5a3346c17e0390a59e2d6d19bc52705 06-Nov-2009 Chris Lattner <sabre@nondot.org> remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
df98761d08ae091420b7e9c1366de7684400fc36 06-Nov-2009 Victor Hernandez <vhernandez@apple.com> Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
24f934d0551e33508c4ffd24318ea0e970db9810 05-Nov-2009 Victor Hernandez <vhernandez@apple.com> Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
3ad70d5d61f3f86fb5bc167e157680fc107a1173 03-Nov-2009 Victor Hernandez <vhernandez@apple.com> Changes requested (avoid getFunction(), avoid Type creation via isVoidTy(), and avoid redundant isFreeCall cases) in feedback to r85176

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
88efeaee227a069b3ec3d1b69c918ef31da78a23 03-Nov-2009 Victor Hernandez <vhernandez@apple.com> Changes (* location in pointer variables, avoiding include, and using APInt::getLimitedValue) based on feedback to r85814

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
bc117b83f6f646c55a98a5b408e0b1dfcacc275e 02-Nov-2009 Victor Hernandez <vhernandez@apple.com> Set bit instead of calling pow() to compute 2 << n

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85814 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
438b00b2adf348cdb933d8764335cebd56046abc 02-Nov-2009 Edward O'Callaghan <eocallaghan@auroraux.org> Fix for warning seen on DF-BSD, Victor, please fix this to use a shift instead of pow()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
06ff7505e1ca4bbecc8d95a16160d12972767bc3 29-Oct-2009 Zhongxing Xu <xuzhongxing@gmail.com> fix 80-col.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
8370057f0cbdcd1dc8e8a082eedd150eb993c52e 29-Oct-2009 Zhongxing Xu <xuzhongxing@gmail.com> Explicitly convert to double to suppress Visual C++ 2008 build error C2668 pow is ambiguous call to overloaded function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
90f48e7c91a8faa875ba889ca66b137ffd46e34a 28-Oct-2009 Victor Hernandez <vhernandez@apple.com> Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp
f006b183e2d2bebcf6968d1dd7350397c95b0325 27-Oct-2009 Victor Hernandez <vhernandez@apple.com> Rename MallocFreeHelper as MemoryBuiltins

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/MemoryBuiltins.cpp