Commit Graph

6646 Commits

Author SHA1 Message Date
Gabor Greif
607a7ab3da back out r101423 and r101397, they break llvm-gcc self-host on darwin10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:16:20 +00:00
Chris Lattner
d55c1c1659 fix PR6832: we were using the alignment of a pointer when we
wanted the alignment of the pointee.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:05:38 +00:00
Chris Lattner
a001b66498 improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101429 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:38:19 +00:00
Chris Lattner
4cc576bc5e pull all the ConvertToScalarInfo code together into one
place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:24:57 +00:00
Chris Lattner
593375d04a more refactoring: suck some stuff out of SRoA into
ConvertToScalarInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:20:00 +00:00
Gabor Greif
8db3f2c2ab shift intrinsic operand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:06:45 +00:00
Chris Lattner
c447207264 introduce a new ConvertToScalarInfo struct to simplify
CanConvertToScalar/MergeInType.  Eliminate a pointless
LLVMContext argument to MergeInType.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 23:50:26 +00:00
Chris Lattner
31d80103d5 tidy interface to isOnlyCopiedFromConstantGlobal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 21:59:20 +00:00
Gabor Greif
2ff961f668 reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 20:51:13 +00:00
Anton Korobeynikov
764f62ba60 Revert r100896 and around - this breaks the only mingw32 buildbot we have.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 19:51:42 +00:00
Dan Gohman
b35798347e Fix a bunch of namespace polution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 17:08:50 +00:00
Gabor Greif
9ee1720811 back out r101364, as it trips the linux nightlybot on some clang C++ tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 12:46:56 +00:00
Gabor Greif
165dac08d1 rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 10:49:53 +00:00
Tobias Grosser
a76b334d44 IPO needs ScalarOpts and InstCombine in its libs
The commit "Adding IPSCCP and Internalize passes to the C-bindings" introduced
new dependencies for IPO. Add these to the CMAKE build as otherwise the
BUILD_SHARED_LIBS=1 build fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101313 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 23:42:23 +00:00
Evan Cheng
86cd445645 - Code clean up to reduce indentation.
- TryToOptimizeStoreOfMallocToGlobal should check if TargetData is available and bail out if it is not. The transformations being done requires TD.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 20:52:55 +00:00
Gabor Greif
67894a3d02 performance: cache the dereferenced use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101253 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 16:48:56 +00:00
Gabor Greif
488d4421c6 performance: cache the dereferenced use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 16:13:56 +00:00
Nick Lewycky
3c594ff290 I don't know how, but I managed to goof the revert. Remove function that should
have been removed in r101231.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 05:03:50 +00:00
Nick Lewycky
3715e45da5 Revert r101213.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 04:51:58 +00:00
Nick Lewycky
ff1ef6bdf1 Remove tab.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 04:19:05 +00:00
Nick Lewycky
5894c0b60e While DAE can't modify the function signature of an externally visible function,
it can check whether the visible direct callers are passing in parameters to
dead arguments and replace those with undef.

This reinstates r94322 with bugs fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 03:38:11 +00:00
Eric Christopher
2a7cb9d9ce Actually... return after the check for invalid input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 16:41:29 +00:00
Owen Anderson
d5e624027a Remove SCCVN from the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101125 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 08:33:09 +00:00
Owen Anderson
fd64901579 SCCVN, we hardly knew ye!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101117 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 05:24:08 +00:00
Dan Gohman
a590b79ee2 Teach IndVarSimplify how to eliminate remainder operators where the
numerator is an induction variable. For example, with code like this:

  for (i=0;i<n;++i)
    x[i%n] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the remainder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 01:46:36 +00:00
Dan Gohman
ca9b7037e2 Suppress LinearFunctionTestReplace when the computed backedge-taken
expression is a UDiv and it doesn't appear that the UDiv came from
the user's source.

ScalarEvolution has recently figured out how to compute a tripcount
expression for the inner loop in
SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a
udiv instruction dramatically slows down the enclosing loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101068 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 21:13:43 +00:00
Dan Gohman
ef817ccec4 Delete this code, which is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 08:00:22 +00:00
Dan Gohman
d890f29ca6 Move the EliminateIVUsers call back out to its original location. Now that
a ScalarEvolution bug with overflow handling is fixed, the normal analysis
code will automatically decline to operate on the icmp instructions which
are responsible for the loop exit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 07:56:56 +00:00
Dan Gohman
dd842e34c8 Use RecursivelyDeleteTriviallyDeadInstructions in EliminateIVComparisons,
instead of deleting just the user. This makes it more consistent with
other code in IndVarSimplify, and theoretically can eliminate more users
earlier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 07:29:15 +00:00
Eric Christopher
67a71b5306 Verify function prototypes before trying to optimize functions. We also
need TargetData, just return false if we don't have it.

Update testcases accordingly.

Fixes PR6807.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 04:48:00 +00:00
Dan Gohman
931e345e76 Re-apply r101000, with a fix: Don't eliminate an icmp which is part of
the loop exit test. This usually doesn't come up for a variety of
reasons, but it isn't impossible, so make IndVarSimplify handle it
conservatively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101008 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 02:21:50 +00:00
Dan Gohman
ac3b9cdf15 Revert 101000, which is breaking self-host builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 00:17:10 +00:00
Dan Gohman
3fddbb337d Teach IndVarSimplify how to eliminate comparisons involving induction
variables. For example, with code like this:

  for (i=0;i<n;++i)
    if (i<n)
      x[i] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the if.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-11 23:10:12 +00:00
Dan Gohman
3948d0b8b0 Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
that it's only testing for the entry condition, not full loop-invariant
conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-11 19:27:13 +00:00
Chris Lattner
5106dcd078 Implement support for varargs functions without any fixed
parameters in the CBE by implicitly adding a fixed argument.
This allows eliminating a work-around from DAE.  Patch by
Sylvere Teissier!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 19:12:44 +00:00
Chris Lattner
6f285d2105 fix PR6743, a case where we'd delete an instruction before using it
in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100937 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 18:26:57 +00:00
Chris Lattner
a2fb234b04 fix PR6760, a missing check in heap SRoA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100936 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 18:19:22 +00:00
Dan Gohman
e5f76877ae When determining a canonical insert position, don't climb deeper
into adjacent loops. Also, ensure that the insert position is
dominated by the loop latch of any loop in the post-inc set which
has a latch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100906 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 22:07:05 +00:00
Chris Lattner
e3a39d40db suck the propagating "has dynamic libs" check into a single makefile
variable TARGET_HAS_DYNAMIC_LIBS


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 20:51:47 +00:00
Chris Lattner
21aa347c28 add minix support, patch by Kees van Reeuwijk! PR6797
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 20:45:04 +00:00
Wesley Peck
16ddd885d8 Adding IPSCCP and Internalize passes to the C-bindings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 20:43:20 +00:00
Dan Gohman
4a2a683366 When looking for loop-invariant users, look through no-op instructions,
so that an unfortunately placed bitcast doesn't pin a value in a
register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 19:12:34 +00:00
Gabor Greif
c092362300 performance: cache result of looking up user
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 15:18:34 +00:00
Dan Gohman
6c3ae655b8 Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 14:53:59 +00:00
Gabor Greif
ea3eec9f85 const-ize a predicate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 10:57:00 +00:00
Dan Gohman
d96eae8010 Refactor the code for computing the insertion point for an expression into
a separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 02:00:38 +00:00
Chris Lattner
8829cec25f fix a SCCP miscompilation that could happen when a
forced constant is changed to a constant, we would end
up adding the instruction to the wrong worklist, 
preventing it from being properly revisited.  This fixes
rdar://7832370


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 01:14:31 +00:00
Dan Gohman
e60bb15982 Avoid allocating a value of zero in a register if the initial formula
inputs happen to negate each other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 23:36:27 +00:00
Dan Gohman
e056781323 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 23:03:40 +00:00
Dan Gohman
701a4aef7f When expanding expressions which are using post-inc mode for multiple loops,
ensure that the expansion is dominated by the increments of those loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 05:57:57 +00:00