1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

60 Commits

Author SHA1 Message Date
Dan Gohman
7eac0c2694 Change GetPointerBaseWithConstantOffset's DataLayout argument from a
reference to a pointer, so that it can handle the case where DataLayout
is not available and behave conservatively.

llvm-svn: 174024
2013-01-31 02:00:45 +00:00
Chandler Carruth
4c1f3c24db 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.

llvm-svn: 171366
2013-01-02 11:36:10 +00:00
Chandler Carruth
a490793037 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. =]

llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Chandler Carruth
15fed97f3e Move the InstVisitor utility into VMCore where it belongs. It heavily
depends on the IR infrastructure, there is no sense in it being off in
Support land.

This is in preparation to start working to expand InstVisitor into more
special-purpose visitors that are still generic and can be re-used
across different passes. The expansion will go into the Analylis tree
though as nothing in VMCore needs it.

llvm-svn: 168972
2012-11-30 03:08:41 +00:00
Chandler Carruth
76f7f4a33e 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.
llvm-svn: 167221
2012-11-01 08:07:29 +00:00
Micah Villmow
521311700f 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.

llvm-svn: 166578
2012-10-24 15:52:52 +00:00
Micah Villmow
bb1a25cd67 Move TargetData to DataLayout.
llvm-svn: 165402
2012-10-08 16:38:25 +00:00
Duncan Sands
751f9472f2 Ignore apparent buffer overruns on external or weak globals. This is a major
source of false positives due to globals being declared in a header with some
kind of incomplete (small) type, but the actual definition being bigger.

llvm-svn: 164912
2012-09-30 07:30:10 +00:00
Duncan Sands
3e1f8917ba Teach the 'lint' sanity checking pass to detect simple buffer overflows.
llvm-svn: 164671
2012-09-26 07:45:36 +00:00
Duncan Sands
45a436ffcb Change the way the lint sanity checking pass detects misaligned memory accesses.
Previously it was only be able to detect problems if the pointer was a numerical
value (eg inttoptr i32 1 to i32*), but not if it was an alloca or globa.  The
reason was the use of ComputeMaskedBits: imagine you have "alloca i8, align 2",
and ask ComputeMaskedBits what it knows about the bits of the alloca pointer.
It can tell you that the bottom bit is known zero (due to align 2) but it can't
tell you that bit 1 is known one.  That's because the address could be an even
multiple of 2 rather than an odd multiple, eg it might be a multiple of 4.  Thus
trying to use KnownOne is ineffective in the case of an alloca as it will never
have any bits set.  Instead look explicitly for constant offsets from allocas
and globals.

llvm-svn: 164595
2012-09-25 10:00:49 +00:00
Rafael Espindola
88a1aeb123 Always compute all the bits in ComputeMaskedBits.
This allows us to keep passing reduced masks to SimplifyDemandedBits, but
know about all the bits if SimplifyDemandedBits fails. This allows instcombine
to simplify cases like the one in the included testcase.

llvm-svn: 154011
2012-04-04 12:51:34 +00:00
Chad Rosier
fdca220a9e Fix a few more places where TargetData/TargetLibraryInfo is not being passed.
Add FIXMEs to places that are non-trivial to fix.

llvm-svn: 145661
2011-12-02 01:26:24 +00:00
Chad Rosier
49a66381f7 Propagate TargetLibraryInfo throughout ConstantFolding.cpp and
InstructionSimplify.cpp.  Other fixups as needed.
Part of rdar://10500969

llvm-svn: 145559
2011-12-01 03:08:23 +00:00
Chris Lattner
e1fe7061ce land David Blaikie's patch to de-constify Type, with a few tweaks.
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Jay Foad
88fb4f4597 Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.
llvm-svn: 135040
2011-07-13 10:26:04 +00:00
Jay Foad
c29ba4ecd6 PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plus
related tweaks to ExprMapKeyType.

llvm-svn: 129443
2011-04-13 15:22:40 +00:00
Dan Gohman
db0dc19c04 Give GetUnderlyingObject a TargetData, to keep it in sync
with BasicAA's DecomposeGEPExpression, which recently began
using a TargetData. This fixes PR8968, though the testcase
is awkward to reduce.

Also, update several off GetUnderlyingObject's users
which happen to have a TargetData handy to pass it in.

llvm-svn: 124134
2011-01-24 18:53:32 +00:00
Dan Gohman
295ba3ab26 Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of
VMCore.

llvm-svn: 121885
2010-12-15 20:02:24 +00:00
Dan Gohman
1baada041e Update a comment.
llvm-svn: 121727
2010-12-13 22:53:18 +00:00
Dan Gohman
98f5b2ae22 Use PartialAlias to do better noalias lint checking.
llvm-svn: 121514
2010-12-10 20:04:06 +00:00
Duncan Sands
a5bd3ff0e4 Now that hasConstantValue has been made simpler, it may return the
phi node itself if it occurs in an unreachable basic block.  Protect
against this.  Hopefully this will fix some more buildbots.

llvm-svn: 119493
2010-11-17 10:23:23 +00:00
Duncan Sands
d3c1ca1f00 Previously SimplifyInstruction could report that an instruction
simplified to itself (this can only happen in unreachable blocks).
Change it to return null instead.  Hopefully this will fix some
buildbot failures.

llvm-svn: 119490
2010-11-17 08:35:29 +00:00
Duncan Sands
48517dac03 Fix a layering violation: hasConstantValue, which is part of the PHINode
class, uses DominatorTree which is an analysis.  This change moves all of
the tricky hasConstantValue logic to SimplifyInstruction, and replaces it
with a very simple literal implementation.  I already taught users of
hasConstantValue that need tricky stuff to use SimplifyInstruction instead.
I didn't update InlineFunction because the IR looks like it might be in a
funky state at the point it calls hasConstantValue, which makes calling
SimplifyInstruction dangerous since it can in theory do a lot of tricky
reasoning.  This may be a pessimization, for example in the case where
all phi node operands are either undef or a fixed constant.

llvm-svn: 119459
2010-11-17 04:30:22 +00:00
Dan Gohman
b68f197748 Avoid calling alias on non-pointer values.
llvm-svn: 118822
2010-11-11 19:23:51 +00:00
Dan Gohman
befe1767ff Reapply r116831 and r116839, converting AliasAnalysis to use
uint64_t, plus fixes for places I missed before.

llvm-svn: 116875
2010-10-19 22:54:46 +00:00
Dan Gohman
de3c49438f Revert r116831 and r116839, which are breaking selfhost builds.
llvm-svn: 116858
2010-10-19 21:06:16 +00:00
Dan Gohman
03f86df2e5 Change AliasAnalysis and its clients to use uint64_t instead of unsigned
for representing object sizes, for consistency with other parts of LLVM.

llvm-svn: 116831
2010-10-19 18:00:02 +00:00
Owen Anderson
46990c17f7 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.

llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Dan Gohman
6e3755905e Consistently use AliasAnalysis::UnknownSize instead of hardcoding ~0u.
llvm-svn: 116815
2010-10-19 17:06:23 +00:00
Owen Anderson
63f757463c Begin adding static dependence information to passes, which will allow us to
perform initialization without static constructors AND without explicit initialization
by the client.  For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve.  I hope to be able to relax
the latter requirement in the future.

llvm-svn: 116334
2010-10-12 19:48:12 +00:00
Owen Anderson
69cbf2e8b7 Now with fewer extraneous semicolons!
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Chris Lattner
8df3ffd7ac zap dead code.
llvm-svn: 113073
2010-09-04 18:12:00 +00:00
Dan Gohman
8ed4d1646e Revert r111058, the lint check for indirectbr successors that aren't
address-taken. This can occur normally, if the code which took the
address got DCEd.

llvm-svn: 111121
2010-08-16 14:39:19 +00:00
Dan Gohman
422c164d8d Add a lint check for an indirectbr destination which has not
had its address taken.

llvm-svn: 111058
2010-08-13 23:56:28 +00:00
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Dan Gohman
e0489ffe8e Add a convenient form of AliasAnalysis::alias for the case where the sizes
are unknown.

llvm-svn: 110090
2010-08-03 00:56:30 +00:00
Dan Gohman
abb2503036 Add a lint check for indirectbr with no successors.
llvm-svn: 110074
2010-08-02 23:06:43 +00:00
Owen Anderson
f8addbb0a1 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Dan Gohman
0af129aa1b Add a lint check for mismatched return types, inspired by PR6944.
llvm-svn: 108162
2010-07-12 18:02:04 +00:00
Dan Gohman
0cea029f14 Add some more TODO comments.
llvm-svn: 107657
2010-07-06 15:23:00 +00:00
Dan Gohman
fa0252225f Add a comment.
llvm-svn: 107656
2010-07-06 15:21:57 +00:00
Dan Gohman
56a2a0fb80 Fix the noalias checking so that it doesn't worry about
an argument aliasing itself. Thanks Duncan!

llvm-svn: 105288
2010-06-01 20:51:40 +00:00
Dan Gohman
fe69bf7b4c Add lint checks for function attributes.
llvm-svn: 105009
2010-05-28 21:43:57 +00:00
Dan Gohman
a20b0d02e6 Fix lint's memcpy and memmove checks, and its basic block traversal.
llvm-svn: 104970
2010-05-28 17:44:00 +00:00
Dan Gohman
9a50a9215c Detect self-referential values.
llvm-svn: 104957
2010-05-28 16:45:33 +00:00
Dan Gohman
8570c1a249 Eli pointed out that va_arg instruction result values don't
reference the stack.

llvm-svn: 104951
2010-05-28 16:34:49 +00:00
Dan Gohman
7981165281 Teach lint how to look through simple store+load pairs and other
effective no-op constructs, to make it more effective on
unoptimized IR.

llvm-svn: 104950
2010-05-28 16:21:24 +00:00
Dan Gohman
a6c568fa77 Add a lint check for returning the address of stack memory.
llvm-svn: 104936
2010-05-28 04:33:42 +00:00