Owen Anderson
9f2bca02d7
Experiments show that we can safely increase our unrolling threshold without unduly impacting code size, particularly
...
since unrolling is not enabled at -Os.
llvm-svn: 110233
2010-08-04 18:32:46 +00:00
Dan Gohman
ba81fc16a5
Fix whitespace.
...
llvm-svn: 110223
2010-08-04 17:43:57 +00:00
Dan Gohman
839c972102
Fix a comment.
...
llvm-svn: 110181
2010-08-04 01:16:35 +00:00
Peter Collingbourne
ddaaf40d24
Add an atomic lowering pass
...
llvm-svn: 110113
2010-08-03 16:19:16 +00:00
Oscar Fuentes
40b31ad3ee
Prefix `next' iterator operation with `llvm::'.
...
Fixes potential ambiguity problems on VS 2010.
Patch by nobled!
llvm-svn: 110029
2010-08-02 06:00:15 +00:00
Nick Lewycky
299c6dfcbf
Add missing newline to debug statement.
...
llvm-svn: 109886
2010-07-30 20:27:01 +00:00
Gabor Greif
62f0aac99d
simplify by using CallSite constructors; virtually eliminates CallSite::get from the tree
...
llvm-svn: 109687
2010-07-28 22:50:26 +00:00
Gabor Greif
0a970698da
use Value* constructor of CallSite to create potentially improper site, and test that
...
llvm-svn: 109581
2010-07-28 14:28:18 +00:00
Gabor Greif
f159085414
recommit simplification (r109502, backed out r109509); seems to innocent
...
llvm-svn: 109510
2010-07-27 16:44:23 +00:00
Gabor Greif
5f91b7cf3e
back out this too to restore the bots
...
llvm-svn: 109509
2010-07-27 15:56:07 +00:00
Gabor Greif
7527b2ed5c
simplify
...
llvm-svn: 109502
2010-07-27 13:31:22 +00:00
Owen Anderson
aa7f66ba67
Add an initial implementation of LazyValueInfo updating for JumpThreading. Disabled for now.
...
llvm-svn: 109424
2010-07-26 18:48:03 +00:00
Dan Gohman
0141c13b22
Remove LCSSA's bogus dependence on LoopSimplify and LoopSimplify's bogus
...
dependence on DominanceFrontier. Instead, add an explicit DominanceFrontier
pass in StandardPasses.h to ensure that it gets scheduled at the right
time.
Declare that loop unrolling preserves ScalarEvolution, and shuffle some
getAnalysisUsages.
This eliminates one LoopSimplify and one LCCSA run in the standard
compile opts sequence.
llvm-svn: 109413
2010-07-26 18:11:16 +00:00
Dan Gohman
65b257c9d2
Use DominatorTree::properlyDominates instead of dominates with an
...
explicit inequality check.
llvm-svn: 109401
2010-07-26 17:37:36 +00:00
Dan Gohman
31f73ef210
A block dominates itself, by definition.
...
llvm-svn: 109400
2010-07-26 17:35:32 +00:00
Gabor Greif
dde79d8f1a
mass elimination of reliance on automatic iterator dereferencing
...
llvm-svn: 109103
2010-07-22 13:36:47 +00:00
Gabor Greif
3e44ea1917
undo 80 column trespassing I caused
...
llvm-svn: 109092
2010-07-22 10:37:47 +00:00
Owen Anderson
a57b97e7e7
Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
...
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Dan Gohman
12725c7d46
Remember that the induction variable is always a PHINode and
...
use getIncomingValueForBlock instead of
LoopInfo::getCanonicalInductionVariableIncrement.
llvm-svn: 108865
2010-07-20 17:18:52 +00:00
Dan Gohman
efd7f9c360
Reorder the contents of various getAnalysisUsage functions, eliminating
...
a redundant loopsimplify run from the default -O2 sequence.
llvm-svn: 108539
2010-07-16 17:58:45 +00:00
Gabor Greif
6d673953e3
eliminate CallInst::ArgOffset
...
llvm-svn: 108522
2010-07-16 09:38:02 +00:00
Dan Gohman
1415208292
Don't merge uses when they are targetting fixup sites with
...
different widths. In a use with a narrower fixup, formulae
may be wider than the fixup, in which case the high bits
aren't necessarily meaningful, so it isn't safe to reuse
them for uses with wider fixups.
This fixes PR7618, though the testcase is too large for a
reasonable regression test, since it heavily dependes on
hitting LSR's heuristics in a certain way.
llvm-svn: 108455
2010-07-15 20:24:58 +00:00
Dan Gohman
a1501b9c50
Use dbgs() instead of errs() in a DEBUG.
...
llvm-svn: 108453
2010-07-15 20:12:42 +00:00
Dan Gohman
4afd412d6b
Watch out for a constant offset cancelling out a base register, forming
...
a zero. This situation arrises in Fortran code with induction variables
that start at 1 instead of 0. This fixes PR7651.
llvm-svn: 108424
2010-07-15 15:14:45 +00:00
Duncan Sands
f88a284579
Handle the case of a tail recursion in which the tail call is followed
...
by a return that returns a constant, while elsewhere in the function
another return instruction returns a different constant. This is a
special case of accumulator recursion, so just generalize the existing
logic a bit.
llvm-svn: 108241
2010-07-13 15:41:41 +00:00
Gabor Greif
a5fa885d47
cache results of operator*
...
llvm-svn: 108142
2010-07-12 14:10:24 +00:00
Gabor Greif
782f62412f
cache dereferenced iterators
...
llvm-svn: 108138
2010-07-12 12:03:02 +00:00
Gabor Greif
433b975fe2
recommit r108131 (hich has been backed out in r108135) with a fix
...
llvm-svn: 108137
2010-07-12 12:02:10 +00:00
Gabor Greif
f9610827ce
back out r108131 (of TailDuplication.cpp) for now, it causes a buildbot failure
...
llvm-svn: 108135
2010-07-12 11:32:39 +00:00
Gabor Greif
2a464d7308
cache dereferenced iterators
...
llvm-svn: 108131
2010-07-12 10:36:48 +00:00
Duncan Sands
41b4a6b36a
Convert some tab stops into spaces.
...
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Chris Lattner
bbc25ff5cc
if jump threading is able to infer interesting values on both
...
the LHS and RHS of an and/or instruction, don't multiply add
known predecessor values. This fixes the crash on testcase
from PR7498
llvm-svn: 108114
2010-07-12 00:47:34 +00:00
Duncan Sands
82b21c086e
The accumulator tail recursion transform claims to work for any associative
...
operation, but the way it's implemented requires the operation to also be
commutative. So add a check for commutativity (and tweak the corresponding
comments). This makes no difference in practice since every associative
LLVM instruction is also commutative! Here's an example to show the need
for commutativity: the accum_recursion.ll testcase calculates the factorial
function. Before the transformation the result of a call is
((((1*1)*2)*3)...)*x
while afterwards it is
(((1*x)*(x-1))...*2)*1
which clearly requires both associativity and commutativity of * to be equal
to the original.
llvm-svn: 108056
2010-07-10 20:31:42 +00:00
Gabor Greif
e82532a1c5
cache result of operator*
...
llvm-svn: 107976
2010-07-09 15:40:10 +00:00
Gabor Greif
d323f5e161
cache result of operator* (found by inspection)
...
llvm-svn: 107971
2010-07-09 14:48:08 +00:00
Gabor Greif
b0d56ffc85
cache result of operator*
...
llvm-svn: 107969
2010-07-09 14:36:49 +00:00
Chris Lattner
efa3c824cc
Fix the second half of PR7437: scalarrepl wasn't preserving
...
address spaces when SRoA'ing memcpy's.
llvm-svn: 107846
2010-07-08 00:27:05 +00:00
Nick Lewycky
dace239949
Detabify this file.
...
llvm-svn: 107637
2010-07-06 03:53:43 +00:00
Dan Gohman
832282e061
Don't claim to preserve AliasAnalysis. First, this is doesn't actually
...
have any effect, and second, deleting stores can potentially invalidate
an AliasAnalysis, and there's currently no notification for this.
llvm-svn: 107496
2010-07-02 18:43:05 +00:00
Gabor Greif
74470192d7
use ArgOperand API
...
llvm-svn: 107278
2010-06-30 12:42:43 +00:00
Gabor Greif
743b3fd196
use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
...
llvm-svn: 107273
2010-06-30 09:19:23 +00:00
Gabor Greif
f628ecd15f
use getNumArgOperands instead of getNumOperands
...
llvm-svn: 107272
2010-06-30 09:17:53 +00:00
Gabor Greif
fe252e6fa0
use getArgOperand instead of getOperand
...
llvm-svn: 107271
2010-06-30 09:16:16 +00:00
Gabor Greif
8ae3095286
use getArgOperand instead of getOperand
...
llvm-svn: 107270
2010-06-30 09:15:28 +00:00
Gabor Greif
18c5bae727
employ CallInst::ArgOffset (for now)
...
llvm-svn: 107015
2010-06-28 16:43:57 +00:00
Gabor Greif
4300fc77ae
use cached value
...
llvm-svn: 107000
2010-06-28 11:20:42 +00:00
Chris Lattner
25a843fcd2
minor cleanup to SROA: when lowering type unsafe accesses to
...
large integers, the first inserted value would always create
an 'or X, 0'. Even though this is trivially zapped by
instcombine, don't bother creating this pointless instruction.
llvm-svn: 106979
2010-06-27 07:58:26 +00:00
Duncan Sands
3a5cb69cb8
Fix PR7328: when turning a tail recursion into a loop, need to preserve
...
the returned value after the tail call if it differs from other return
values. The optimal thing to do would be to introduce a phi node for
the return value, but for the moment just fix the miscompile.
llvm-svn: 106947
2010-06-26 12:53:31 +00:00
Dan Gohman
fb9712bdae
In GenerateReassociations, don't bother thinking about individual
...
SCEVUnknown values which are loop-variant, as LSR can't do anything
interesting with these values in any case. This fixes very slow compile
times on loops which have large numbers of such values.
llvm-svn: 106897
2010-06-25 22:32:18 +00:00
Dale Johannesen
ce97d55ad9
The hasMemory argument is irrelevant to how the argument
...
for an "i" constraint should get lowered; PR 6309. While
this argument was passed around a lot, this is the only
place it was used, so it goes away from a lot of other
places.
llvm-svn: 106893
2010-06-25 21:55:36 +00:00
Gabor Greif
07e9284c75
use ArgOperand API; tighten type of handleFreeWithNonTrivialDependency to be able to use isFreeCall whithout a cast or new overload
...
llvm-svn: 106823
2010-06-25 07:40:32 +00:00
Dan Gohman
963b1c142e
A few minor micro-optimizations.
...
llvm-svn: 106764
2010-06-24 16:57:52 +00:00
Dan Gohman
47ddf76d89
Teach getExactSDiv to evaluate x/1 to x up front, as it's a common
...
enough special case, and it theoretically allows more folding because
it works even when x is unanalyzable.
llvm-svn: 106763
2010-06-24 16:51:25 +00:00
Dan Gohman
ab5422200b
Fix copy+pasto issues in isMulSExtable.
...
llvm-svn: 106759
2010-06-24 16:45:11 +00:00
Gabor Greif
91f9589057
use ArgOperand API; introduce downcasted pointers into scope to facilitate this
...
llvm-svn: 106734
2010-06-24 12:03:56 +00:00
Gabor Greif
e2f482ca0b
use ArgOperand API
...
llvm-svn: 106731
2010-06-24 10:42:46 +00:00
Gabor Greif
2d958d4db5
use ArgOperand API
...
llvm-svn: 106730
2010-06-24 10:17:17 +00:00
Gabor Greif
5bcaa55761
use callsite to obtain all arguments
...
llvm-svn: 106729
2010-06-24 10:04:07 +00:00
Gabor Greif
0f60709f0e
use getNumArgOperands
...
llvm-svn: 106709
2010-06-24 00:48:48 +00:00
Gabor Greif
4a39b84a9d
use ArgOperand API
...
llvm-svn: 106707
2010-06-24 00:44:01 +00:00
Devang Patel
0dc3c2d37e
Use ValueMap instead of DenseMap.
...
The ValueMapper used by various cloning utility maps MDNodes also.
llvm-svn: 106706
2010-06-24 00:33:28 +00:00
Dan Gohman
1081f1a0f5
Fix OptimizeMax to handle an odd case where one of the max operands
...
is another max which folds. This fixes PR7454.
llvm-svn: 106594
2010-06-22 23:07:13 +00:00
Dan Gohman
d2d1ae105d
Use pre-increment instead of post-increment when the result is not used.
...
llvm-svn: 106542
2010-06-22 15:08:57 +00:00
Dan Gohman
dd41bba517
Use A.append(...) instead of A.insert(A.end(), ...) when A is a
...
SmallVector, and other SmallVector simplifications.
llvm-svn: 106452
2010-06-21 19:47:52 +00:00
Dan Gohman
32655906e4
Add a TODO comment.
...
llvm-svn: 106397
2010-06-19 21:30:18 +00:00
Dan Gohman
51d00092b6
Include the use kind along with the expression in the key of the
...
use sharing map. The reconcileNewOffset logic already forces a
separate use if the kinds differ, so incorporating the kind in the
key means we can track more sharing opportunities.
More sharing means fewer total uses to track, which means smaller
problem sizes, which means the conservative throttles don't kick
in as often.
llvm-svn: 106396
2010-06-19 21:29:59 +00:00
Dan Gohman
297fb8b9fc
Don't include things in anonymous namespaces that don't need it.
...
llvm-svn: 106395
2010-06-19 21:21:39 +00:00
Dan Gohman
f3aea7aecf
Disable indvars on loops when LoopSimplify form is not available.
...
This fixes PR7333.
llvm-svn: 106267
2010-06-18 01:35:11 +00:00
Rafael Espindola
a20e2dfe86
Make sure that simplify libcalls does not replace a call with one calling
...
convention with a new call with a different calling convention.
llvm-svn: 106134
2010-06-16 19:34:01 +00:00
Benjamin Kramer
a13bd20396
simplify-libcalls: fold strncmp(x, y, 1) -> memcmp(x, y, 1)
...
The memcmp will be optimized further and even the pathological case
'strstr(x, "x") == x' generates optimal code now.
llvm-svn: 106097
2010-06-16 10:30:29 +00:00
Benjamin Kramer
1118860e3a
simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0
...
llvm-svn: 106047
2010-06-15 21:34:25 +00:00
Chris Lattner
329ea064ed
jump threading can't split a critical edge from an indirectbr. This
...
fixes PR7356.
llvm-svn: 105950
2010-06-14 19:45:43 +00:00
Benjamin Kramer
b82de426de
SimplifyCFG: don't turn volatile stores to null/undef into unreachable. Fixes PR7369.
...
llvm-svn: 105914
2010-06-13 14:35:54 +00:00
Kenneth Uildriks
9b21208bfb
Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it can be reused from PartialSpecializationCost
...
llvm-svn: 105725
2010-06-09 15:11:37 +00:00
Dan Gohman
67b4403101
Don't track users of undef values; they aren't interesting for
...
register pressure.
llvm-svn: 105501
2010-06-04 23:16:05 +00:00
Dan Gohman
826bdf8c10
Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
...
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.
llvm-svn: 104949
2010-05-28 16:19:17 +00:00
Benjamin Kramer
6877119ef3
Kill unneeded SExt.
...
llvm-svn: 104692
2010-05-26 09:45:04 +00:00
Benjamin Kramer
9439084cea
Properly promote operands when optimizing a single-character memcmp.
...
llvm-svn: 104648
2010-05-25 22:53:43 +00:00
Dan Gohman
9b48b856ea
DominatorTree.getNode can return null for unreachable blocks.
...
llvm-svn: 104290
2010-05-20 22:46:54 +00:00
Dan Gohman
86110fa2bb
Minor code cleanups.
...
llvm-svn: 104287
2010-05-20 22:25:20 +00:00
Dan Gohman
6295f2ebb8
Make Solve check its own post-condition, to reduce clutter in the
...
top-level LSRInstance logic.
llvm-svn: 104278
2010-05-20 20:59:23 +00:00
Dan Gohman
a4ca28a3ae
Add comments.
...
llvm-svn: 104276
2010-05-20 20:52:00 +00:00
Dan Gohman
927bcaadda
More code cleanups. Use iterators instead of indices when indices
...
aren't needed.
llvm-svn: 104273
2010-05-20 20:33:18 +00:00
Dan Gohman
4c4043cf34
Fix OptimizeShadowIV to set Changed. Change OptimizeLoopTermCond to set
...
Changed directly instead of using a return value.
Rename FilterOutUndesirableDedicatedRegisters's Changed variable to
distinguish it from LSRInstance's Changed member.
llvm-svn: 104269
2010-05-20 20:05:31 +00:00
Dan Gohman
8ec018cedf
Add some comments.
...
llvm-svn: 104268
2010-05-20 20:00:41 +00:00
Dan Gohman
8ce95cc3c5
Simplify this code. Don't do a DomTreeNode lookup for each visited block.
...
llvm-svn: 104267
2010-05-20 20:00:25 +00:00
Dan Gohman
ab5fb7f559
Minor code cleanups.
...
llvm-svn: 104263
2010-05-20 19:44:23 +00:00
Dan Gohman
ee2fea3cd7
When canonicalizing icmp operand order to put the loop invariant
...
operand on the left, the interesting operand is on the right. This
fixes a bug where LSR was failing to recognize ICmpZero uses,
which led it to be unable to reverse the induction variable in the
attached testcase.
Delete test/CodeGen/X86/stack-color-with-reg-2.ll, because its test
is extremely fragile and hard to meaningfully update.
llvm-svn: 104262
2010-05-20 19:26:52 +00:00
Dan Gohman
fdf9874ba7
Set Changed to true when canonicalizing ICmp operand order; even though
...
it isn't a very interesting change, it's a change nonetheless.
llvm-svn: 104260
2010-05-20 19:16:03 +00:00
Dan Gohman
981563d0ba
Rename a variable to avoid shadowing.
...
llvm-svn: 104234
2010-05-20 16:41:11 +00:00
Dan Gohman
6b733fc189
Minor code simplification.
...
llvm-svn: 104232
2010-05-20 16:23:28 +00:00
Dan Gohman
80a9608442
Move the code for deleting BaseRegs and LSRUses into helper functions,
...
and fix a bug that valgrind noticed where the code would std::swap an
element with itself.
llvm-svn: 104225
2010-05-20 15:17:54 +00:00
Dan Gohman
20fab456da
Teach LSR how to cope better with unrolled loops on targets where
...
the addressing modes don't make this trivially easy. This allows
it to avoid falling into the less precise heuristics in more
cases.
llvm-svn: 104186
2010-05-19 23:43:12 +00:00
Dan Gohman
beebef4137
Add a comment.
...
llvm-svn: 104089
2010-05-18 23:55:57 +00:00
Dan Gohman
50f8f2c23d
Fix the predicate which checks for non-sensical formulae which have
...
constants in registers which partially cancel out their immediate fields.
llvm-svn: 104088
2010-05-18 23:48:08 +00:00
Dan Gohman
4cf99b5303
Factor out the code for recomputing an LSRUse's Regs set after some
...
of its formulae have been removed into a helper function, and also
teach it how to update the RegUseTracker.
llvm-svn: 104087
2010-05-18 23:42:37 +00:00
Dan Gohman
a4eca05174
Factor out code for estimating search space complexity into a helper
...
function.
llvm-svn: 104082
2010-05-18 22:51:59 +00:00
Dan Gohman
63e9015248
Add some more debug output.
...
llvm-svn: 104080
2010-05-18 22:41:32 +00:00
Dan Gohman
f1c7b1b42f
Factor out the code for deleting a formula from an LSRUse into
...
a helper function.
llvm-svn: 104079
2010-05-18 22:39:15 +00:00
Dan Gohman
8aca7ef903
Make some debug output more informative.
...
llvm-svn: 104078
2010-05-18 22:37:37 +00:00
Dan Gohman
06ab08f795
Print an error message in Formula::print if the HasBaseReg flag
...
is inconsistent with the BaseRegs field. It's not print's job to
assert on an invalid condition, but it can make one more obvious.
llvm-svn: 104077
2010-05-18 22:35:55 +00:00
Dan Gohman
248c41d108
Rename RegUseTracker's RegUses member to RegUsesMap to avoid
...
confusion with LSRInstance's RegUses member.
llvm-svn: 104076
2010-05-18 22:33:00 +00:00
Douglas Gregor
6739a89117
Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
...
llvm-svn: 103457
2010-05-11 06:17:44 +00:00
Chris Lattner
84d4618659
make simplifycfg insert an llvm.trap before the 'unreachable' it introduces
...
when it detects undefined behavior. llvm.trap generally codegens into some
thing really small (e.g. a 2 byte ud2 instruction on x86) and debugging this
sort of thing is "nontrivial". For example, we now compile:
void foo() { *(int*)0 = 42; }
into:
_foo:
pushl %ebp
movl %esp, %ebp
ud2
Some may even claim that this is a security hole, though that seems dubious
to me. This addresses rdar://7958343 - Optimizing away null dereference
potentially allows arbitrary code execution
llvm-svn: 103356
2010-05-08 22:15:59 +00:00
Chris Lattner
5a62d6e578
Fix PR7052, patch by Jakub Staszak!
...
llvm-svn: 103347
2010-05-08 20:01:44 +00:00
Dan Gohman
d0800241d2
When pruning candidate formulae out of an LSRUse, update the
...
LSRUse's Regs set after all pruning is done, rather than trying
to do it on the fly, which can produce an incomplete result.
This fixes a case where heuristic pruning was stripping all
formulae from a use, which led the solver to enter an infinite
loop.
Also, add a few asserts to diagnose this kind of situation.
llvm-svn: 103328
2010-05-07 23:36:59 +00:00
Ted Kremenek
d90773ebe0
Update CMake build.
...
llvm-svn: 103266
2010-05-07 17:13:20 +00:00
Dan Gohman
5d5b8b1b8c
Add an LLVM IR version of code sinking. This uses the same simple algorithm
...
as MachineSink, but it isn't constrained by MachineInstr-level details.
llvm-svn: 103257
2010-05-07 15:40:13 +00:00
Bob Wilson
0c8b29bcdb
Use the right version of "append" to combine two SmallVectors.
...
This fixes the compile-time regressions seen in last night's tests.
llvm-svn: 103118
2010-05-05 20:44:15 +00:00
Bob Wilson
a2fda8b648
Defer adding critical edges to the "toSplit" list until after checking for
...
indirect branches in all the predecessors. This avoids unnecessarily
splitting edges in cases where load PRE is not possible anyway.
Thanks to Jakub Staszak for pointing this out.
llvm-svn: 103034
2010-05-04 20:03:21 +00:00
Dan Gohman
1d2ded75e2
Use getConstant instead of getIntegerSCEV. The two are basically the
...
same, now that getConstant has overloads consistent with ConstantInt::get.
llvm-svn: 102965
2010-05-03 22:09:21 +00:00
Devang Patel
9f5200a122
Check for side effects before splitting loop.
...
Patch by Jakub Staszak!
llvm-svn: 102928
2010-05-03 18:06:58 +00:00
Chris Lattner
87aa2243e2
fix PR6940: sitofp(undef) folds to 0.0, not undef.
...
llvm-svn: 102358
2010-04-26 18:21:23 +00:00
Dan Gohman
534ba376f6
Generalize LSR's OptimizeMax to handle the new kinds of max expressions
...
that indvars may use, now that indvars is recognizing le and ge loops.
llvm-svn: 102235
2010-04-24 03:13:44 +00:00
Dan Gohman
997bbc54d6
Fix LSR to tolerate cases where ScalarEvolution initially
...
misses an opportunity to fold add operands, but folds them
after LSR has separated them out. This fixes rdar://7886751.
llvm-svn: 102157
2010-04-23 01:55:05 +00:00
Chris Lattner
4ba01ec869
refactor the interface to InlineFunction so that most of the in/out
...
arguments are handled with a new InlineFunctionInfo class. This
makes it easier to extend InlineFunction to return more info in the
future.
llvm-svn: 102137
2010-04-22 23:07:58 +00:00
Gabor Greif
27b3d55194
use abstract accessors to CallInst
...
llvm-svn: 101899
2010-04-20 13:13:04 +00:00
Chris Lattner
66e809acc0
remove a bunch of ad-hoc code to simplify instructions from
...
loop unswitch, and use inst simplify instead. It is more
powerful and less duplication.
llvm-svn: 101874
2010-04-20 05:33:18 +00:00
Chris Lattner
5814d9d9da
RewriteLoopBodyWithConditionConstant can end up rewriting the
...
condition we're unswitching on. In this case, don't try to
simplify the second copy of the loop which may be dead or not,
but is probably a constant now. This fixes PR6879
llvm-svn: 101870
2010-04-20 05:09:16 +00:00
Dan Gohman
e637ff5e9a
Remove the Expr member from IVUsers. Instead of remembering the expression,
...
just ask ScalarEvolution for it on demand. This helps IVUsers be more robust
in the case of expressions changing underneath it. This fixes PR6862.
llvm-svn: 101819
2010-04-19 21:48:58 +00:00
Eric Christopher
7258dcd77f
Revert 101465, it broke internal OpenGL testing.
...
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.
llvm-svn: 101579
2010-04-16 23:37:20 +00:00
Dan Gohman
99e5327bfd
Refine the detection of seemingly infinitely recursive calls where the
...
callee is expected to be expanded to something else by codegen, so that
normal infinitely recursive calls are still transformed.
llvm-svn: 101468
2010-04-16 15:57:50 +00:00
Gabor Greif
f375520f7b
reapply r101434
...
with a fix for self-hosting
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
llvm-svn: 101465
2010-04-16 15:33:14 +00:00
Chris Lattner
bd2d9430d6
fix comment noticed by Bob
...
llvm-svn: 101437
2010-04-16 02:32:17 +00:00
Gabor Greif
403e9694f9
back out r101423 and r101397, they break llvm-gcc self-host on darwin10
...
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Chris Lattner
1146d326a7
fix PR6832: we were using the alignment of a pointer when we
...
wanted the alignment of the pointee.
llvm-svn: 101432
2010-04-16 01:05:38 +00:00
Chris Lattner
b73552908e
improve comments.
...
llvm-svn: 101429
2010-04-16 00:38:19 +00:00
Chris Lattner
78d7dbbc30
pull all the ConvertToScalarInfo code together into one
...
place.
llvm-svn: 101427
2010-04-16 00:24:57 +00:00
Chris Lattner
d69c3ee958
more refactoring: suck some stuff out of SRoA into
...
ConvertToScalarInfo.
llvm-svn: 101425
2010-04-16 00:20:00 +00:00
Gabor Greif
6af0ad846e
shift intrinsic operand
...
llvm-svn: 101423
2010-04-16 00:06:45 +00:00
Chris Lattner
9ef4eae6e6
introduce a new ConvertToScalarInfo struct to simplify
...
CanConvertToScalar/MergeInType. Eliminate a pointless
LLVMContext argument to MergeInType.
llvm-svn: 101422
2010-04-15 23:50:26 +00:00
Chris Lattner
9c1172d848
tidy interface to isOnlyCopiedFromConstantGlobal
...
llvm-svn: 101405
2010-04-15 21:59:20 +00:00
Gabor Greif
33ae80bff7
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
llvm-svn: 101397
2010-04-15 20:51:13 +00:00
Dan Gohman
b29cda9b3c
Fix a bunch of namespace polution.
...
llvm-svn: 101376
2010-04-15 17:08:50 +00:00
Gabor Greif
9fd00c7d25
back out r101364, as it trips the linux nightlybot on some clang C++ tests
...
llvm-svn: 101368
2010-04-15 12:46:56 +00:00
Gabor Greif
aafd209632
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
llvm-svn: 101364
2010-04-15 10:49:53 +00:00
Gabor Greif
c08e5df836
performance: cache the dereferenced use_iterator
...
llvm-svn: 101253
2010-04-14 16:48:56 +00:00
Gabor Greif
a49686fa3e
performance: cache the dereferenced use_iterator
...
llvm-svn: 101250
2010-04-14 16:13:56 +00:00
Owen Anderson
b516f1c6cc
Remove SCCVN from the CMake build system.
...
llvm-svn: 101125
2010-04-13 08:33:09 +00:00
Owen Anderson
9ed6abfe0b
SCCVN, we hardly knew ye!
...
llvm-svn: 101117
2010-04-13 05:24:08 +00:00
Dan Gohman
5867a56db8
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.
llvm-svn: 101113
2010-04-13 01:46:36 +00:00
Dan Gohman
4a645b88ef
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.
llvm-svn: 101068
2010-04-12 21:13:43 +00:00
Dan Gohman
27c8e79839
Delete this code, which is no longer needed.
...
llvm-svn: 101033
2010-04-12 08:00:22 +00:00
Dan Gohman
07f6563e81
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.
llvm-svn: 101032
2010-04-12 07:56:56 +00:00
Dan Gohman
15f90c294c
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.
llvm-svn: 101027
2010-04-12 07:29:15 +00:00
Dan Gohman
fa5ad797e3
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.
llvm-svn: 101008
2010-04-12 02:21:50 +00:00
Dan Gohman
c0f1efaf8d
Revert 101000, which is breaking self-host builds.
...
llvm-svn: 101002
2010-04-12 00:17:10 +00:00
Dan Gohman
af4ab1b681
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.
llvm-svn: 101000
2010-04-11 23:10:12 +00:00
Dan Gohman
b50349a979
Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
...
that it's only testing for the entry condition, not full loop-invariant
conditions.
llvm-svn: 100979
2010-04-11 19:27:13 +00:00
Chris Lattner
9ae28b141f
fix PR6743, a case where we'd delete an instruction before using it
...
in some cases.
llvm-svn: 100937
2010-04-10 18:26:57 +00:00