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

88 Commits

Author SHA1 Message Date
Craig Topper
783617eba7 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
llvm-svn: 185606
2013-07-04 01:31:24 +00:00
Dan Gohman
6968f40e37 Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp since
it isn't really an AliasAnalysis concept, and ValueTracking has similar things
that it could plausibly share code with some day.

llvm-svn: 174027
2013-01-31 02:40:59 +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
Nick Lewycky
a06ba95c39 Hoist out some work done inside a loop doing a linear scan over all
instructions in a block. GetUnderlyingObject is more expensive than it looks as
it can, for instance, call SimplifyInstruction.

This might have some behavioural changes in odd corner cases, but only because
of some strange artefacts of the original implementation. If you were relying
on those, we can fix that by replacing this with a smarter algorithm. Change
passes the existing tests.

llvm-svn: 166754
2012-10-26 04:43:47 +00:00
Micah Villmow
bb1a25cd67 Move TargetData to DataLayout.
llvm-svn: 165402
2012-10-08 16:38:25 +00:00
Sylvestre Ledru
b77340e506 Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767
llvm-svn: 164768
2012-09-27 10:14:43 +00:00
Sylvestre Ledru
1c5e7904de Fix a typo 'iff' => 'if'
llvm-svn: 164767
2012-09-27 09:59:43 +00:00
Manman Ren
7459dd03a2 JumpThreading: when default destination is the destination of some cases in a
switch, make sure we include the value for the cases when calculating edge
value from switch to the default destination.

rdar://12241132

llvm-svn: 163270
2012-09-05 23:45:58 +00:00
Benjamin Kramer
e09e72a083 Reduce duplicated hash map lookups.
llvm-svn: 162362
2012-08-22 15:37:57 +00:00
Nuno Lopes
52920835c9 make LazyValueInfo analyze the default case of switch statements (we know that in the default branch the value cannot be any of the switch cases)
llvm-svn: 159353
2012-06-28 16:13:37 +00:00
Nuno Lopes
873f05c3ff make LVI::getEdgeValue() always intersect the constraints of the edge with the range of the block. Previously it was only performing the intersection for a few cases, thus losing precision
llvm-svn: 159320
2012-06-28 01:16:18 +00:00
Nuno Lopes
4b9a5ae769 allow LazyValueInfo::getEdgeValue() to reason about multiple edges from the same switch instruction by doing union of ranges (which may still be conservative, but it's more aggressive than before)
llvm-svn: 157071
2012-05-18 21:02:10 +00:00
Nuno Lopes
2b752029f2 minor simplification in the call to ConstantRange constructor
llvm-svn: 157024
2012-05-17 23:04:08 +00:00
Stepan Dyatkovskiy
72fdcabd4d llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.

llvm-svn: 152532
2012-03-11 06:09:17 +00:00
Stepan Dyatkovskiy
79f3dd93b7 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.

llvm-svn: 152297
2012-03-08 07:06:20 +00:00
Benjamin Kramer
2a3719125f LVI: Recognize the form instcombine canonicalizes range checks into when forming constant ranges.
This could probably be made a lot smarter, but this is a common case and doesn't require LVI to scan a lot
of code. With this change CVP can optimize away the "shift == 0" case in Hashing.h that only gets hit when
"shift" is in a range not containing 0.

llvm-svn: 151919
2012-03-02 15:34:43 +00:00
Stepan Dyatkovskiy
856ca370cc SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.
llvm-svn: 149481
2012-02-01 07:49:51 +00:00
Bill Wendling
3820625bc1 Remove dead code.
llvm-svn: 148384
2012-01-18 10:10:28 +00:00
Bill Wendling
771a417c3f A DenseMap of a std::map isn't a very good idea because the "grow()" method will
need to make a deep copy of each of the std::maps. Use a std::map of the
std::map instead. This improves the compile time of sqlite3 by ~2%.

llvm-svn: 148003
2012-01-12 01:41:03 +00:00
Bill Wendling
9974bf8911 Revert r147978. A DenseMap's iterators may become invalidated here.
llvm-svn: 147980
2012-01-11 23:43:34 +00:00
Bill Wendling
e0f4bb054e Use a DenseMap.
This appears to improve sqlite3's compile time by ~2%.

llvm-svn: 147978
2012-01-11 22:57:32 +00:00
Benjamin Kramer
4ff0db784c Clear the new cache.
llvm-svn: 145771
2011-12-03 15:19:55 +00:00
Benjamin Kramer
ed1cd704e0 Add a "seen blocks" cache to LVI to avoid a linear scan over the whole cache just to remove no blocks from the maps.
-15% on ARMDisassembler.cpp (Release build).  It's not that great to add another
layer of caching to the caching-heavy LVI but I don't see a better way.

llvm-svn: 145770
2011-12-03 15:16:45 +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
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
Eli Friedman
05fea3b4a2 llvm.memcpy.* has two distinct associated address spaces; the source address space, and the destination address space. Fix up the interface on MemIntrinsic and MemTransferInst to make this clear, and fix InstructionDereferencesPointer in LazyValueInfo.cpp to use the interface properly.
llvm-svn: 132356
2011-05-31 20:40:16 +00:00
Jay Foad
c146569beb Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Chandler Carruth
af6432924d Mark some functions as used which are used within debug-only code. This
silences Clang's -Wunused-function when building in release mode.

llvm-svn: 129709
2011-04-18 18:49:44 +00:00
Nick Lewycky
708df45c84 Teach LazyValueInfo that allocas aren't NULL. Over all of llvm-test, this saves
half a million non-local queries, each of which would otherwise have triggered a
linear scan over a basic block.

Also fix a fixme for memory intrinsics which dereference pointers. With this,
we prove that a pointer is non-null because it was dereferenced by an intrinsic
112 times in llvm-test.

llvm-svn: 123533
2011-01-15 09:16:12 +00:00
Owen Anderson
ba8ae674d7 Reorder, rename, and document some members to make this easier to follow.
llvm-svn: 122929
2011-01-05 23:26:22 +00:00
Owen Anderson
97bd86a5e7 When computing the value on an edge, in certain cases LVI would fail to compute the value range
in the predecessor block, leading to an incorrect conclusion for the edge value.  Found by inspection.

llvm-svn: 122908
2011-01-05 21:37:18 +00:00
Owen Anderson
3d7ba422df Re-convert several of LazyValueInfo's internal maps to Dense{Map|Set}, and fix the issue in
hasBlockValue() that was causing iterator invalidations.  Many thanks to Dimitry Andric for
tracking down those invalidations!

llvm-svn: 122906
2011-01-05 21:15:29 +00:00
Owen Anderson
308ca4e488 Speculatively revert the use of DenseMap in LazyValueInfo, which may be causing Linux self-host failures.
llvm-svn: 122291
2010-12-20 23:53:19 +00:00
Owen Anderson
b481f13b97 Attempt to appease the DragonEgg buildbots.
llvm-svn: 122288
2010-12-20 23:23:18 +00:00
Owen Anderson
006186c519 Convert one of LVI's primary maps to a DenseMap, now that we know are more assured of iterator stability.
llvm-svn: 122273
2010-12-20 21:30:54 +00:00
Owen Anderson
7a69be36e5 More LVI cleanups, including trying to simplify the process of maintaining the OverDefinedCache.
llvm-svn: 122256
2010-12-20 19:33:41 +00:00
Owen Anderson
2ebd7e9192 Reuse the reference into the LVI cache throughout the solver subsystem. This is much easier to
verify as being safe thanks its recent de-recursivization.

llvm-svn: 122254
2010-12-20 18:18:16 +00:00
Nick Lewycky
44a08d5812 Make LazyValueInfo non-recursive.
llvm-svn: 122120
2010-12-18 01:00:40 +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
Nick Lewycky
44b582fb69 Clean up some of LVI:
* mergeIn now uses constant folding for constants that are provably not-equal.
 * sink some sanity checks from the get*() methods into the mark*() methods, to ensure that we never have a constant/notconstant ConstantInt
 * some textual cleanups, whitespace changes, removing "else" after return, that sort of thing.

llvm-svn: 121877
2010-12-15 18:57:18 +00:00
Owen Anderson
a882a78d4b Take the first step towards making LVI non-recursive: get rid of the LVIQuery abstraction.
llvm-svn: 121357
2010-12-09 06:14:58 +00:00
Owen Anderson
69cbf2e8b7 Now with fewer extraneous semicolons!
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Owen Anderson
6f3516065f It is possible, under specific circumstances involving ptrtoint ConstantExpr's, for LVI to end up trying to merge
a Constant into a ConstantRange.  Handle this conservatively for now, rather than asserting.  The testcase is
more complex that I would like, but the manifestation of the problem is sensitive to iteration orders and the state of the
LVI cache, and I have not been able to reproduce it with manually constructed or simplified cases.

Fixes PR8162.

llvm-svn: 114103
2010-09-16 18:28:33 +00:00
Owen Anderson
e15120e561 Clean up some of the PassRegistry implementation, and pImpl-ize it to reduce #include clutter
and exposing internal details.

llvm-svn: 113252
2010-09-07 19:16:25 +00:00
Nick Lewycky
9698dae1df Add completely hokey binary-and and binary-or operations to ConstantRange and
teach LazyValueInfo to use them.

llvm-svn: 113196
2010-09-07 05:39:02 +00:00
Chris Lattner
8df3ffd7ac zap dead code.
llvm-svn: 113073
2010-09-04 18:12:00 +00:00
Owen Anderson
9161c79ffe Add support for simplifying a load from a computed value to a load from a global when it
is provable that they're equivalent.  This fixes PR4855.

llvm-svn: 112994
2010-09-03 19:08:37 +00:00
Owen Anderson
1abc937731 Remove incorrect and poorly tested code for trying to reason about values on default edges of
switches.  Just return the conservatively correct answer.

llvm-svn: 112876
2010-09-02 22:16:52 +00:00
Owen Anderson
3206920eb2 Fix a bug in LazyValueInfo that CorrelatedValuePropagation exposed: In the LVI lattice, undef and the full set ConstantRange should not
be treated as equivalent.

llvm-svn: 112843
2010-09-02 18:23:58 +00:00