Commit Graph

1706 Commits

Author SHA1 Message Date
Dan Gohman
56a7568218 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 23:28:48 +00:00
Dan Gohman
714b5290b0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 23:21:44 +00:00
Dan Gohman
4ce32db913 Make SCEV::getType() and SCEV::print non-virtual. Move SCEV::hasOperand
to ScalarEvolution. Delete SCEV::~SCEV. SCEV is no longer virtual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119578 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 22:27:42 +00:00
Dan Gohman
dc0e8fb9f9 Move SCEV::dominates and properlyDominates to ScalarEvolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119570 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 21:41:58 +00:00
Dan Gohman
17ead4ff4b Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be member
functions of ScalarEvolution, in preparation for memoization and
other optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119562 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 21:23:15 +00:00
Dan Gohman
203a7239ae Verify SCEVAddRecExpr's invariant in ScalarEvolution::getAddRecExpr
instead of in SCEVAddRecExpr's constructor, in preparation for an
upcoming change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119554 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 20:48:38 +00:00
Dan Gohman
7c0fd8eb72 Fix ScalarEvolution's range memoization to avoid using a
default ctor with ConstantRange.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 20:23:08 +00:00
Duncan Sands
2b749870d0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 18:52:15 +00:00
Duncan Sands
d261dc650a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:35:29 +00:00
Dan Gohman
6678e7b6eb Memoize results from ScalarEvolution's getUnsignedRange and getSignedRange.
This fixes some extreme compile times on unrolled sha512 code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 02:44:44 +00:00
Duncan Sands
1845009290 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119347 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 12:16:38 +00:00
Duncan Sands
eff0581583 If dom tree information is available, make it possible to pass
it to get better phi node simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119055 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14 18:36:10 +00:00
Duncan Sands
12a86f5b31 Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14 11:23:23 +00:00
Dan Gohman
6d8eb156e6 Add helper functions for computing the Location of load, store,
and vaarg instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 21:50:19 +00:00
Dan Gohman
8e78cc4e13 Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118799 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 17:33:39 +00:00
Dan Gohman
17e8078ae1 Add brief doxygen comments for AliasResult enum values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118792 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 16:37:38 +00:00
Dan Gohman
ec9b4ac914 Set NonLocalDepInfo's Size field to UnknownSize when invalidating
it, so that it doesn't appear to be a known size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 00:20:27 +00:00
Devang Patel
62367045a4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118726 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 22:19:21 +00:00
Dan Gohman
075fb5d68f 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];
    }
  }


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118714 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 20:37:15 +00:00
Dan Gohman
e88ccb545d Rename AccessesArguments and AccessesArgumentsReadonly, and rewrite
their comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 18:30:00 +00:00
Dan Gohman
b395e4a026 Fix a copy+pasto Duncan noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 18:18:23 +00:00
Dan Gohman
68a6056daf Add a doesAccessArgPointees helper function, and update code to use
it, and to be consistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 18:17:28 +00:00
Dan Gohman
432d08cbdb Factor out the code for testing whether a function accesses
arbitrary memory into a helper function, and adjust some comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118687 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 17:34:04 +00:00
Dan Gohman
50bcaece67 Give NonLocalDepResult a NonLocalDepEntry member, replacing
indivudal members holding the same data, to clarify the relationship
between NonLocalDepResult and NonLocalDepEntry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 17:15:52 +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
50a04d067f Convert comments to doxygen syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118628 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 20:33:57 +00:00
Dan Gohman
4a53f37a1a AccessesArgumentsReadonly is read-only.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118615 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:50:00 +00:00
Dan Gohman
db78c4873e Add a AccessesArgumentsReadonly ModRefBehavior value, so that the intrinsic
property IntrReadArgMem can be modeled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:48:55 +00:00
Dan Gohman
467a0adfc8 Factor out the logic for onlyReadsMemory into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118611 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:43:24 +00:00
Dan Gohman
7293ac1281 Delete AccessesArgumentsAndGlobals, which was unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118610 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:41:37 +00:00
Dan Gohman
902da265f6 Add some comments noting some correspondences between ModRefBehavior
values, LLVM IR function attributes, and LLVM intrinsic attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 23:46:02 +00:00
Devang Patel
2c4c6a5e8a Document parameters. Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118424 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 18:28:34 +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
c80cbf2540 Delete getIntrinsicModRefBehavior. Clients can just use the normal
getModRefBehavior now, since it now understands intrinsics as well
as normal functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118411 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 16:11:19 +00:00
Dan Gohman
6c25c920e6 Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 15:34:42 +00:00
Devang Patel
35fcd6557f 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);



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
Devang Patel
ab70ed41f3 Add getFile() to get DIFile of a DIType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118247 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 14:56:34 +00:00
Devang Patel
0e82ac07bc Simplify.
-      DIFile F = getFieldAs<DIFile>(6); 
-      return F.getDirectory();
+      return getFieldAs<DIFile>(6).getDirectory(); 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 16:42:37 +00:00
Devang Patel
fb9dce3806 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117601 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:41:11 +00:00
Devang Patel
8f6a281e97 Backward compatibility. Gracefully handle older versions of debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:08:13 +00:00
Devang Patel
bc2bb9bbd0 Do not work too hard to find type's file info. There is a special field to record file info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:50:08 +00:00
Devang Patel
42d3a34575 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:40:13 +00:00
Devang Patel
a514a4e172 Do not rely on context to find file info. It is already provided as a separate field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:14:28 +00:00
Devang Patel
f95a271922 Give a name to nameless argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 18:08:31 +00:00
Benjamin Kramer
a53fe6070c SmallVectorize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-23 17:10:24 +00:00
Tobias Grosser
6551360535 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 01:54:44 +00:00
Dan Gohman
db4708cf86 Move NoAA out of BasicAliasAnalysis.cpp into its own file, now that
it doesn't have a special relationship with BasicAliasAnalysis
anymore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116876 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:09:08 +00:00
Dan Gohman
3da848bbda Reapply r116831 and r116839, converting AliasAnalysis to use
uint64_t, plus fixes for places I missed before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116875 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 22:54:46 +00:00
Dan Gohman
1db839e734 Revert r116831 and r116839, which are breaking selfhost builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 21:06:16 +00:00
Dan Gohman
9cb4c7f878 Oops, check in all the files for converting AliasAnalysis to
use uint64_t.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 18:08:27 +00:00