Commit Graph

1682 Commits

Author SHA1 Message Date
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Owen Anderson
d735ee85db Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 03:43:35 +00:00
Owen Anderson
97d4e51df1 Fix a silly bug that Nicholas noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44324 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 03:27:38 +00:00
Owen Anderson
00a6d1448d Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44323 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 02:26:36 +00:00
Nick Lewycky
c54c561c9f Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 22:41:31 +00:00
Chris Lattner
8314a0cd0f simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44295 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:36:49 +00:00
Chris Lattner
ecc0274a54 splice some lines together, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44292 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:34:59 +00:00
Duncan Sands
e4dc717585 Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead!  We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44288 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 19:30:27 +00:00
Chris Lattner
42b5e08e71 Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44286 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 08:46:22 +00:00
Duncan Sands
920653d41e Teach alias analysis about readnone/readonly functions.
Based on a patch by Török Edwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44279 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 21:43:27 +00:00
Nick Lewycky
83bb0055fd Instead of calculating constant factors, calculate the number of trailing
bits. Patch from Wojciech Matyjewicz.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44268 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 07:59:40 +00:00
Nick Lewycky
4ac0e8da4a Create nodes for inline asm so that we don't crash looking for the node later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44267 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 03:07:37 +00:00
Nick Lewycky
6e801dc6c0 Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44249 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 08:44:50 +00:00
Nick Lewycky
cf96db2c1d Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44248 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 08:24:44 +00:00
Tanya Lattner
ee22be064e Fix for PR1801
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44193 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-16 22:44:50 +00:00
Anton Korobeynikov
4e1a0e386c Reverted r44163 per request
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44177 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 18:33:16 +00:00
Nick Lewycky
65e2da3b4d Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEV
is disabled in the sense that it will refuse to create one from a UDiv
instruction, until the code is better tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44163 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 06:30:50 +00:00
Owen Anderson
44a95e06cc More templatization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44158 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 05:00:15 +00:00
Owen Anderson
019b92a70c Start the process of making MachineLoopInfo possible by templating Loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44097 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 02:33:58 +00:00
Chris Lattner
9907cb12ae Fix PR1774 and BasicAA/2007-11-05-SizeCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 05:58:42 +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
Dan Gohman
9962054775 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 19:52:04 +00:00
Owen Anderson
ef15029258 Make a comment better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43379 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 03:47:14 +00:00
Hartmut Kaiser
081fdf238b Silenced a VC++ warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43374 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 23:49:14 +00:00
Owen Anderson
f92ff03f71 Fix for PR1741.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43326 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 02:36:18 +00:00
Owen Anderson
d20cc14dbf Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43259 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-23 20:58:37 +00:00
Dan Gohman
246b2564d3 Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43224 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-22 18:31:58 +00:00
Owen Anderson
49b653aa6a Template DominatorTreeBase by node type. This is the next major step towards
having dominator information on MBB's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43036 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 19:59:25 +00:00
Gordon Henriksen
c0491ac8b6 Bindings for the verifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 21:00:36 +00:00
Owen Anderson
9cb7f49ee9 Completely merge the implementation details of DomTree and PostDomTree.
Also, add a FIXME for a bug in PostDomTree calculation I noticed while writing this,


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42593 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 21:25:45 +00:00
Dan Gohman
cb406c2597 Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42585 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 19:26:29 +00:00
Owen Anderson
471ab54df7 Factor some code from the DomTree and PostDomTree calculate methods up into
each one's runOnFunction method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42563 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 03:20:17 +00:00
Dale Johannesen
9ab7fb3ba4 Rewrite sqrt and powi to use anyfloat. By popular demand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02 17:43:59 +00:00
Owen Anderson
ab528fe0fb Template-ize more of the DomTree internal implementation details. Only the calculate() methods for DomTree and PostDomTree remain to be merged/template-ized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42476 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 04:17:16 +00:00
Chris Lattner
be207738d3 Add a new DenseSet abstraction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 00:47:20 +00:00
Daniel Berlin
336c6c0486 Switch to densemap rather than std::set
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42462 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-29 00:50:40 +00:00
Owen Anderson
2824121cf1 Remove unneeded #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42428 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 01:25:07 +00:00
Owen Anderson
303f47b1dd Have PostDomTree use the newly templated DFSPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42427 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 01:23:47 +00:00
Dale Johannesen
317096ab37 Add sqrt and powi intrinsics for long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42423 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 01:08:20 +00:00
Daniel Berlin
c7a12ae24a Ignore redundant constraints
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42397 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 15:42:23 +00:00
Nick Lewycky
9a2f93121b Build the correct range for loops with unusual bounds. Fix from Jay Foad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 14:12:54 +00:00
Duncan Sands
2a3876d885 Add a newline to the end of this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42314 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 20:08:48 +00:00
Bill Wendling
cab5f5d269 Don't execute dump unless NDEBUG isn't defined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 22:43:48 +00:00
Daniel Berlin
e6f0479aee Comment fixups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42279 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 22:20:45 +00:00
Daniel Berlin
d81ccc2806 Implement offline variable substitution in order to reduce memory
and time usage.
Fixup operator == to make this work, and add a resize method to DenseMap
so we can resize our hashtable once we know how big it should be.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42269 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 19:45:49 +00:00
Owen Anderson
68099d58cb Merge significant portions of the DomTree and PostDomTree implementations.
The two remaining unmerged parts are DFSPass, and the Calculate().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42255 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 02:29:29 +00:00
Owen Anderson
04fa569320 Factor the calculation details for PostDomTree out of PostDominators.cpp and
into a separate header file.

Next step: merging PostDominatorCalculation.h with DominatorCalculation.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42251 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-23 22:21:00 +00:00
Owen Anderson
ce4d88aa64 Add partial caching of non-local memory dependence queries. This provides a modest
speedup for GVN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42185 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 03:53:52 +00:00
Owen Anderson
742f9b6682 Add a flag to mark a dirty cache entry. This is not yet used, but will eventually
help non-local memdep caching.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42137 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 16:13:57 +00:00
Devang Patel
0f2fb60a18 ooops...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42118 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 23:58:14 +00:00