Commit Graph

13709 Commits

Author SHA1 Message Date
Bill Wendling
b476302b24 This is #included by .c files. Remove C++-style comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124552 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 21:54:26 +00:00
Frits van Bommel
1fca2c32cc Move InstCombine's knowledge of fdiv to SimplifyInstruction().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124534 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 15:26:31 +00:00
Evan Cheng
c3f507f98a Re-apply r124518 with fix. Watch out for invalidated iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 04:46:23 +00:00
Evan Cheng
b0a42fdb36 Revert r124518. It broke Linux self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 02:43:04 +00:00
Evan Cheng
5e6940788f Re-commit r124462 with fixes. Tail recursion elim will now dup ret into unconditional predecessor to enable TCE on demand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 01:29:26 +00:00
Andrew Trick
04317cc618 Implementation of path profiling.
Modified patch by Adam Preuss.

This builds on the existing framework for block tracing, edge profiling and optimal edge profiling.
See -help-hidden for new flags.
For documentation, see the technical report "Implementation of Path Profiling..." in llvm.org/pubs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124515 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 01:09:53 +00:00
Duncan Sands
593faa53fa My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPEC
benchmarks, and that it can be simplified to X/Y.  (In general you can only
simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the
form "X/Y" then this is the case).  This patch implements that transform and
moves some Div logic out of instcombine and into InstructionSimplify.
Unfortunately instcombine gets in the way somewhat, since it likes to change
(X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too.
Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y"
does not overflow, because the flag says so, so I added that logic too.  This
eliminates a bunch of divisions and subtractions in 447.dealII, and has good
effects on some other benchmarks too.  It seems to have quite an effect on
tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions
changed, resulting in massive changes all over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124487 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 16:51:11 +00:00
Nick Lewycky
ae479aa13e Add missing include for ptrdiff_t. Patch by Joerg Sonnenberger!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124470 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 03:52:25 +00:00
Roman Divacky
bf7553210a Introduce virtual ParseRegister method in TargetAsmParser.
Create override of this method in X86/ARM/MBlaze.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124378 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 17:14:22 +00:00
Nick Lewycky
989e7c4d0f Add DenseSet::resize for API parity with DenseMap::resize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 09:10:42 +00:00
Jay Foad
adede0387b Simplify User::operator delete().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 21:56:10 +00:00
Eric Christopher
eabde0cf07 Temporarily revert 124275 to see if it brings the dragonegg buildbot back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124312 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 19:40:31 +00:00
David Greene
cfe33c46aa [AVX] Add INSERT_SUBVECTOR and support it on x86. This provides a
default implementation for x86, going through the stack in a similr
fashion to how the codegen implements BUILD_VECTOR.  Eventually this
will get matched to VINSERTF128 if AVX is available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124307 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 19:13:22 +00:00
David Greene
91585098ef [AVX] Support EXTRACT_SUBVECTOR on x86. This provides a default
implementation of EXTRACT_SUBVECTOR for x86, going through the stack
in a similr fashion to how the codegen implements BUILD_VECTOR.
Eventually this will get matched to VEXTRACTF128 if AVX is available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 15:38:49 +00:00
Eric Christopher
5d83955b8c Separate out the constant bonus from the size reduction metrics. Rework
a few loops accordingly. Should be no functional change.

This is a step for more accurate cost/benefit analysis of devirt/inlining
bonuses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 02:58:39 +00:00
Devang Patel
a2e868d34c Provide an interface to transfer SDDbgValue from one SDNode to another.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124245 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 23:27:42 +00:00
David Greene
e13359732a [AVX] Fix a typo in the extract subvector type constraints to specify
the correct number of operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124234 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 22:05:41 +00:00
David Greene
b5b80a93f6 [AVX] Add TableGen classes for vector/subvector type constraints.
This will be used to check patterns referencing a forthcoming
INSERT_SUBVECTOR SDNode and will also be used to check
EXTRACT_SUBVECTOR nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124191 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 16:16:32 +00:00
Jay Foad
afde5188f2 Avoid compiler errors when this header file is included first, by adding
a forward declaration of simplify_type<>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124187 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 14:33:33 +00:00
Duncan Sands
d70d1a5c44 According to my auto-simplifier the most common missed simplifications in
optimized code are:
  (non-negative number)+(power-of-two) != 0 -> true
and
  (x | 1) != 0 -> true
Instcombine knows about the second one of course, but only does it if X|1
has only one use.  These fire thousands of times in the testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 09:38:29 +00:00
Eric Christopher
0f13bc8c23 Perhaps a bit too much vertical whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124148 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 22:19:14 +00:00
Dan Gohman
bd1801b555 Give GetUnderlyingObject a TargetData, to keep it in sync
with BasicAA's DecomposeGEPExpression, which recently began
using a TargetData. This fixes PR8968, though the testcase
is awkward to reduce.

Also, update several off GetUnderlyingObject's users
which happen to have a TargetData handy to pass it in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124134 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 18:53:32 +00:00
Rafael Espindola
96aa78c8c5 Add support for the --noexecstack option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124077 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 17:55:27 +00:00
Cameron Zwarich
55be644df6 Convert a std::vector to a SmallVector for another 5.4% speedup on domtree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124065 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 06:54:22 +00:00
Cameron Zwarich
54cdad97eb In the simpler version of the link-eval data structure that we use in dominator
computation, the Ancestor field is always set to the Parent, so we can remove
the explicit link entirely and merge the Parent and Ancestor fields. Instead of
checking for whether an ancestor exists for a node or not, we simply check
whether the node has already been processed. This is simpler if Compress is
inlined into Eval, so I did that as well.

This is about a 3% speedup running -domtree on test-suite + SPEC2000 & SPEC2006,
but it also opens up some opportunities for further improvement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124061 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 06:16:06 +00:00
Rafael Espindola
0cf5e3d51d Delay the creation of eh_frame so that the user can change the defaults.
Add support for SHT_X86_64_UNWIND.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124059 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 05:43:40 +00:00
Cameron Zwarich
11e222da1f Remove useless struct fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 05:11:18 +00:00
Cameron Zwarich
53e069ffab Remove friend declaration for removed function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124057 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 04:54:34 +00:00
Rafael Espindola
1c13026e8f Remove more duplicated code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 04:43:11 +00:00
Cameron Zwarich
907b56ce7a Convert a std::vector to a SmallVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124055 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 04:30:59 +00:00
Rafael Espindola
c85dca66e6 Remove duplicated code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 04:28:49 +00:00
Cameron Zwarich
5c96c69161 Simplify some code now that we've removed the more optimal (but slower) version
of the link-eval data structure from dominator computation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124053 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 04:13:53 +00:00
Benjamin Kramer
ecb89fd06c Remove dead ivar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124028 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-22 12:13:28 +00:00
Chris Lattner
b83e60e602 add DW_TAG for rvalue refs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124019 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-22 01:47:25 +00:00
Renato Golin
859f818363 Clang was not parsing target triples involving EABI and was generating wrong IR (wrong PCS) and passing the wrong information down llc via the target-triple printed in IR. I've fixed this by adding the parsing of EABI into LLVM's Triple class and using it to choose the correct PCS in Clang's Tools. A Clang patch is on its way to use this infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123990 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 18:25:47 +00:00
Oscar Fuentes
5969379145 Handles libffi on the CMake build.
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123976 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 15:42:54 +00:00
Andrew Trick
c8bfd1d78f Convert -enable-sched-cycles and -enable-sched-hazard to -disable
flags. They are still not enable in this revision.

Added TargetInstrInfo::isZeroCost() to fix a fundamental problem with
the scheduler's model of operand latency in the selection DAG.

Generalized unit tests to work with sched-cycles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 05:51:33 +00:00
Michael J. Spencer
7acdb4d237 Object: Fix type punned pointer issues by making DataRefImpl a union and using intptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 02:27:02 +00:00
Evan Cheng
9fe2009956 Sorry, several patches in one.
TargetInstrInfo:
Change produceSameValue() to take MachineRegisterInfo as an optional argument.
When in SSA form, targets can use it to make more aggressive equality analysis.

Machine LICM:
1. Eliminate isLoadFromConstantMemory, use MI.isInvariantLoad instead.
2. Fix a bug which prevent CSE of instructions which are not re-materializable.
3. Use improved form of produceSameValue.

ARM:
1. Teach ARM produceSameValue to look pass some PIC labels.
2. Look for operands from different loads of different constant pool entries
   which have same values.
3. Re-implement PIC GA materialization using movw + movt. Combine the pair with
   a "add pc" or "ldr [pc]" to form pseudo instructions. This makes it possible
   to re-materialize the instruction, allow machine LICM to hoist the set of
   instructions out of the loop and make it possible to CSE them. It's a bit
   hacky, but it significantly improve code quality.
4. Some minor bug fixes as well.

With the fixes, using movw + movt to materialize GAs significantly outperform the
load from constantpool method. 186.crafty and 255.vortex improved > 20%, 254.gap
and 176.gcc ~10%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123905 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 08:34:58 +00:00
Michael J. Spencer
b84551a14f Object: Add ELF support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123896 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:38:47 +00:00
Cameron Zwarich
229b22132b Remove an unnecessary #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123877 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 03:56:35 +00:00
Cameron Zwarich
5d2cf40c40 There is no point in verifying an analysis that is never updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123743 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 05:44:04 +00:00
Cameron Zwarich
72d1695f12 Remove some now-unused DominanceFrontier methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 04:21:57 +00:00
Cameron Zwarich
b1686c32fc Remove outdated references to dominance frontiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123724 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 03:53:26 +00:00
Jim Grosbach
6bbf5eb32f Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 18:34:03 +00:00
Cameron Zwarich
419e8a6299 Roll r123609 back in with two changes that fix test failures with expensive
checks enabled:

1) Use '<' to compare integers in a comparison function rather than '<='.

2) Use the uniqued set DefBlocks rather than Info.DefiningBlocks to initialize
the priority queue.

The speedup of scalarrepl on test-suite + SPEC2000 + SPEC2006 is a bit less, at
just under 16% rather than 17%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123662 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 17:38:41 +00:00
Devang Patel
5860c6c09e Revert rr123550. It causes clang build failure on darwin9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 17:34:43 +00:00
Oscar Fuentes
3c00a83c33 Add some platform checks. Also fix a typo on a Makefile.
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123659 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 16:35:14 +00:00
Jay Foad
0d1941a46f Remove useless Tag enumeration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123623 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 15:18:06 +00:00
Cameron Zwarich
b1086a9c6d Roll out r123609 due to failures on the llvm-x86_64-linux-checks bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 07:26:51 +00:00
Cameron Zwarich
ebed6de7b1 Eliminate the use of dominance frontiers in PromoteMemToReg. In addition to
eliminating a potentially quadratic data structure, this also gives a 17%
speedup when running -scalarrepl on test-suite + SPEC2000 + SPEC2006. My initial
experiment gave a greater speedup around 25%, but I moved the dominator tree
level computation from dominator tree construction to PromoteMemToReg.

Since this approach to computing IDFs has a much lower overhead than the old
code using precomputed DFs, it is worth looking at using this new code for the
second scalarrepl pass as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123609 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 01:08:59 +00:00
Michael J. Spencer
e7a820c208 UnRevert "Revert "Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.""
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123605 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 23:39:59 +00:00
Jay Foad
1ed26acc58 Simplify the construction and destruction of Uses. Simplify
User::dropHungOffUses().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123580 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 15:30:52 +00:00
Jay Foad
65762b5494 Remove unnecessary specialization OperandTraits<User>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123577 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 08:23:16 +00:00
Jay Foad
bdbe342e86 Move the implementation of the User class into a new source file,
User.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123575 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 08:10:57 +00:00
Michael J. Spencer
c850965ec0 Revert "Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123557 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 01:43:22 +00:00
Chris Lattner
0092b1142f remove the partial specialization pass. It is unmaintained and has bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 00:27:10 +00:00
Michael J. Spencer
a7a71a375c Archive: Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123552 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:43:45 +00:00
Michael J. Spencer
770772e831 Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123551 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:43:37 +00:00
Michael J. Spencer
36852d3681 Support/GraphWriter: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:43:25 +00:00
Michael J. Spencer
28f0ed5c9d Support/PathV2: Add identify_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 20:39:36 +00:00
Michael J. Spencer
d6cdf1d3cb Support/PathV2: Implement get_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123544 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:52:33 +00:00
Oscar Fuentes
111fd9ce64 Make config.h.cmake similar to config.h.in
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123539 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 13:35:37 +00:00
Nick Lewycky
786c7cd141 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123533 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 09:16:12 +00:00
Chris Lattner
bdf466c27d fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 06:27:35 +00:00
Chris Lattner
4de2c76542 Fix m_Not and m_Neg to not match random ConstantInt's. Before
these would try hard to match constants by inverting the bits
and recursively matching.  There are two problems with this:
1) some patterns would match when we didn't want them to (theoretical)
2) this is insanely expensive to do, and most often pointless.

This was apparently useful in just 2 instcombine cases, which I
added code to handle explicitly.  This change speeds up 'opt'
time on 176.gcc by 1% and produces bitwise identical code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 05:52:27 +00:00
Chris Lattner
deaf55f698 Generalize LoadAndStorePromoter a bit and switch LICM
to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 00:12:35 +00:00
Anton Korobeynikov
3965b5e974 Add a possibility to switch between CFI directives- and table-based frame description emission. Currently all the backends use table-based stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123476 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 21:58:08 +00:00
Anton Korobeynikov
9a1ef4ef36 Add CFI directives-based frame information emission. Not hooked yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123474 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 21:57:53 +00:00
Chris Lattner
a2d845a3ff Add a new LoadAndStorePromoter class, which implements the general
"promote a bunch of load and stores" logic, allowing the code to
be shared and reused.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123456 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 19:36:13 +00:00
Jay Foad
f18e4c3ab4 OperandTraits<>::Layout isn't used for anything. Remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123452 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 18:41:56 +00:00
Oscar Fuentes
da7e2870eb Reorder macros on config.h.cmake to easily compare it against
config.h.in.

Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 16:41:03 +00:00
Chris Lattner
998ef4a92d switch the second scalarrepl pass to use SSAUpdater. We run two scalarrepl passes: one
early in the cleanup code and one late interlaced with the inliner.  The second one is
important because inlining and other scalar optzns can unpin allocas, allowing them to 
be split up and promoted.  While important for performance, this is also relatively
rare, and we would previously force a (non-lazy) computation of DomFrontiers, which 
happened even if nothing became unpinned.

With this patch, the first pass of scalarrepl still promotes the vast bulk of allocas
in programs, but hte second pass has changed to use SSAUpdater, which is more "sparse"
and lazy.  This speeds up opt -O3 time on kimwitu++ (a c++ app) by about 1%.  The
numbers are interesting: the first pass promotes ~17500 allocas.  The second pass
promotes about 1600.  For non-C++ codes, the compile time win should be greater, 
because the second pass of scalarrepl does less.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123437 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 08:21:08 +00:00
Chris Lattner
b352d6eb49 split SROA into two passes: one that uses DomFrontiers (-scalarrepl)
and one that uses SSAUpdater (-scalarrepl-ssa)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123436 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 08:13:00 +00:00
Jay Foad
25052d8d64 Remove casts between Value** and Constant**, which won't work if a
static_cast from Constant* to Value* has to adjust the "this" pointer.
This is groundwork for PR889.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123435 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 08:07:43 +00:00
Evan Cheng
f3eb3bba16 Completed :lower16: / :upper16: support for movw / movt pairs on Darwin.
- Fixed :upper16: fix up routine. It should be shifting down the top 16 bits first.
- Added support for Thumb2 :lower16: and :upper16: fix up.
- Added :upper16: and :lower16: relocation support to mach-o object writer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123424 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 02:38:49 +00:00
Owen Anderson
c5f608b49c Rather than doing early instcombine, try doing early CSE instead. This should still handle
most important simplifications, as well as resolving phase ordering issues where instcombine
would inhibit important CSE'ing opportunities, for instance on BitBench/drop3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123418 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 00:41:11 +00:00
Duncan Sands
c43cee3fbb Move some shift transforms out of instcombine and into InstructionSimplify.
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything.  I fixed this in the constant folder as well.  Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero.  This is in accordance with the LangRef, but I must
admit that it is fairly aggressive.  Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 00:37:45 +00:00
Owen Anderson
68a659d423 Don't bother conditionalizing the use of SROA in -O1 mode. We're already running it unconditionally
later in the pipeline.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123416 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 00:36:40 +00:00
Tobias Grosser
21d842c353 Add single entry / single exit accessors.
Add methods for accessing the (single) entry / exit edge of a region. If no such
edge exists, null is returned.  Both accessors return the start block of the
corresponding edge. The edge can finally be formed by utilizing
Region::getEntry() or Region::getExit();

Contributed by: Andreas Simbuerger <simbuerg@fim.uni-passau.de>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 23:18:04 +00:00
Jakob Stoklund Olesen
4f28c1c714 Teach frame lowering to ignore debug values after the terminators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123399 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 21:28:52 +00:00
Oscar Fuentes
006bfeba06 Add some platform tests.
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 19:17:28 +00:00
Oscar Fuentes
60b531270b Platform tests for argz_* functions.
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123376 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 15:06:32 +00:00
Evan Cheng
7597212abc Model :upper16: and :lower16: as ARM specific MCTargetExpr. This is a step
in the right direction. It eliminated some hacks and will unblock codegen
work. But it's far from being done. It doesn't reject illegal expressions,
e.g. (FOO - :lower16:BAR). It also doesn't work in Thumb2 mode at all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 07:58:56 +00:00
Michael J. Spencer
9df536ca78 Support/Path: Deprecate PathV1::IsSymlink and replace all uses with PathV2::is_symlink.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123345 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 23:55:06 +00:00
Jakob Stoklund Olesen
7fd747ba24 Annotate VirtRegRewriter debug output with slot indexes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123333 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 22:28:48 +00:00
Jakob Stoklund Olesen
a5f1a900df Assert if anybody tries to put a slot index on a DBG_VALUE instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123323 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 21:27:45 +00:00
Jakob Stoklund Olesen
113328db1b Put the Dominator improvements back in. They were not the cause of bootstrap miscomparisons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123273 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 21:23:09 +00:00
Jakob Stoklund Olesen
cbf39b5891 Speculatively revert the recent improvements to Dominators.h in an attempt to track down the gcc bootstrap miscompare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123254 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 19:26:30 +00:00
Chris Lattner
6038a6351e some comment improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123243 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 17:11:59 +00:00
Jay Foad
67c619ba3e FixedNumOperandTraits and VariadicOperandTraits assumed that, given a
"this" pointer for any subclass of User, you could static_cast it to
User* and then reinterpret_cast that to Use* to get the end of the
operand list. This isn't a safe assumption in general, because the
static_cast might adjust the "this" pointer. Fixed by having these
OperandTraits classes take an extra template parameter, which is the
subclass of User. This is groundwork for PR889.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 15:07:38 +00:00
Oscar Fuentes
19823b19ba Add to the CMake build some options and platform tests supported by
the traditional build.

Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123233 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 12:31:54 +00:00
Chris Lattner
b5b7997fd0 Fix FoldSingleEntryPHINodes to update memdep and AA when it deletes
phi nodes.  It is called from MergeBlockIntoPredecessor which is 
called from GVN, which claims to preserve these.

I'm skeptical that this is the actual problem behind PR8954, but
this is a stab in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123222 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 08:13:40 +00:00
Michael J. Spencer
218dc3e2fe Support/Path: Deprecate PathV1::isDirectory and replace all uses with PathV2::is_directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 01:21:55 +00:00
Anton Korobeynikov
16c29b5f28 Rename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes here and there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 12:39:04 +00:00
Jakob Stoklund Olesen
c9df025e33 Simplify a bunch of isVirtualRegister() and isPhysicalRegister() logic.
These functions not longer assert when passed 0, but simply return false instead.

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123155 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 02:58:51 +00:00
Michael J. Spencer
54453f2978 Support/Path: Deprecate PathV1::exists and replace all uses with PathV2::fs::exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123151 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 02:34:23 +00:00
Jakob Stoklund Olesen
b79cb79a46 Remove TargetRegisterInfo::NoRegister.
Fix the TargetRegisterInfo::NoRegister places where someone preferred
typing 'TargetRegisterInfo::NoRegister' instead of typing '0'.

Note that TableGen is already emitting xx::NoRegister in xxGenRegisterNames.inc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 23:20:48 +00:00
Jakob Stoklund Olesen
da1f1f4950 Change virtual register numbering to make more space for physical registers.
The numbering plan is now:

0           NoRegister.
[1;2^30)    Physical registers.
[2^30;2^31) Stack slots.
[2^31;2^32) Virtual registers. (With -1u and -2u used by DenseMapInfo.)

Each segment is filled from the left, so any mistaken interpretation should
quickly cause crashes.

FirstVirtualRegister has been removed. TargetRegisterInfo provides predicates
conversion functions that should be used instead of interpreting register
numbers manually.

It is now legal to pass NoRegister to isPhysicalRegister() and
isVirtualRegister(). The result is false in both cases.

It is quite rare to represent stack slots in this way, so isPhysicalRegister()
and isVirtualRegister() require that isStackSlot() be checked first if it can
possibly return true. This allows a very fast implementation of the common
predicates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 22:42:48 +00:00
Chris Lattner
992efb0378 Step #2 to improve trip count analysis for loops like this:
void f(int* begin, int* end) { std::fill(begin, end, 0); }

which turns into a != exit expression where one pointer is
strided and (thanks to step #1) known to not overflow, and 
the other is loop invariant.

The observation here is that, though the IV is strided by
4 in this case, that the IV *has* to become equal to the
end value.  It cannot "miss" the end value by stepping over
it, because if it did, the strided IV expression would
eventually wrap around.

Handle this by turning A != B into "A-B != 0" where the A-B
part is known to be NUW.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123131 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 22:26:35 +00:00
Jakob Stoklund Olesen
42e9c96392 Remove MachineRegisterInfo::getLastVirtReg(), it was giving wrong results
when no virtual registers have been allocated.

It was only used to resize IndexedMaps, so provide an IndexedMap::resize()
method such that

 Map.grow(MRI.getLastVirtReg());

can be replaced with the simpler

 Map.resize(MRI.getNumVirtRegs());

This works correctly when no virtuals are allocated, and it bypasses the to/from
index conversions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123130 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 21:58:20 +00:00
Jakob Stoklund Olesen
be97e906e0 Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers.

This makes the hack used in LiveInterval official, and lets LiveInterval be
oblivious of stack slots.

The isPhysicalRegister() and isVirtualRegister() predicates don't know about
this, so when a variable may contain a stack slot, isStackSlot() should always
be tested first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 21:17:37 +00:00
Jakob Stoklund Olesen
43a566519b Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123125 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 19:45:45 +00:00
Tobias Grosser
3a723ab344 DominatorTree->print() now prints the status of the DFSNumbers correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123120 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 16:00:09 +00:00
Oscar Fuentes
2c5e0b8b98 Rewrite handling of LLVM_ENABLE_PIC. It was being processed after
config.h was generated, so it had no effect on it.

Thanks to arrowdodger for pointing out this and a tentative patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123119 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 14:34:39 +00:00
Jakob Stoklund Olesen
0804ead404 Simplify LiveDebugVariables by storing MachineOperand copies locations instead
of using a Location class with the same information.

When making a copy of a MachineOperand that was already stored in a
MachineInstr, it is necessary to clear the parent pointer on the copy. Otherwise
the register use-def lists become inconsistent.

Add MachineOperand::clearParent() to do that. An alternative would be a custom
MachineOperand copy constructor that cleared ParentMI. I didn't want to do that
because of the performance impact.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 05:33:21 +00:00
Jakob Stoklund Olesen
4314268128 Replace TargetRegisterInfo::printReg with a PrintReg class that also works without a TRI instance.
Print virtual registers numbered from 0 instead of the arbitrary
FirstVirtualRegister. The first virtual register is printed as %vreg0.
TRI::NoRegister is printed as %noreg.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 03:05:53 +00:00
Jakob Stoklund Olesen
994c727b57 Use IndexedMap for MachineRegisterInfo as well. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 03:05:46 +00:00
Jakob Stoklund Olesen
c7d67f90d3 Fix VirtRegMap to use TRI::index2VirtReg and TRI::virtReg2Index instead of
depending on TRI::FirstVirtualRegister.

Also use TRI::printReg instead of printing virtual registers directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123101 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:11:07 +00:00
Jakob Stoklund Olesen
b421c566f5 Use an IndexedMap for LiveVariables::VirtRegInfo.
Provide MRI::getNumVirtRegs() and TRI::index2VirtReg() functions to allow
iteration over virtual registers without depending on the representation of
virtual register numbers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123098 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:10:57 +00:00
Jakob Stoklund Olesen
56e4d89642 Do not talk about TargetRegisterInfo::FirstVirtualRegister.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:10:53 +00:00
Jakob Stoklund Olesen
358de24dc1 Use an IndexedMap for LiveOutRegInfo to hide its dependence on TargetRegisterInfo::FirstVirtualRegister.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123096 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:10:50 +00:00
Chris Lattner
2feee6454d fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:53:41 +00:00
Rafael Espindola
bea4626f93 First step in fixing PR8927:
Add a unnamed_addr bit to global variables and functions. This will be used
to indicate that the address is not significant and therefore the constant
or function can be merged with others.

If an optimization pass can show that an address is not used, it can set this.

Examples of things that can have this set by the FE are globals created to
hold string literals and C++ constructors.

Adding unnamed_addr to a non-const global should have no effect unless
an optimization can transform that global into a constant.

Aliases are not allowed to have unnamed_addr since I couldn't figure
out any use for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 16:42:36 +00:00
Chris Lattner
c3942eb95d make this file properly self contained.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123059 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 08:19:49 +00:00
Chris Lattner
b5fa5fcecc Revamp the ValueMapper interfaces in a couple ways:
1. Take a flags argument instead of a bool.  This makes
   it more clear to the reader what it is used for.
2. Add a flag that says that "remapping a value not in the
   map is ok".
3. Reimplement MapValue to share a bunch of code and be a lot
   more efficient.  For lookup failures, don't drop null values
   into the map.
4. Using the new flag a bunch of code can vaporize in LinkModules
   and LoopUnswitch, kill it.

No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 08:15:20 +00:00
Evan Cheng
55d4200336 Recognize inline asm 'rev /bin/bash, ' as a bswap intrinsic call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123048 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 01:24:27 +00:00
Evan Cheng
c36b7069b4 Do not model all INLINEASM instructions as having unmodelled side effects.
Instead encode llvm IR level property "HasSideEffects" in an operand (shared
with IsAlignStack). Added MachineInstrs::hasUnmodeledSideEffects() to check
the operand when the instruction is an INLINEASM.

This allows memory instructions to be moved around INLINEASM instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123044 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 23:50:32 +00:00
Devang Patel
6a6623c596 Do not include DataTypes.h in llvm-c/lto.h.
This means avoid using uint32_t. This patch reverts r112200 and fixes original  problem by fixing argument type in lto.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123038 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 22:26:25 +00:00
Evan Cheng
7c7e2da4aa Fix comment. INLINEASM node operand #3 is IsAlignStack bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123036 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:38:59 +00:00
Evan Cheng
30a343aeed DBG_VALUE does not have any side effects; it also makes no sense to mark it cheap as a copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123031 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:08:26 +00:00
Jay Foad
8e3914d12e Simplify the allocation and freeing of Users' operand lists, now that
every BranchInst has a fixed number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:29:02 +00:00
Jay Foad
43eaadeea5 Remove the "ugly" method BranchInst::setUnconditionalDest().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123026 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:26:51 +00:00
Bob Wilson
5e8b833707 Add ARM patterns to match EXTRACT_SUBVECTOR nodes.
Also fix an off-by-one in SelectionDAGBuilder that was preventing shuffle
vectors from being translated to EXTRACT_SUBVECTOR.
Patch by Tim Northover.

The test changes are needed to keep those spill-q tests from testing aligned
spills and restores.  If the only aligned stack objects are spill slots, we
no longer realign the stack frame.  Prior to this patch, an EXTRACT_SUBVECTOR
was legalized by loading from the stack, which created an aligned frame index.
Now, however, there is nothing except the spill slot in the stack frame, so
I added an aligned alloca.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:59:04 +00:00
Bob Wilson
6736e19f4c Change EXTRACT_SUBVECTOR to require a constant index.
We were never generating any of these nodes with variable indices, and there
was one legalizer function asserting on a non-constant index.  If we ever have
a need to support variable indices, we can add this back again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122993 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:58:56 +00:00
Evan Cheng
0521928ae7 Re-implement r122936 with proper target hooks. Now getMaxStoresPerMemcpy
etc. takes an option OptSize. If OptSize is true, it would return
the inline limit for functions with attribute OptSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:52:41 +00:00
Jakob Stoklund Olesen
8bfe50871f Add the SpillPlacement analysis pass.
This pass precomputes CFG block frequency information that can be used by the
register allocator to find optimal spill code placement.

Given an interference pattern, placeSpills() will compute which basic blocks
should have the current variable enter or exit in a register, and which blocks
prefer the stack.

The algorithm is ready to consume block frequencies from profiling data, but for
now it gets by with the static estimates used for spill weights.

This is a work in progress and still not hooked up to RegAllocGreedy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122938 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:21:53 +00:00
Bob Wilson
bfb7dd9e9e Revert svn 122743, removing the instcombine pass that was replaced by earlycse.
My i386 llvm-gcc nightly tester found a regression for
SingleSource/Benchmarks/McGill/chomp that a bisect blamed on 122743.
That seems strange but apparently the combination of earlycse and instcombine
did something bad.  Chris says he intended to remove the instcombine pass, so
let's go ahead and try that.  We'll see if there are any performance losses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:16:50 +00:00
Wesley Peck
4351bfbd4d Fix small bug in setDebugInfoAvailability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 17:01:57 +00:00
Chris Lattner
be478819cb Fix PR8906: -fno-builtin should disable loop-idiom recognition.
It forms memset and memcpy's, and will someday form popcount and
other stuff.  All of this is bad when compiling the implementation
of memset, memcpy, popcount, etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122854 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 01:03:32 +00:00
Jakob Stoklund Olesen
631ee4b89f Use the EdgeBundles analysis in X86FloatingPoint instead of recomputing CFG
bundles in the pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122833 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 21:10:11 +00:00
Jakob Stoklund Olesen
8dd070edc2 Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.
The analysis will be needed by both the greedy register allocator and the
X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't
change.

This pass is very fast, usually showing up as 0.0% wall time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122832 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 21:10:05 +00:00
Owen Anderson
19af2ed415 Give MachineFunctionAnalysis a getPassName() implementation to make timing reports prettier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122816 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 18:21:18 +00:00
Duncan Sands
c449a224bb These methods should be "const"; make them so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 12:52:29 +00:00
Owen Anderson
ab6acc6ecd Stub out a new updating interface to AliasAnalysis, allowing stateful analyses to be informed when
a pointer value has potentially become escaping.  Implementations can choose to either fall back to
conservative responses for that value, or may recompute their analysis to accomodate the change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122777 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 21:38:41 +00:00
Evan Cheng
cc3d8e3c22 Undo what looks like accidental removal of an instcombine pass in r122740.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122743 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 07:53:18 +00:00
Chris Lattner
db5f5e64fe Turn on earlycse by default. This seems to be a small performance
improvement in the generated code, and speeds up 'opt -std-compile-opts'
compile time on 176.gcc from 24.84s to 23.2s (about 7%).

This also resolves a specific code quality issue in rdar://7352081 which
was generating poor code for:

int t(int a, int b) {
  if (a & b & 1)
    return a & b;
  return 3;
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122740 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 06:19:09 +00:00
Nick Lewycky
9ad1cb59de Add spliceFunction to the CallGraph interface. This allows users to efficiently
update a callGraph when performing the common operation of splicing the body to
a new function and updating all callers (such as via RAUW).

No users yet, though this is intended for DeadArgumentElimination as part of
PR8887.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122728 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 03:19:35 +00:00
Chris Lattner
152096275a add a handy typedef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 03:16:20 +00:00
Chris Lattner
4f20c6d354 really get this working with a custom allocator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 01:38:29 +00:00
Chris Lattner
61a10a0dc9 Enhance ScopedHashTable to allow it to take an allocator argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122721 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 01:29:37 +00:00
Cameron Zwarich
832f61117d Add a new loop-instsimplify pass, with the intention of replacing the instance
of instcombine that is currently in the middle of the loop pass pipeline. This
commit only checks in the pass; it will hopefully be enabled by default later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122719 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 00:25:16 +00:00
Chris Lattner
9fc5cdf77c split dom frontier handling stuff out to its own DominanceFrontier header,
so that Dominators.h is *just* domtree.  Also prune #includes a bit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 22:09:33 +00:00
Chris Lattner
12be936cc9 sketch out a new early cse pass. No functionality yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122713 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 21:47:05 +00:00
Cameron Zwarich
86a582ddfb Remove an unused member function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122693 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 12:37:22 +00:00
Cameron Zwarich
94942cec11 Fix a typo in a variable name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122691 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 12:17:10 +00:00
Cameron Zwarich
63e07d72f8 Move a load into the only branch where it is used and eliminate a temporary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122690 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:50:14 +00:00
Cameron Zwarich
2a8c22aa68 Add the explanatory comment from r122680's commit message to the code itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122689 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:40:14 +00:00
Cameron Zwarich
19feb4ca8a Tidy up indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122688 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:10:02 +00:00
Cameron Zwarich
a4d93162cb Fix a typo, which should also fix the failure on llvm-x86_64-linux-checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122687 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:06:44 +00:00