Commit Graph

40 Commits

Author SHA1 Message Date
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Duncan Sands
7915cbee4d Revert r44626, which turned off the use of readonly
and readnone for functions with bodies because it
broke llvm-gcc-4.2 bootstrap.  It turns out that,
because of LLVM's array_ref hack, gcc was computing
pure/const attributes wrong (now fixed by turning
off the gcc ipa-pure-const pass).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44937 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 16:01:40 +00:00
Duncan Sands
5d84afdc83 Commit 44487 broke bootstrap of llvm-gcc-4.2. It is
not yet clear why, but in the meantime work around the
problem by making less use of readnone/readonly info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 21:03:28 +00:00
Duncan Sands
a3355ffb3d Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 20:06:50 +00:00
Duncan Sands
dff6710717 Integrate the readonly/readnone logic more deeply
into alias analysis.  This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter.  These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function.  Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite.  To reduce the
chance of misuse it is now protected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44487 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 07:51:45 +00:00
Duncan Sands
514ab348fd Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment.  This gives a primitive type for
which getTypeSize differed from getABITypeSize.  For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition).  Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type.  For a primitive type, this is the minimum number
of bits.  For an i36 this is 36 bits.  For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it).  For an
i36 this is 40 bits, for an x86 long double it is 80 bits.  This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes).  There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment.  For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS.  This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes).  This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize.  This means that the size of an array
is the length times the getABITypeSize.  It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize.  Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case.  So alloca's and mallocs should use getABITypeSize.  Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases).  I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize.  I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers.  If someone wants to pack these types more
tightly they can always use a packed struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 20:53:16 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
c718288f49 Fix build error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36648 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 20:37:47 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Bill Wendling
0cb83fcab5 Removed unneeded <iostream> #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31810 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-17 07:10:51 +00:00
Reid Spencer
4f1bd9e996 For PR780:
1. Fix the macros in IncludeFile.h to put everything in the llvm namespace
2. Replace the previous explicit mechanism in all the .h and .cpp files
   with the macros in IncludeFile.h
This gets us a consistent mechanism throughout LLVM for ensuring linkage.
Next step is to make sure its used in enough places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28715 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-07 22:00:26 +00:00
Reid Spencer
6df60a9eff For PR780:
Break the "IncludeFile" mechanism into its own header file and adjust other
files accordingly. Use this facility for the IntrinsicInst problem which
was the subject of PR800.
More to follow on this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28709 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-07 20:00:19 +00:00
Reid Spencer
192913e281 Change from using a stub function to a stub variable for passing to the
IncludeFile hack to ensure linkage of analysis passes. This works around
some -pedantic warnings about assigning an object to a function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28621 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-01 07:02:51 +00:00
Misha Brukman
2b37d7cf28 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21416 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:13:18 +00:00
Chris Lattner
8cfd24df54 Make this more efficient by only making one virtual method call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20793 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-23 23:26:58 +00:00
Chris Lattner
d433bde071 Make this a bit more aggressive
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20792 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-23 22:06:41 +00:00
Chris Lattner
5b3a4553c1 Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20649 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-17 15:38:16 +00:00
Chris Lattner
0af024c5d0 Adjust to new alias analysis interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18957 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 07:22:13 +00:00
Chris Lattner
2c20ef506f Properly extern this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18664 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 21:00:59 +00:00
Misha Brukman
47b14a4a6a Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:30:56 +00:00
Reid Spencer
954da37bb4 Add #include <iostream> since Value.h does not #include it any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14622 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 12:19:56 +00:00
Chris Lattner
5a24d70d99 Changes to work with the changes to the AliasAnalysis interface. The -no-aa
class is now in the BasicAliasAnalysis.cpp file


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13684 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:15:48 +00:00
Chris Lattner
992860c44e Deinline some virtual methods, provide better mod/ref answers through the
use of the boolean queries


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12410 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-15 04:07:29 +00:00
Chris Lattner
f4d904d7e3 Improve mod/ref information based on the pointsToConstantMemory method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11021 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-30 22:16:42 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
John Criswell
b576c94c15 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9298 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 19:43:21 +00:00
Chris Lattner
8dcd17c938 Add new -no-aa implementation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5641 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-26 19:57:10 +00:00
Chris Lattner
d501c13b7d Move BasicAA pass out to it's own header file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5640 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-26 19:41:54 +00:00
Chris Lattner
14ac877e0a - Checkin of the alias analysis work:
* Takes into account the size of the memory reference to determine aliasing.
    * Expose mod/ref information in a more consistent way
    * BasicAA can now disambiguate A[i][1] and A[j][2] for conservative request
      sizes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5633 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-26 19:26:51 +00:00
Chris Lattner
762d2f0897 Implement knowledge in BasicAA that &A->field != &A and (P+1) != P
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5519 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-09 19:38:11 +00:00
Chris Lattner
44f340250e - Fix BasicAA to correctly detect the non-aliasness of A[1] & A[2]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5518 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-09 19:27:21 +00:00
Chris Lattner
1dbd1b820f Don't bother counting alias results, allow the AliasAnalysisCounter to do that.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5505 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-07 20:39:48 +00:00
Chris Lattner
dc1ad196e1 Add statistics to basicAA pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5480 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-03 21:16:17 +00:00
Vikram S. Adve
75310d59c9 Make query operations non-const to allow demand-driven analyses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4569 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-06 17:17:55 +00:00
Chris Lattner
a6299345ee * Add capability to recognize alias properties of the following common cases:
- A[c1] cannot alias A[c2] where constants c1 != c2
  - A[i] cannot alias B[j] if A & B are provably different arrays

This should help out array based codes.  For example, from bzip2 from spec,
3 additional loads can be GCSE'd, and _21_ additional loads can be LICMd due
to this change.

In a test example from the Spec GAP benchmark (vecffe.c), this change allows
_52_ additional loads to be GCSE'd and _224_ additional LICM'd loads.

Not bad for such a simple change.  Other testcases show no change at all
because they just don't use arrays.  Not too suprising there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3616 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-08 18:45:18 +00:00
Chris Lattner
04b9025450 Remove unneeded #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3524 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-29 20:08:55 +00:00
Chris Lattner
f9355f636b doxygenize comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3481 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 22:46:39 +00:00
Chris Lattner
22d8cd6143 Add missing #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3467 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 18:57:09 +00:00
Chris Lattner
53ad0edd36 Check-in new alias analysis infrastructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3465 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 18:25:32 +00:00