Duncan Sands
2699fb1072
Move Sub simplifications and additional Add simplifications out of
...
instcombine and into InstructionSimplify.
llvm-svn: 121861
2010-12-15 14:07:39 +00:00
Dan Gohman
9d1f5ce1da
Introduce a new PartialAlias response for AliasAnalysis. For most
...
AliasAnalysis consumers, PartialAlias will be treated as MayAlias.
For AliasAnalysis chaining, MayAlias says "procede to the next analysis".
PartialAlias will be used to indicate that the query should terminate,
even though it didn't reach MustAlias or NoAlias.
llvm-svn: 121507
2010-12-10 19:38:58 +00:00
Devang Patel
90fd70aa09
Add support to create debug info for functions and methods.
...
llvm-svn: 121281
2010-12-08 20:42:44 +00:00
Devang Patel
53f05af4c1
Add support to create class type.
...
llvm-svn: 121279
2010-12-08 20:18:20 +00:00
Devang Patel
b7a7988b6b
Add support to create vector, array, enums etc...
...
llvm-svn: 121224
2010-12-08 01:50:15 +00:00
Devang Patel
0c0accf6bc
Global variable does not need linkage name.
...
llvm-svn: 121212
2010-12-08 00:06:22 +00:00
Devang Patel
bdbff5f106
Add support to create local variable's debug info.
...
llvm-svn: 121211
2010-12-07 23:58:00 +00:00
Devang Patel
cef2982b39
Add support to create variables, structs etc.. using DIBuilder.
...
This is still work in progress.
llvm-svn: 121205
2010-12-07 23:25:47 +00:00
Chris Lattner
db6c348f31
Fix PR8728, a miscompilation I recently introduced. When optimizing
...
memcpy's like:
memcpy(A, B)
memcpy(A, C)
we cannot delete the first memcpy as dead if A and C might be aliases.
If so, we actually get:
memcpy(A, B)
memcpy(A, A)
which is not correct to transform into:
memcpy(A, A)
This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks
Jakub!
llvm-svn: 120974
2010-12-06 01:48:06 +00:00
Chris Lattner
83445a6415
add a helper method.
...
llvm-svn: 120973
2010-12-06 01:01:28 +00:00
Chris Lattner
b9c5a6fa04
teach DSE to use GetPointerBaseWithConstantOffset to analyze
...
may-aliasing stores that partially overlap with different base
pointers. This implements PR6043 and the non-variable part of
PR8657
llvm-svn: 120485
2010-11-30 23:05:20 +00:00
Chris Lattner
58b829f94c
move GetPointerBaseWithConstantOffset out of GVN into ValueTracking.h
...
llvm-svn: 120476
2010-11-30 22:25:26 +00:00
Cameron Zwarich
88bfbeb5cc
Change the basic block map in LoopInfo from a std::map to a DenseMap. This is a 16% speedup running loops on test-suite + SPEC2000.
...
Reviewed by Eric Christopher.
llvm-svn: 120440
2010-11-30 18:51:19 +00:00
Chris Lattner
7d444d0682
Rewrite the main DSE loop to be written in terms of reasoning
...
about pairs of AA::Location's instead of looking for MemDep's
"Def" predicate. This is more powerful and general, handling
memset/memcpy/store all uniformly, and implementing PR8701 and
probably obsoleting parts of memcpyoptimizer.
This also fixes an obscure bug with init.trampoline and i8
stores, but I'm not surprised it hasn't been hit yet. Enhancing
init.trampoline to carry the size that it stores would allow
DSE to be much more aggressive about optimizing them.
llvm-svn: 120406
2010-11-30 07:23:21 +00:00
Chris Lattner
31d8d00187
death to extraneous \n's.
...
llvm-svn: 120405
2010-11-30 07:20:51 +00:00
Chris Lattner
cbe6b88afe
getLocationForDest should work for memset as well.
...
llvm-svn: 120380
2010-11-30 01:48:20 +00:00
Chris Lattner
76977cd3c8
clean up handling of 'free', detangling it from everything else.
...
It can be seriously improved, but at least now it isn't intertwined
with the other logic.
llvm-svn: 120377
2010-11-30 01:28:33 +00:00
Michael J. Spencer
d5ec932c3a
Merge System into Support.
...
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Duncan Sands
97ada840ed
Expand a little on the description of what InstructionSimplify does.
...
llvm-svn: 120016
2010-11-23 10:50:08 +00:00
Duncan Sands
809b3e3634
Clarify that constant folding of instructions applies when all operands
...
are constant. There was in fact one exception to this (phi nodes) - so
remove that exception (InstructionSimplify handles this so there should
be no loss).
llvm-svn: 120015
2010-11-23 10:16:18 +00:00
Cameron Zwarich
1fa40011ae
Optimize a common case in the Lengauer-Tarjan dominators algorithm. This gives a
...
9.7% speedup running domtree on test-suite.
Reviewed by Chris Lattner.
llvm-svn: 120003
2010-11-23 06:32:37 +00:00
Chris Lattner
0d1afc82b2
the getLocationForSource/Dest methods can be static.
...
llvm-svn: 119929
2010-11-21 08:05:25 +00:00
Chris Lattner
a39a40d351
add "getLocation" method to AliasAnalysis for getting the source and
...
destination location of a memcpy/memmove. I'm not clear about whether
TBAA works on these, so I'm leaving it out for now. Dan, please revisit
this when convenient.
llvm-svn: 119928
2010-11-21 07:51:27 +00:00
Chris Lattner
3a0edfb37c
implement PR8576, deleting dead stores with intervening may-alias stores.
...
llvm-svn: 119927
2010-11-21 07:34:32 +00:00
Duncan Sands
f0b203d4a4
Simplify, no functionality change.
...
llvm-svn: 119797
2010-11-19 08:33:20 +00:00
Duncan Sands
4562d3b919
Factor code for testing whether replacing one value with another
...
preserves LCSSA form out of ScalarEvolution and into the LoopInfo
class. Use it to check that SimplifyInstruction simplifications
are not breaking LCSSA form. Fixes PR8622.
llvm-svn: 119727
2010-11-18 19:59:41 +00:00
Dan Gohman
ac4c387e2d
Document the units for the Size field.
...
llvm-svn: 119711
2010-11-18 17:39:01 +00:00
Dan Gohman
3213622610
Introduce memoization for ScalarEvolution dominates and properlyDominates
...
queries, and SCEVExpander getRelevantLoop queries.
llvm-svn: 119595
2010-11-18 00:34:22 +00:00
Dan Gohman
ecff21cc67
Factor out the code for purging a SCEV from all the various memoization maps.
...
Some of these maps may merge in the future, but for now it's convenient to have
a utility function for them.
llvm-svn: 119587
2010-11-17 23:28:48 +00:00
Dan Gohman
8e594dfe39
Merge the implementations of isLoopInvariant and hasComputableLoopEvolution, and
...
memoize the results. This improves compile time in code which highly complex
expressions which get queried many times.
llvm-svn: 119584
2010-11-17 23:21:44 +00:00
Dan Gohman
fb6ea18d0a
Make SCEV::getType() and SCEV::print non-virtual. Move SCEV::hasOperand
...
to ScalarEvolution. Delete SCEV::~SCEV. SCEV is no longer virtual.
llvm-svn: 119578
2010-11-17 22:27:42 +00:00
Dan Gohman
9bbb0fa515
Move SCEV::dominates and properlyDominates to ScalarEvolution.
...
llvm-svn: 119570
2010-11-17 21:41:58 +00:00
Dan Gohman
04df5af12b
Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be member
...
functions of ScalarEvolution, in preparation for memoization and
other optimizations.
llvm-svn: 119562
2010-11-17 21:23:15 +00:00
Dan Gohman
4dc0a20aea
Verify SCEVAddRecExpr's invariant in ScalarEvolution::getAddRecExpr
...
instead of in SCEVAddRecExpr's constructor, in preparation for an
upcoming change.
llvm-svn: 119554
2010-11-17 20:48:38 +00:00
Dan Gohman
a585073323
Fix ScalarEvolution's range memoization to avoid using a
...
default ctor with ConstantRange.
llvm-svn: 119550
2010-11-17 20:23:08 +00:00
Duncan Sands
2bd7e7c274
Move some those Xor simplifications which don't require creating new
...
instructions out of InstCombine and into InstructionSimplify. While
there, introduce an m_AllOnes pattern to simplify matching with integers
and vectors with all bits equal to one.
llvm-svn: 119536
2010-11-17 18:52:15 +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
Dan Gohman
b10ff802a0
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
825c7d7f79
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
63e80e0593
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
ab39985d42
Strip trailing whitespace.
...
llvm-svn: 119038
2010-11-14 11:23:23 +00:00
Dan Gohman
f3bf6591e0
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
7c06994452
Add comments.
...
llvm-svn: 118799
2010-11-11 17:33:39 +00:00
Dan Gohman
503ad44b14
Add brief doxygen comments for AliasResult enum values.
...
llvm-svn: 118792
2010-11-11 16:37:38 +00:00
Dan Gohman
b476dc0f55
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
Devang Patel
5520a6fc97
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
2b4e8302a6
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
Dan Gohman
04e46fa78b
Rename AccessesArguments and AccessesArgumentsReadonly, and rewrite
...
their comments.
llvm-svn: 118696
2010-11-10 18:30:00 +00:00
Dan Gohman
271a238243
Fix a copy+pasto Duncan noticed.
...
llvm-svn: 118693
2010-11-10 18:18:23 +00:00
Dan Gohman
65a3841f03
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
Dan Gohman
9ae50022a1
Factor out the code for testing whether a function accesses
...
arbitrary memory into a helper function, and adjust some comments.
llvm-svn: 118687
2010-11-10 17:34:04 +00:00
Dan Gohman
3cc59e791f
Give NonLocalDepResult a NonLocalDepEntry member, replacing
...
indivudal members holding the same data, to clarify the relationship
between NonLocalDepResult and NonLocalDepEntry.
llvm-svn: 118686
2010-11-10 17:15:52 +00:00
Dan Gohman
1571dfc883
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
2a7e94d265
Convert comments to doxygen syntax.
...
llvm-svn: 118628
2010-11-09 20:33:57 +00:00
Dan Gohman
27fb58d9c7
AccessesArgumentsReadonly is read-only.
...
llvm-svn: 118615
2010-11-09 19:50:00 +00:00
Dan Gohman
d50f969460
Add a AccessesArgumentsReadonly ModRefBehavior value, so that the intrinsic
...
property IntrReadArgMem can be modeled.
llvm-svn: 118614
2010-11-09 19:48:55 +00:00
Dan Gohman
9bdf92c92c
Factor out the logic for onlyReadsMemory into a helper function.
...
llvm-svn: 118611
2010-11-09 19:43:24 +00:00
Dan Gohman
3de0bd24db
Delete AccessesArgumentsAndGlobals, which was unused.
...
llvm-svn: 118610
2010-11-09 19:41:37 +00:00
Dan Gohman
227bf9fea9
Add some comments noting some correspondences between ModRefBehavior
...
values, LLVM IR function attributes, and LLVM intrinsic attributes.
llvm-svn: 118455
2010-11-08 23:46:02 +00:00
Devang Patel
af569979a6
Document parameters. Fix typos.
...
llvm-svn: 118424
2010-11-08 18:28:34 +00:00
Dan Gohman
6909ecf66e
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
ee58dba24c
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
c3202f8550
Add comments.
...
llvm-svn: 118408
2010-11-08 15:34:42 +00:00
Devang Patel
6c1b802673
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
72715ef163
Add getFile() to get DIFile of a DIType.
...
llvm-svn: 118247
2010-11-04 14:56:34 +00:00
Devang Patel
43516e02b6
Simplify.
...
- DIFile F = getFieldAs<DIFile>(6);
- return F.getDirectory();
+ return getFieldAs<DIFile>(6).getDirectory();
llvm-svn: 117662
2010-10-29 16:42:37 +00:00
Devang Patel
c40ecb9302
Fix indentation.
...
llvm-svn: 117601
2010-10-28 20:41:11 +00:00
Devang Patel
504232300c
Backward compatibility. Gracefully handle older versions of debug info.
...
llvm-svn: 117595
2010-10-28 20:08:13 +00:00
Devang Patel
a496603faf
Do not work too hard to find type's file info. There is a special field to record file info.
...
llvm-svn: 117588
2010-10-28 19:50:08 +00:00
Devang Patel
552a3a845c
Fix indentation.
...
llvm-svn: 117586
2010-10-28 19:40:13 +00:00
Devang Patel
dcabf6f76a
Do not rely on context to find file info. It is already provided as a separate field.
...
llvm-svn: 117577
2010-10-28 19:14:28 +00:00
Devang Patel
6c3a77ab58
Give a name to nameless argument.
...
llvm-svn: 117468
2010-10-27 18:08:31 +00:00
Benjamin Kramer
86b0370b66
SmallVectorize.
...
llvm-svn: 117213
2010-10-23 17:10:24 +00:00
Tobias Grosser
88ce93b0eb
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
Dan Gohman
399ef0b44a
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
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
37a9b813f5
Oops, check in all the files for converting AliasAnalysis to
...
use uint64_t.
llvm-svn: 116839
2010-10-19 18:08:27 +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
8b332ffb8c
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
6efd04961b
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
64affb7be2
Make AliasSetTracker TBAA-aware, enabling TBAA-enabled LICM.
...
llvm-svn: 116743
2010-10-18 20:44:50 +00:00
Benjamin Kramer
3d87b36b64
Remove noisy semicolon.
...
llvm-svn: 116407
2010-10-13 15:55:12 +00:00
Tobias Grosser
70507511ae
Add Region::isTopLevelRegion().
...
llvm-svn: 116402
2010-10-13 11:02:44 +00:00
Tobias Grosser
85dce73ab5
RegionInfo: Update RegionInfo after a BB was split.
...
llvm-svn: 116398
2010-10-13 05:54:13 +00:00
Tobias Grosser
6aac855519
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
ecfaf92c1a
RegionInfo: Allow to update exit and entry of a region.
...
llvm-svn: 116396
2010-10-13 05:54:10 +00:00
Tobias Grosser
84dd4b54fc
RegionInfo: Enhance addSubregion.
...
llvm-svn: 116395
2010-10-13 05:54:09 +00:00
Tobias Grosser
a2b5df5a6d
RegionInfo: Allow to set the parent region of a basic block.
...
llvm-svn: 116394
2010-10-13 05:54:07 +00:00
Kenneth Uildriks
e9771f15f7
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
0545afa8fd
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
Devang Patel
ee23e6ea23
Provie a clearner interface so that FE can decide whether a function has prototype or not.
...
llvm-svn: 115988
2010-10-07 22:03:01 +00:00
Devang Patel
eeb0b64560
Add support for DW_TAG_unspecified_parameters.
...
llvm-svn: 115833
2010-10-06 20:50:40 +00:00
Dan Gohman
52980b97f9
Constify isReachableFromEntry.
...
llvm-svn: 115788
2010-10-06 15:49:14 +00:00
Devang Patel
f612c0b23e
Add support to let FE mark explict methods as explict in debug info.
...
llvm-svn: 115378
2010-10-01 23:31:40 +00:00
Devang Patel
41e2a94595
Let FE mark a variable as artificial variable.
...
llvm-svn: 115102
2010-09-29 23:07:21 +00:00
Devang Patel
f600d9f0ed
Add support to let FE encode method access specifier.
...
llvm-svn: 115089
2010-09-29 21:44:16 +00:00
Devang Patel
bbd003ab48
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
Chris Lattner
b7bfd3de07
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
Devang Patel
e1f502ee26
Provide an interface to let FEs anchor debug info for types.
...
llvm-svn: 114969
2010-09-28 18:08:20 +00:00