Commit Graph

65 Commits

Author SHA1 Message Date
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Chris Lattner b0ccc8c8bb Free and vaarg are not really volatile.
llvm-svn: 51407
2008-05-22 03:23:06 +00:00
Chris Lattner b76ad168dc Fix PR2346 by marking vaarg as volatile so that licm doesn't try to
hoist them.

llvm-svn: 51356
2008-05-20 22:05:28 +00:00
Dan Gohman d78c400b5b Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Dan Gohman 79fff7cf85 Fix the way AliasSet::print prints "may alias".
llvm-svn: 50051
2008-04-21 19:48:48 +00:00
Dan Gohman 2cd8e38ab9 Teach AliasSetTracker about VAArgInst.
llvm-svn: 49674
2008-04-14 18:34:50 +00:00
Devang Patel 80e43fa744 Restore isCFGOnly property of various analysis passes.
llvm-svn: 48579
2008-03-20 02:25:21 +00:00
Devang Patel 718da668ab PassInfo keep tracks whether a pass is an analysis pass or not.
llvm-svn: 48554
2008-03-19 21:56:59 +00:00
Devang Patel af75ab8130 Do not use virtual function to identify an analysis pass.
llvm-svn: 48520
2008-03-19 00:48:41 +00:00
Devang Patel 864970e9b6 Identify Analysis pass.
Do not run analysis pass again if analysis info is still available.
This fixes PR1441.

llvm-svn: 48476
2008-03-18 00:39:19 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Duncan Sands 68b6f50938 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.

llvm-svn: 44487
2007-12-01 07:51:45 +00:00
Duncan Sands 44b8721de8 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.

llvm-svn: 43620
2007-11-01 20:53:16 +00:00
Dan Gohman c731c97fac Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().

llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Chris Lattner 688b2807df when merging two alias sets together, be sure to propagate the volatility of
the inner set.  This fixes PR1435 and Transforms/LICM/2007-05-22-VolatileSink.ll

llvm-svn: 37305
2007-05-23 06:36:35 +00:00
Nick Lewycky e7da2d6ac3 Fix typo in comment.
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Devang Patel 8c78a0bff0 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel e95c6ad802 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.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel 09f162ca6a Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Reid Spencer f75727ab14 Make classes in anonymous namespaces use VISIBILITY_HIDDEN to help reduce
LLVM's footprint and speed up linking.

llvm-svn: 33941
2007-02-05 23:42:17 +00:00
Bill Wendling f3baad3ee1 Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.

llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Bill Wendling 597d451fea Removed some of the iostream #includes. Moved towards converting to using
llvm streams

llvm-svn: 31983
2006-11-28 22:46:12 +00:00
Nick Lewycky 241211939d Explain change with a comment.
llvm-svn: 30443
2006-09-17 17:51:00 +00:00
Nick Lewycky c7b465366a Fix PR912. The input to erase() must not be a reference to the data
being erased.

llvm-svn: 30442
2006-09-17 16:23:36 +00:00
Chris Lattner c2d3d3112e eliminate RegisterOpt. It does the same thing as RegisterPass.
llvm-svn: 29925
2006-08-27 22:42:52 +00:00
Chris Lattner 90213c6c18 Handle alias sets that have been unified, and thus can have other references
to them.  This fixes a regression in my previous checkin.

llvm-svn: 28951
2006-06-27 23:56:13 +00:00
Chris Lattner f4e0653b3a Don't implement AliasSetTracker::remove in terms of deleteValue. deleteValue
causes the pointer to be removed from the underlying alias analysis
implementation as well.  This impl of remove is also significantly faster than
the old one.  This fixes:
Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll

llvm-svn: 28950
2006-06-27 23:48:59 +00:00
Chris Lattner e7d4e56961 Fix a stale pointer issue that caused 300.twolf to fail to build on zion
last night.

llvm-svn: 28916
2006-06-26 19:20:48 +00:00
Chris Lattner 44497859f9 Make the -print-alias-sets pass work for printing out something other than
the default aa impl results.

llvm-svn: 25062
2006-01-03 06:05:22 +00:00
Misha Brukman 01808caded Remove trailing whitespace
llvm-svn: 21416
2005-04-21 21:13:18 +00:00
Chris Lattner 8d9f3735cd Treat free operations as volatile, since they cannot be moved. This fixes
Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll

llvm-svn: 20830
2005-03-25 05:49:37 +00:00
Chris Lattner 7b9020a059 Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!

llvm-svn: 20649
2005-03-17 15:38:16 +00:00
Chris Lattner 71d04bce55 Adjust to new alias analysis interfaces
llvm-svn: 18957
2004-12-15 07:22:13 +00:00
Reid Spencer 9083936835 For PR387:\
Make only one print method to avoid overloaded virtual warnings when \
compiled with -Woverloaded-virtual

llvm-svn: 18589
2004-12-07 04:03:45 +00:00
Chris Lattner 24bba4d237 When merging to alias sets, if they are both must alias, the result is not
a must alias set unless all of the pointers in the resultant set are must
aliased together.

llvm-svn: 18275
2004-11-27 18:37:42 +00:00
Chris Lattner eeaa29c377 Add a new interface
llvm-svn: 18266
2004-11-26 21:36:25 +00:00
Chris Lattner 303bdd1e4b Remove dead var
llvm-svn: 17485
2004-11-05 04:52:08 +00:00
Chris Lattner 6fa9665095 Add some assertions
llvm-svn: 16366
2004-09-15 16:59:47 +00:00
Chris Lattner ab64481f1d Implement an AliasSetTracker::copyValue method
llvm-svn: 16344
2004-09-14 19:15:32 +00:00
Misha Brukman 63b38bd2ed Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15334
2004-07-29 17:30:56 +00:00
Chris Lattner 731381dc0e Remove a bogus assertion
llvm-svn: 15261
2004-07-27 07:22:21 +00:00
Chris Lattner 9b323c3521 Use context-sensitive alias analysis to avoid pessimization in clients of
AliasSetTracker (dse and licm).  This implements
DeadStoreElimination/context-sensitive.llx

llvm-svn: 15254
2004-07-27 02:20:26 +00:00
Chris Lattner bf8c3c405e Add some new methods
llvm-svn: 15230
2004-07-26 05:50:23 +00:00
Chris Lattner 0c73a1ff05 Fix a latent bug in the AliasSetTracker that was exposed by the FreeInst additions and broke a bunch of programs last night.
llvm-svn: 15214
2004-07-25 18:32:01 +00:00
Chris Lattner 924c68dcb2 Add support for free instructions
llvm-svn: 15197
2004-07-25 07:57:37 +00:00
Chris Lattner 053427ff4f Clean up reference counting to stop "leaking" alias sets
llvm-svn: 15099
2004-07-22 07:58:18 +00:00
Chris Lattner abc4f4523f Add capability to remove aliasing aliassets from an AST
llvm-svn: 15066
2004-07-21 07:04:26 +00:00
Chris Lattner 2cfaef23e4 Make the AST interface a bit richer by returning whether an insertion caused
an insertion or not (because the pointer set already existed).

llvm-svn: 15064
2004-07-21 05:18:04 +00:00
Reid Spencer eb04d9bcb4 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Chris Lattner 746e1e1808 Rename a method
llvm-svn: 13676
2004-05-23 21:10:58 +00:00