Commit Graph

1660 Commits

Author SHA1 Message Date
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner a087a8d2ce remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Gordon Henriksen 34eb6d877e Adding bindings for memory buffers and module providers. Switching
to exceptions rather than variants for error handling in Ocaml.

llvm-svn: 45226
2007-12-19 22:30:40 +00:00
Dan Gohman 8a332b235d Add explicit keywords, and fix a minor typo that they uncovered.
llvm-svn: 45034
2007-12-14 15:41:34 +00:00
Wojciech Matyjewicz 86d51b896e Make these loops follow GetGEPOperands() behavior.
Let: %q = GEP %p, X, ...
If %p is a GEP, we can chase baseptr further, only if X==0.

llvm-svn: 44999
2007-12-13 16:22:58 +00:00
Duncan Sands 9ab0943b86 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).

llvm-svn: 44937
2007-12-12 16:01:40 +00:00
Chris Lattner b3ba3d9827 Fix a bug in my previous patch, thanks to Jay Foad for
pointing this out and correcting the patch!

llvm-svn: 44907
2007-12-12 03:56:54 +00:00
Daniel Berlin 0af43a1895 Changes from Curtis Dunham implementing lazy cycle detection algorithm.
Changes from me implementing different way of representing points-to anything.
Changes from me that improve slightly on LCD.

llvm-svn: 44895
2007-12-12 00:37:04 +00:00
Chris Lattner 6a6b3fb62b Implement constant folding if vector<->vector bitcasts where the number
of source/dest elements changes.  This implements
test/Transforms/InstCombine/bitcast-vector-fold.ll

llvm-svn: 44855
2007-12-11 07:29:44 +00:00
Chris Lattner d2265b45ae Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe.  While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".

llvm-svn: 44817
2007-12-10 22:53:04 +00:00
Chris Lattner 3f42d12072 Fix PR1782, patch by Wojtek Matyjewicz!
llvm-svn: 44733
2007-12-09 07:35:13 +00:00
Owen Anderson 086b2c4537 Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
to make such problems easier to diagnose in the future, written by Duncan Sands.

llvm-svn: 44695
2007-12-08 01:37:09 +00:00
Duncan Sands abba5e218c 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.

llvm-svn: 44626
2007-12-05 21:03:28 +00:00
Duncan Sands 38ef3a8ec7 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).

llvm-svn: 44544
2007-12-03 20:06:50 +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
Chris Lattner 907703cecd chain update requests properly.
llvm-svn: 44460
2007-11-30 18:52:58 +00:00
Duncan Sands 5208d1ab4a Add some convenience methods for querying attributes, and
use them.

llvm-svn: 44403
2007-11-28 17:07:01 +00:00
Duncan Sands ad0ea2d430 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.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Owen Anderson b0dd27ee91 Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
llvm-svn: 44348
2007-11-27 03:43:35 +00:00
Owen Anderson 7cad745d49 Fix a silly bug that Nicholas noticed.
llvm-svn: 44324
2007-11-26 03:27:38 +00:00
Owen Anderson 4f833c7610 Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
llvm-svn: 44323
2007-11-26 02:26:36 +00:00
Nick Lewycky cdb7e54ca7 Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
llvm-svn: 44319
2007-11-25 22:41:31 +00:00
Chris Lattner 69ec1ec86a simplify some code.
llvm-svn: 44295
2007-11-23 22:36:49 +00:00
Chris Lattner 7514abe56e splice some lines together, no functionality change.
llvm-svn: 44292
2007-11-23 22:34:59 +00:00
Duncan Sands 8a3e9d2bee 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.

llvm-svn: 44288
2007-11-23 19:30:27 +00:00
Chris Lattner a8fbde3f78 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.

llvm-svn: 44286
2007-11-23 08:46:22 +00:00
Duncan Sands 38a5e82ef4 Teach alias analysis about readnone/readonly functions.
Based on a patch by Török Edwin.

llvm-svn: 44279
2007-11-22 21:43:27 +00:00
Nick Lewycky 3783b46f9e Instead of calculating constant factors, calculate the number of trailing
bits. Patch from Wojciech Matyjewicz.

llvm-svn: 44268
2007-11-22 07:59:40 +00:00
Nick Lewycky 016547d226 Create nodes for inline asm so that we don't crash looking for the node later.
llvm-svn: 44267
2007-11-22 03:07:37 +00:00
Nick Lewycky 74a26e3750 Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. No functionality change.

llvm-svn: 44249
2007-11-20 08:44:50 +00:00
Nick Lewycky 5b18bd3368 Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
llvm-svn: 44248
2007-11-20 08:24:44 +00:00
Tanya Lattner 1db762ba63 Fix for PR1801
llvm-svn: 44193
2007-11-16 22:44:50 +00:00
Anton Korobeynikov 6a7ddfdb8f Reverted r44163 per request
llvm-svn: 44177
2007-11-15 18:33:16 +00:00
Nick Lewycky fbb24817cc 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.

llvm-svn: 44163
2007-11-15 06:30:50 +00:00
Owen Anderson 1b74a9a628 More templatization.
llvm-svn: 44158
2007-11-15 05:00:15 +00:00
Owen Anderson 9306de0727 Start the process of making MachineLoopInfo possible by templating Loop.
llvm-svn: 44097
2007-11-14 02:33:58 +00:00
Chris Lattner 0fc613b85d Fix PR1774 and BasicAA/2007-11-05-SizeCrash.ll
llvm-svn: 43756
2007-11-06 05:58:42 +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 1961c28d46 Add explicit keywords.
llvm-svn: 43464
2007-10-29 19:52:04 +00:00
Owen Anderson b7971bbdd7 Make a comment better.
llvm-svn: 43379
2007-10-26 03:47:14 +00:00
Hartmut Kaiser 1207cd6b1b Silenced a VC++ warning.
llvm-svn: 43374
2007-10-25 23:49:14 +00:00
Owen Anderson 7827a3f366 Fix for PR1741.
llvm-svn: 43326
2007-10-25 02:36:18 +00:00
Owen Anderson 9c614117da Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
llvm-svn: 43259
2007-10-23 20:58:37 +00:00
Dan Gohman a37eaf2bf9 Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.

llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Owen Anderson 4187801f85 Template DominatorTreeBase by node type. This is the next major step towards
having dominator information on MBB's.

llvm-svn: 43036
2007-10-16 19:59:25 +00:00
Gordon Henriksen c3d661a0ee Bindings for the verifier.
llvm-svn: 42707
2007-10-06 21:00:36 +00:00
Owen Anderson 8313e75ea7 Completely merge the implementation details of DomTree and PostDomTree.
Also, add a FIXME for a bug in PostDomTree calculation I noticed while writing this,

llvm-svn: 42593
2007-10-03 21:25:45 +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
Owen Anderson b60f254975 Factor some code from the DomTree and PostDomTree calculate methods up into
each one's runOnFunction method.

llvm-svn: 42563
2007-10-03 03:20:17 +00:00
Dale Johannesen 4d4e77af8e Rewrite sqrt and powi to use anyfloat. By popular demand.
llvm-svn: 42537
2007-10-02 17:43:59 +00:00