Duncan Sands
d06f50e2db
Have ScalarEvolution use SimplifyInstruction rather than hasConstantValue.
...
While there, add a note about an inefficiency I noticed.
llvm-svn: 119458
2010-11-17 04:18:45 +00:00
Dan Gohman
761065e3b7
Memoize results from ScalarEvolution's getUnsignedRange and getSignedRange.
...
This fixes some extreme compile times on unrolled sha512 code.
llvm-svn: 119455
2010-11-17 02:44:44 +00:00
Duncan Sands
5ffc298bc7
In which I discover the existence of loops. Threading an operation
...
over a phi node by applying it to each operand may be wrong if the
operation and the phi node are mutually interdependent (the testcase
has a simple example of this). So only do this transform if it would
be correct to perform the operation in each predecessor of the block
containing the phi, i.e. if the other operands all dominate the phi.
This should fix the FFMPEG snow.c regression reported by İsmail Dönmez.
llvm-svn: 119347
2010-11-16 12:16:38 +00:00
Duncan Sands
f12ba1dfe1
Teach InstructionSimplify the trick of skipping incoming phi
...
values that are equal to the phi itself.
llvm-svn: 119161
2010-11-15 17:52:45 +00:00
Duncan Sands
b99f39b9f6
If dom tree information is available, make it possible to pass
...
it to get better phi node simplification.
llvm-svn: 119055
2010-11-14 18:36:10 +00:00
Duncan Sands
4581ddc123
Teach InstructionSimplify about phi nodes. I chose to have it simply
...
offload the work to hasConstantValue rather than do something more
complicated (such handling mutually recursive phis) because (1) it is
not clear it is worth it; and (2) if it is worth it, maybe such logic
would be better placed in hasConstantValue. Adjust some GVN tests
which are now cleaned up much further (eg: all phi nodes are removed).
llvm-svn: 119043
2010-11-14 13:30:18 +00:00
Duncan Sands
1d27f01210
Boost the power of phi node constant folding slightly: if all
...
operands are the phi node itself or undef, then return undef.
This logic already existed at a higher level so in practice it
shouldn't make the slightest difference. Note that this code
could be replaced by a call to PN->hasConstantValue(). However
since we bail out the moment we see a non-constant operand, it
is more efficient to have a specialized version of that logic.
llvm-svn: 119041
2010-11-14 12:53:18 +00:00
Duncan Sands
7e800d6f9c
Strip trailing whitespace.
...
llvm-svn: 119038
2010-11-14 11:23:23 +00:00
Duncan Sands
e5ac78e16e
Fix typo pointed out by Trevor Harmon.
...
llvm-svn: 119001
2010-11-13 12:16:27 +00:00
Dan Gohman
970afd926f
Re-disable TBAA for now; it broke MultiSource/Applications/JM/lencod,
...
at least.
llvm-svn: 118890
2010-11-12 11:21:08 +00:00
Dan Gohman
ea18d8ec2d
Enable TBAA.
...
llvm-svn: 118884
2010-11-12 06:20:01 +00:00
Dan Gohman
65316d6749
Add helper functions for computing the Location of load, store,
...
and vaarg instructions.
llvm-svn: 118845
2010-11-11 21:50:19 +00:00
Dan Gohman
468638826e
Don't forget the TBAA info, if available.
...
llvm-svn: 118842
2010-11-11 21:27:26 +00:00
Dan Gohman
7dacf8f3f3
Avoid calling alias on non-pointer values.
...
llvm-svn: 118822
2010-11-11 19:23:51 +00:00
Dan Gohman
c87c843db7
It's not necessary to clear out the Size and TBAATag at each of
...
these points.
llvm-svn: 118752
2010-11-11 00:42:22 +00:00
Dan Gohman
8bf3d832e5
Set NonLocalDepInfo's Size field to UnknownSize when invalidating
...
it, so that it doesn't appear to be a known size.
llvm-svn: 118748
2010-11-11 00:20:27 +00:00
Dan Gohman
6791936848
When clearing a non-local pointer dependency cache entry, clear
...
the reverse map too. This fixes seflhost build errors.
llvm-svn: 118729
2010-11-10 22:35:02 +00:00
Devang Patel
364bf04267
Take care of special characters while creating named MDNode name to hold function specific local variable's info.
...
This fixes radar 8653152. I am checking in testcase as a separate check-in.
llvm-svn: 118726
2010-11-10 22:19:21 +00:00
Dan Gohman
1d760ce8b3
Factor out the code for computing an AliasAnalysis::Location
...
for a given instruction into a helper function.
llvm-svn: 118723
2010-11-10 21:51:35 +00:00
Dan Gohman
2e8ca44b81
Fully invalidate cached results when a prior query's size or
...
type is insufficient for, or incompatible with, the current query.
llvm-svn: 118721
2010-11-10 21:45:11 +00:00
Duncan Sands
8f7220e9fd
Reduce the maximum recursion depth, 5 seems pointlessly too much.
...
Probably it should just be 1, but compromise with 3.
llvm-svn: 118718
2010-11-10 20:53:24 +00:00
Dan Gohman
0a6021a54d
Enhance GVN to do more precise alias queries for non-local memory
...
references. For example, this allows gvn to eliminate the load in
this example:
void foo(int n, int* p, int *q) {
p[0] = 0;
p[1] = 1;
if (n) {
*q = p[0];
}
}
llvm-svn: 118714
2010-11-10 20:37:15 +00:00
Duncan Sands
f3b1bf1606
Teach InstructionSimplify how to look through PHI nodes. Since PHI
...
nodes can be used in loops, this could result in infinite looping
if there is no recursion limit, so add such a limit. It is also
used for the SelectInst case because in theory there could be an
infinite loop there too if the basic block is unreachable.
llvm-svn: 118694
2010-11-10 18:23:01 +00:00
Dan Gohman
066c1bb1e9
Add a doesAccessArgPointees helper function, and update code to use
...
it, and to be consistent.
llvm-svn: 118692
2010-11-10 18:17:28 +00:00
Duncan Sands
b0579e9d3f
Simplify binary operations where one operand is a select instruction.
...
The simplifications performed here never create new instructions, they
only return existing instructions (or a constant), and so are always a
win. In theory they should transform (for example)
%z = and i32 %x, %y
%s = select i1 %cond, i32 %y, i32 %z
%r = and i32 %x, %s
into
%r = and i32 %x, y
but in practice they get into a fight with instcombine, and lose.
Unfortunately instcombine does a poor job in this case. Nonetheless
I'm committing this transform to make it easier to discuss what to
do to make peace with instcombine.
llvm-svn: 118679
2010-11-10 13:00:08 +00:00
Dan Gohman
2694e14087
Make ModRefBehavior a lattice. Use this to clean up AliasAnalysis
...
chaining and simplify FunctionAttrs' GetModRefBehavior logic.
llvm-svn: 118660
2010-11-10 01:02:18 +00:00
Dan Gohman
88ff1ece63
VAArg doesn't capture its operand.
...
llvm-svn: 118623
2010-11-09 20:09:35 +00:00
Dan Gohman
5d06f892ef
Teach AliasAnalysis about AccessesArgumentsReadonly.
...
llvm-svn: 118621
2010-11-09 20:06:55 +00:00
Dan Gohman
0f17507478
Teach LICM and AliasSetTracker about AccessesArgumentsReadonly.
...
llvm-svn: 118618
2010-11-09 19:58:21 +00:00
Duncan Sands
fc5ad3f0f9
Factorize code, no functionality change.
...
llvm-svn: 118516
2010-11-09 17:25:51 +00:00
Dan Gohman
142ff82a18
Re-introduce the MaxLookup limit to BasicAliasAnalysis'
...
pointsToConstantMemory code to guard against possible
compile time slowdowns.
llvm-svn: 118440
2010-11-08 20:26:19 +00:00
Dan Gohman
601c94b309
Implement getModRefBehavior for TypeBasedAliasAnalysis.
...
llvm-svn: 118416
2010-11-08 17:10:22 +00:00
Dan Gohman
9130bad71f
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.
llvm-svn: 118412
2010-11-08 16:45:26 +00:00
Dan Gohman
0b56778d65
Delete getIntrinsicModRefBehavior. Clients can just use the normal
...
getModRefBehavior now, since it now understands intrinsics as well
as normal functions.
llvm-svn: 118411
2010-11-08 16:11:19 +00:00
Dan Gohman
e461d7d135
Teach BasicAliasAnalysis::getModRefBehavior(const Function *F)
...
to analyze intrinsic functions.
llvm-svn: 118409
2010-11-08 16:08:43 +00:00
Duncan Sands
a620bd1fa3
Add simplification of floating point comparisons with the result
...
of a select instruction, the same as already exists for integer
comparisons.
llvm-svn: 118379
2010-11-07 16:46:25 +00:00
Duncan Sands
f532d31198
Fix a README item: when doing a comparison with the result
...
of a select instruction, see if doing the compare with the
true and false values of the select gives the same result.
If so, that can be used as the value of the comparison.
llvm-svn: 118378
2010-11-07 16:12:23 +00:00
Benjamin Kramer
ed8b7bf9ed
Use arrays instead of constant-sized SmallVectors.
...
llvm-svn: 118257
2010-11-04 18:45:27 +00:00
Devang Patel
57c5a20364
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
...
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
llvm-svn: 118248
2010-11-04 15:01:38 +00:00
Devang Patel
415c551459
Fix DIType verifier. The element 3 is DIFile now.
...
llvm-svn: 118054
2010-11-02 20:41:13 +00:00
Dan Gohman
dcb354b234
Make ScalarEvolution::forgetLoop forget all contained loops too, because
...
they may have ValuesAtScopes map entries referencing their outer loops.
This fixes a user-after-free reported in PR8471.
llvm-svn: 117698
2010-10-29 20:16:10 +00:00
Dan Gohman
15a43965ac
Teach memdep to use pointsToConstantMemory to determine that loads
...
from constant memory don't alias any stores.
llvm-svn: 117636
2010-10-29 01:14:04 +00:00
Dan Gohman
c6096263e2
Support TBAA attachments on calls. This is somewhat experimental.
...
llvm-svn: 117317
2010-10-25 21:38:20 +00:00
Dan Gohman
82b2e0da9c
Fix chaining in TBAA's pointsToConstantMemory.
...
llvm-svn: 117314
2010-10-25 21:24:55 +00:00
Dan Gohman
e6715d0755
Only read one bit for testing for a readonly type, leaving the other
...
bits open for future uses.
llvm-svn: 117301
2010-10-25 20:22:29 +00:00
Dan Gohman
fd864a1d31
Add a comment.
...
llvm-svn: 117288
2010-10-25 19:47:25 +00:00
Dan Gohman
abaf2d8d3b
Update comments; BasicAA is no longer necessarily the end of the chain.
...
llvm-svn: 117268
2010-10-25 16:29:52 +00:00
Dan Gohman
1033ce669b
Reintroduce these asserts, now that BasicAA is a normal AliasAnalysis pass.
...
llvm-svn: 117266
2010-10-25 16:28:57 +00:00
Benjamin Kramer
9192e7ab12
Make some symbols static, move classes into anonymous namespaces.
...
llvm-svn: 117111
2010-10-22 17:35:07 +00:00
Dan Gohman
8512270dbc
Add some more documentation.
...
llvm-svn: 117070
2010-10-21 21:55:35 +00:00
Dan Gohman
12c9e0cf1c
Explain what "constant" means here.
...
llvm-svn: 117053
2010-10-21 19:45:09 +00:00
Dan Gohman
104f1812ce
Update comments.
...
llvm-svn: 117048
2010-10-21 19:01:22 +00:00
Dan Gohman
1b85604130
Memdep says that an instruction clobbers itself
...
when it means there is no specific clobber instruction.
llvm-svn: 116960
2010-10-20 22:37:41 +00:00
Dan Gohman
a2ab75bc8d
Factor out the main aliasing check into a separate function.
...
llvm-svn: 116958
2010-10-20 22:11:14 +00:00
Dan Gohman
2549d0cf64
Fix comments; the type graph is currently a tree, not a DAG.
...
llvm-svn: 116954
2010-10-20 22:02:58 +00:00
Tobias Grosser
23c8341c3d
Add RegionPass support.
...
A RegionPass is executed like a LoopPass but on the regions detected by the
RegionInfo pass instead of the loops detected by the LoopInfo pass.
llvm-svn: 116905
2010-10-20 01:54:44 +00:00
Douglas Gregor
48b4568718
Fix CMake build
...
llvm-svn: 116903
2010-10-20 01:36:56 +00:00
Dan Gohman
da85ed8541
Move NoAA out of BasicAliasAnalysis.cpp into its own file, now that
...
it doesn't have a special relationship with BasicAliasAnalysis
anymore.
llvm-svn: 116876
2010-10-19 23:09:08 +00:00
Dan Gohman
f372cf869b
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
b4aa503501
Revert r116831 and r116839, which are breaking selfhost builds.
...
llvm-svn: 116858
2010-10-19 21:06:16 +00:00
Dan Gohman
f4c5fe73be
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
6c18d1aac0
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
14fe8cf238
Consistently use AliasAnalysis::UnknownSize instead of hardcoding ~0u.
...
llvm-svn: 116815
2010-10-19 17:06:23 +00:00
Dan Gohman
e4a82e2f21
Make the representation of AliasSets explicitly differentiate
...
between "not known yet" and "known no tbaa info" so that it
can merge them properly.
llvm-svn: 116767
2010-10-18 23:31:47 +00:00
Dan Gohman
408beac597
Don't pass the raw invalid pointer used to represent conflicting
...
TBAA information to AliasAnalysis.
llvm-svn: 116751
2010-10-18 21:28:00 +00:00
Dan Gohman
71af9db0e8
Make AliasSetTracker TBAA-aware, enabling TBAA-enabled LICM.
...
llvm-svn: 116743
2010-10-18 20:44:50 +00:00
Dan Gohman
f3702452c8
Fix BasicAA to pass TBAAInfo through to the chained analysis.
...
llvm-svn: 116730
2010-10-18 18:45:11 +00:00
Dan Gohman
33fcde9b9c
Make TypeBasedAliasAnalysis default to doing nothing, with a command-line
...
option to enable it.
llvm-svn: 116722
2010-10-18 18:17:47 +00:00
Dan Gohman
f0a3bed6d6
Use chaining in TypeBasedAliasAnalysis::pointsToConstantMemory.
...
llvm-svn: 116721
2010-10-18 18:10:31 +00:00
Dan Gohman
02538ac4d3
Make BasicAliasAnalysis a normal AliasAnalysis implementation which
...
does normal initialization and normal chaining. Change the default
AliasAnalysis implementation to NoAlias.
Update StandardCompileOpts.h and friends to explicitly request
BasicAliasAnalysis.
Update tests to explicitly request -basicaa.
llvm-svn: 116720
2010-10-18 18:04:47 +00:00
Benjamin Kramer
1dc34b48dd
Eliminate some calls to Value::getNameStr.
...
llvm-svn: 116670
2010-10-16 11:28:23 +00:00
Dan Gohman
31a01ee3cb
Tolerate a null parent pointer.
...
llvm-svn: 116533
2010-10-14 22:55:57 +00:00
Chris Lattner
698661c741
add uadd_ov/usub_ov to apint, consolidate constant folding
...
logic to use the new APInt methods. Among other things this
implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold
which comes from "clang -ftrapv", originally brought to my attention from PR8221.
llvm-svn: 116457
2010-10-14 00:05:07 +00:00
Owen Anderson
c266a36625
Analysis groups need to initialize their default implementations.
...
llvm-svn: 116441
2010-10-13 21:49:58 +00:00
Tobias Grosser
4b0986b6c1
Add Region::isTopLevelRegion().
...
llvm-svn: 116402
2010-10-13 11:02:44 +00:00
Tobias Grosser
4c71c117d1
RegionInfo: Fix trivial error that slipped in last minute.
...
llvm-svn: 116400
2010-10-13 08:00:53 +00:00
Tobias Grosser
fe92a9384e
RegionInfo: Update RegionInfo after a BB was split.
...
llvm-svn: 116398
2010-10-13 05:54:13 +00:00
Tobias Grosser
a8677226ab
RegioInfo: Add getExpandedRegion().
...
getExpandedRegion() enables us to create non canonical regions. Those regions
can be used to define the largerst region, that fullfills a certain property.
llvm-svn: 116397
2010-10-13 05:54:11 +00:00
Tobias Grosser
648594c920
RegionInfo: Allow to update exit and entry of a region.
...
llvm-svn: 116396
2010-10-13 05:54:10 +00:00
Tobias Grosser
bf984fd78e
RegionInfo: Enhance addSubregion.
...
llvm-svn: 116395
2010-10-13 05:54:09 +00:00
Tobias Grosser
8352ce5f8d
RegionInfo: Allow to set the parent region of a basic block.
...
llvm-svn: 116394
2010-10-13 05:54:07 +00:00
Tobias Grosser
e910b9d9cd
RegionInfo: Free the RegionNodes in cache.
...
Contributed by: ether
llvm-svn: 116380
2010-10-13 00:07:59 +00:00
Owen Anderson
8ac477ffb5
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
Dan Gohman
a8d3a7f93d
Support AA chaining.
...
llvm-svn: 116264
2010-10-11 23:39:34 +00:00
Kenneth Uildriks
b8d7efe785
Now using a variant of the existing inlining heuristics to decide whether to create a given specialization of a function in PartialSpecialization. If the total performance bonus across all callsites passing the same constant exceeds the specialization cost, we create the specialization.
...
llvm-svn: 116158
2010-10-09 22:06:36 +00:00
Kenneth Uildriks
99463ca8cf
Start separating out code metrics into code size metrics and code performance metrics. Partial Specialization will apply the former to function specializations, and the latter to all callsites that can use a specialization, in order to decide whether to create a specialization
...
llvm-svn: 116057
2010-10-08 13:57:31 +00:00
Owen Anderson
df7a4f2515
Now with fewer extraneous semicolons!
...
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Owen Anderson
98eb3ec6c5
Add an implementation of the initialization routine for IPA.
...
llvm-svn: 115947
2010-10-07 18:31:27 +00:00
Owen Anderson
6875c2ea26
Add initialization routines for Analysis and IPA.
...
llvm-svn: 115946
2010-10-07 18:31:00 +00:00
Owen Anderson
82d38df40c
Fix a warning when building with clang++.
...
llvm-svn: 115924
2010-10-07 17:04:18 +00:00
Owen Anderson
5e19bfcde3
Move the pass initialization helper functions into the llvm namespace, and add
...
a header declaring them all. This is also where we will declare per-library pass-set
initializer functions down the road.
llvm-svn: 115900
2010-10-07 04:13:08 +00:00
Owen Anderson
af08ad4350
Appease the clang self-host buildbot by providing a correct instantiation.
...
llvm-svn: 115857
2010-10-06 22:23:20 +00:00
Owen Anderson
ad8134f03b
Hide analysis group registration behind a macro, just like pass registration.
...
llvm-svn: 115835
2010-10-06 21:02:27 +00:00
Devang Patel
9a33ec24eb
Add support for DW_TAG_unspecified_parameters.
...
llvm-svn: 115833
2010-10-06 20:50:40 +00:00
Dan Gohman
8e4c19ac44
Don't add the operand count to SCEV uniquing data; FoldingSetNodeID
...
already knows its own length, so this is redundant.
llvm-svn: 115521
2010-10-04 17:24:08 +00:00
Devang Patel
bea08d1c85
Let FE mark a variable as artificial variable.
...
llvm-svn: 115102
2010-09-29 23:07:21 +00:00
Devang Patel
95ae73c394
Generalize DISubprogram element to encode various flags instead of just one boolean for isArtificial.
...
This is a backword compatible change.
llvm-svn: 115084
2010-09-29 21:04:46 +00:00
Benjamin Kramer
923a8cf356
Remove PointerTracking from cmakelists …
...
llvm-svn: 115076
2010-09-29 19:39:50 +00:00
Chris Lattner
af995f0ee5
remove PointerTracking from mainline, Edwin is going to move it out to ClamAV
...
for LLVM 2.9
llvm-svn: 115062
2010-09-29 18:43:27 +00:00
Oscar Fuentes
b4b12535e8
Removed a bunch of unnecessary target_link_libraries.
...
llvm-svn: 114999
2010-09-28 22:39:14 +00:00