Commit Graph

44 Commits

Author SHA1 Message Date
Juergen Ributzka
b2bd7e89e6 [TBAA] Fix handling of mixed TBAA (path-aware and non-path-aware TBAA).
This fix simply ensures that both metadata nodes are path-aware before
performing path-aware alias analysis.

This issue isn't normally triggered in LLVM, because we perform an autoupgrade
of the TBAA metadata to the new format when reading in LL or BC files. This
issue only appears when a client creates the IR manually and mixes old and new
TBAA metadata format.

This fixes <rdar://problem/16760860>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207923 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-03 22:32:52 +00:00
Nuno Lopes
07f099b867 remove some dead code
lib/Analysis/IPA/InlineCost.cpp         |   18 ------------------
 lib/Analysis/RegionPass.cpp             |    1 -
 lib/Analysis/TypeBasedAliasAnalysis.cpp |    1 -
 lib/Transforms/Scalar/LoopUnswitch.cpp  |   21 ---------------------
 lib/Transforms/Utils/LCSSA.cpp          |    2 --
 lib/Transforms/Utils/LoopSimplify.cpp   |    6 ------
 utils/TableGen/AsmWriterEmitter.cpp     |   13 -------------
 utils/TableGen/DFAPacketizerEmitter.cpp |    7 -------
 utils/TableGen/IntrinsicEmitter.cpp     |    2 --
 9 files changed, 71 deletions(-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206506 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 22:26:44 +00:00
Craig Topper
570e52c6f1 [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 04:59:12 +00:00
Craig Topper
c37e6c0734 [C++11] Add 'override' keyword to virtual methods that override their base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202945 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 07:30:04 +00:00
Manman Ren
11d78777d5 TBAA: fix PR17620.
We can have a struct type with a single field and the field does not start
with 0. In that case, we should correctly update the offset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193137 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 01:40:25 +00:00
Manman Ren
e5f32cf320 TBAA: try to fix the dragonegg bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191585 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-27 22:59:21 +00:00
Manman Ren
9e81c3bdb2 TBAA: handle scalar TBAA format and struct-path aware TBAA format.
Remove the command line argument "struct-path-tbaa" since we should not depend
on command line argument to decide which format the IR file is using. Instead,
we check the first operand of the tbaa tag node, if it is a MDNode, we treat
it as struct-path aware TBAA format, otherwise, we treat it as scalar TBAA
format.

When clang starts to use struct-path aware TBAA format no matter whether
struct-path-tbaa is no, and we can auto-upgrade existing bc files, the support
for scalar TBAA format can be dropped.

Existing testing cases are updated to use the struct-path aware TBAA format.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191538 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-27 18:34:27 +00:00
Manman Ren
0b3d39235a TBAA: add isTBAAVtableAccess to MDNode so clients can call the function
instead of having its own implementation.

The implementation of isTBAAVtableAccess is in TypeBasedAliasAnalysis.cpp
since it is related to the format of TBAA metadata.

The path for struct-path tbaa will be exercised by
test/Instrumentation/ThreadSanitizer/read_from_global.ll, vptr_read.ll, and
vptr_update.ll when struct-path tbaa is on by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190216 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-06 22:47:05 +00:00
Manman Ren
a5b314c27a Struct-path aware TBAA: change the format of TBAAStructType node.
We switch the order of offset and field type to make TBAAStructType node
(name, parent node, offset) similar to scalar TBAA node (name, parent node).
TypeIsImmutable is added to TBAAStructTag node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180654 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 00:26:11 +00:00
Manman Ren
2ff97832e5 Struct-path aware TBAA: update getMostGenericTBAA
The tag is of type TBAANode when flag EnableStructPathTBAA is off.

Move implementation of MDNode::getMostGenericTBAA to TypeBasedAliasAnalysis.cpp
since it depends on how to interprete the MDNodes for scalar TBAA and
struct-path aware TBAA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180068 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 23:00:44 +00:00
Manman Ren
4df1854f26 Aliasing rules for struct-path aware TBAA.
Added PathAliases to check if two struct-path tags can alias.
Added command line option -struct-path-tbaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179337 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11 23:24:18 +00:00
Chandler Carruth
0b8c9a80f2 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 11:36:10 +00:00
Chandler Carruth
d04a8d4b33 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. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 16:50:05 +00:00
Chris Lattner
7a2bdde0a0 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
Jay Foad
562b84b3ae Don't include Operator.h from InstrTypes.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 09:35:34 +00:00
Dan Gohman
326faecc35 Update a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 02:55:10 +00:00
Dan Gohman
d67ca9de89 Enable TBAA by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 23:58:44 +00:00
Dan Gohman
c9d8a75e44 Re-disable TBAA for now; it broke MultiSource/Applications/JM/lencod,
at least.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 11:21:08 +00:00
Dan Gohman
b238536ada Enable TBAA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 06:20:01 +00:00
Dan Gohman
42c31a7073 Make ModRefBehavior a lattice. Use this to clean up AliasAnalysis
chaining and simplify FunctionAttrs' GetModRefBehavior logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118660 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 01:02:18 +00:00
Dan Gohman
a8598bec28 Implement getModRefBehavior for TypeBasedAliasAnalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 17:10:22 +00:00
Dan Gohman
a25e5dbcc2 Extend the AliasAnalysis::pointsToConstantMemory interface to allow it
to optionally look for constant or local (alloca) memory.

Teach BasicAliasAnalysis::pointsToConstantMemory to look through Select
and Phi nodes, and to support looking for local memory.

Remove FunctionAttrs' PointsToLocalOrConstantMemory function, now that
AliasAnalysis knows all the tricks that it knew.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118412 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 16:45:26 +00:00
Dan Gohman
87c5c2f069 Support TBAA attachments on calls. This is somewhat experimental.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117317 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-25 21:38:20 +00:00
Dan Gohman
0b2136927d Fix chaining in TBAA's pointsToConstantMemory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-25 21:24:55 +00:00
Dan Gohman
ae92af6771 Only read one bit for testing for a readonly type, leaving the other
bits open for future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-25 20:22:29 +00:00
Dan Gohman
269008ee83 Add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117288 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-25 19:47:25 +00:00
Dan Gohman
ee135131b1 Add some more documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117070 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 21:55:35 +00:00
Dan Gohman
bc078c81e6 Explain what "constant" means here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117053 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 19:45:09 +00:00
Dan Gohman
de38897cfc Update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117048 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 19:01:22 +00:00
Dan Gohman
ba13864483 Factor out the main aliasing check into a separate function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 22:11:14 +00:00
Dan Gohman
0b62f95ea8 Fix comments; the type graph is currently a tree, not a DAG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 22:02:58 +00:00
Owen Anderson
081c34b725 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 17:21:58 +00:00
Dan Gohman
01b58f637c Make TypeBasedAliasAnalysis default to doing nothing, with a command-line
option to enable it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 18:17:47 +00:00
Dan Gohman
acf50f5136 Use chaining in TypeBasedAliasAnalysis::pointsToConstantMemory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116721 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 18:10:31 +00:00
Dan Gohman
c05d8aa6db Tolerate a null parent pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116533 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 22:55:57 +00:00
Dan Gohman
633e702317 Support AA chaining.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 23:39:34 +00:00
Owen Anderson
ce665bd2e2 Now with fewer extraneous semicolons!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 22:25:06 +00:00
Dan Gohman
e6291ae96e Convert TBAA to use the new TBAATag field of AliasAnalysis::Location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113892 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 23:28:12 +00:00
Dan Gohman
b2143b6247 Remove the experimental AliasAnalysis::getDependency interface, which
isn't a good level of abstraction for memdep. Instead, generalize
AliasAnalysis::alias and related interfaces with a new Location
class for describing a memory location. For now, this is the same
Pointer and Size as before, plus an additional field for a TBAA tag.

Also, introduce a fixed MD_tbaa metadata tag kind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 21:25:10 +00:00
Owen Anderson
90c579de5a Reapply r110396, with fixes to appease the Linux buildbot gods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 18:33:48 +00:00
Owen Anderson
1f74590e9d Revert r110396 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 00:23:35 +00:00
Owen Anderson
9ccaf53ada 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 23:42:04 +00:00
Dan Gohman
84b8ad321b Fix a typo Devang noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110115 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 16:48:31 +00:00
Dan Gohman
c182cb5784 Sketch up a preliminary Type-Based Alias Analysis implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 23:11:01 +00:00