Michael J. Spencer
dc38d36ccb
CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
...
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Owen Anderson
d85c9ccdba
Lower the unrolling theshold to 150. Empirical tests indicate that this is a sweet spot in the performance per
...
code size increase curve.
llvm-svn: 113595
2010-09-10 17:57:00 +00:00
Owen Anderson
04cf3fd761
What the loop unroller cares about, rather than just not unrolling loops with calls, is
...
not unrolling loops that contain calls that would be better off getting inlined. This mostly
comes up when an interleaved devirtualization pass has devirtualized a call which the inliner
will inline on a future pass. Thus, rather than blocking all loops containing calls, add
a metric for "inline candidate calls" and block loops containing those instead.
llvm-svn: 113535
2010-09-09 20:32:23 +00:00
Owen Anderson
6270515918
Revert r113439, which relaxed the requirement that loops containing calls cannot be unrolled. After some discussion,
...
there seems to be a better way to achieve the same effect.
llvm-svn: 113528
2010-09-09 20:02:23 +00:00
Owen Anderson
11ab204fdc
r113526 introduced an unintended change to the loop unrolling threshold. Revert it.
...
llvm-svn: 113527
2010-09-09 19:11:57 +00:00
Owen Anderson
b61b1647e2
Fix typo in code to cap the loop code size reduction calculation.
...
llvm-svn: 113526
2010-09-09 19:08:59 +00:00
Owen Anderson
62ea1b718c
Use code-size reduction metrics to estimate the amount of savings we'll get when we unroll a loop.
...
Next step is to recalculate the threshold values given this new heuristic.
llvm-svn: 113525
2010-09-09 19:07:31 +00:00
Owen Anderson
8084dbaf8e
Relax the "don't unroll loops containing calls" rule. Instead, when a loop contains a call, lower the
...
unrolling threshold to the optimize-for-size threshold. Basically, for loops containing calls, unrolling
can still be profitable as long as the loop is REALLY small.
llvm-svn: 113439
2010-09-08 23:10:07 +00:00
Owen Anderson
a4d9c78aa1
Add a separate unrolling threshold when the current function is being optimized for size.
...
The threshold value of 50 is arbitrary, and I chose it simply by analogy to the inlining thresholds, where
the baseline unrolling threshold is slightly smaller than the baseline inlining threshold. This could
undoubtedly use some tuning.
llvm-svn: 113306
2010-09-07 23:15:30 +00:00
Chris Lattner
be9019090e
fix PR8067, an over-aggressive assertion in LICM.
...
llvm-svn: 113146
2010-09-06 05:11:24 +00:00
Chris Lattner
b01c24a945
Teach loop rotate to hoist trivially invariant instructions
...
in the duplicated block instead of duplicating them.
Duplicating them into the end of the loop and the preheader
means that we got a phi node in the header of the loop,
which prevented LICM from hoisting them. GVN would
usually come around later and merge the duplicated
instructions so we'd get reasonable output... except that
anything dependent on the shoulda-been-hoisted value can't
be hoisted. In PR5319 (which this fixes), a memory value
didn't get promoted.
llvm-svn: 113134
2010-09-06 01:10:22 +00:00
Chris Lattner
da24b9a49a
pull a simple method out of LICM into a new
...
Loop::hasLoopInvariantOperands method. Remove
a useless and confusing Loop::isLoopInvariant(Instruction)
method, which didn't do what you thought it did.
No functionality change.
llvm-svn: 113133
2010-09-06 01:05:37 +00:00
Chris Lattner
1edf7434cf
more cleanups
...
llvm-svn: 113115
2010-09-05 20:13:07 +00:00
Chris Lattner
e6214557e7
Change lower atomic pass to use IntrinsicInst to simplify it a bit.
...
llvm-svn: 113114
2010-09-05 20:10:47 +00:00
Chris Lattner
05ef361b5e
eliminate some non-obvious casts. UndefValue isa Constant.
...
llvm-svn: 113113
2010-09-05 20:03:09 +00:00
Chris Lattner
65b48b5dfc
zap dead code.
...
llvm-svn: 113073
2010-09-04 18:12:00 +00:00
Chris Lattner
50506787d1
fix a bug in my licm rewrite when a load from the promoted memory
...
location is being re-stored to the memory location. We would get
a dangling pointer from the SSAUpdate data structure and miss a
use. This fixes PR8068
llvm-svn: 113042
2010-09-04 00:12:30 +00:00
Owen Anderson
c91c1a205a
Propagate non-local comparisons. Fixes PR1757.
...
llvm-svn: 113025
2010-09-03 22:47:08 +00:00
Owen Anderson
c725462245
Add support for simplifying a load from a computed value to a load from a global when it
...
is provable that they're equivalent. This fixes PR4855.
llvm-svn: 112994
2010-09-03 19:08:37 +00:00
Chris Lattner
affc0e42f0
fix more AST updating bugs, correcting miscompilation in PR8041
...
llvm-svn: 112878
2010-09-02 22:19:10 +00:00
Duncan Sands
6778149f7e
Reapply commit 112699, speculatively reverted by echristo, since
...
I'm sure it is harmless. Original commit message:
If PrototypeValue is erased in the middle of using the SSAUpdator
then the SSAUpdator may access freed memory. Instead, simply pass
in the type and name explicitly, which is all that was used anyway.
llvm-svn: 112810
2010-09-02 08:14:03 +00:00
Chris Lattner
8af45a889d
deepen my MMX/SRoA hack to avoid hurting non-x86 codegen.
...
llvm-svn: 112763
2010-09-01 23:09:27 +00:00
Dan Gohman
0ad7d9c24e
Fix loop unswitching's assumption that a code path which either
...
infinite loops or exits will eventually exit. This fixes PR5373.
llvm-svn: 112745
2010-09-01 21:46:45 +00:00
Owen Anderson
73f988cafa
JumpThreading keeps LazyValueInfo up to date, so we don't need to rerun it
...
if we schedule another LVI-using pass afterwards.
llvm-svn: 112722
2010-09-01 18:27:22 +00:00
Eric Christopher
a5d315c665
Speculatively revert 112699 and 112702, they seem to be causing
...
self host errors on clang-x86-64.
llvm-svn: 112719
2010-09-01 17:29:10 +00:00
Duncan Sands
f7b18437b5
If PrototypeValue is erased in the middle of using the SSAUpdator
...
then the SSAUpdator may access freed memory. Instead, simply pass
in the type and name explicitly, which is all that was used anyway.
llvm-svn: 112699
2010-09-01 10:29:33 +00:00
Chris Lattner
34e5361eb5
add a gross hack to work around a problem that Argiris reported
...
on llvmdev: SRoA is introducing MMX datatypes like <1 x i64>,
which then cause random problems because the X86 backend is
producing mmx stuff without inserting proper emms calls.
In the short term, force off MMX datatypes. In the long term,
the X86 backend should not select generic vector types to MMX
registers. This is being worked on, but won't be done in time
for 2.8. rdar://8380055
llvm-svn: 112696
2010-09-01 05:14:33 +00:00
Dan Gohman
110ed64fbb
Revert 112442 and 112440 until the compile time problems introduced
...
by 112440 are resolved.
llvm-svn: 112692
2010-09-01 01:45:53 +00:00
Chris Lattner
030f02021b
licm is wasting time hoisting constant foldable operations,
...
instead of hoisting them, just fold them away. This occurs in the
testcase for PR8041, for example.
llvm-svn: 112669
2010-08-31 23:00:16 +00:00
Chris Lattner
daca6f3483
tidy up
...
llvm-svn: 112643
2010-08-31 21:21:25 +00:00
Owen Anderson
3c84ecb067
More cleanups of my JumpThreading transforms, including extracting some duplicated code into a helper function.
...
llvm-svn: 112634
2010-08-31 20:26:04 +00:00
Owen Anderson
6fdcb172a9
Add an RAII helper to make cleanup of the RecursionSet more fool-proof.
...
llvm-svn: 112628
2010-08-31 19:24:27 +00:00
Owen Anderson
048efbe225
Only try to clean up the current block if we changed that block already.
...
llvm-svn: 112625
2010-08-31 18:55:52 +00:00
Owen Anderson
cd4de7f399
Refactor my fix for PR5652 to terminate the predecessor lookups after the first failure.
...
llvm-svn: 112620
2010-08-31 18:48:48 +00:00
Owen Anderson
ce401be792
Don't perform an extra traversal of the function just to do cleanup. We can safely simplify instructions after each block has been processed without worrying about iterator invalidation.
...
llvm-svn: 112594
2010-08-31 07:55:56 +00:00
Owen Anderson
48d58ad64c
Rename ValuePropagation to a more descriptive CorrelatedValuePropagation.
...
llvm-svn: 112591
2010-08-31 07:48:34 +00:00
Owen Anderson
d2918a07bd
Rename file to something more descriptive.
...
llvm-svn: 112590
2010-08-31 07:41:39 +00:00
Owen Anderson
3997a07fb9
More Chris-inspired JumpThreading fixes: use ConstantExpr to correctly constant-fold undef, and be more careful with its return value.
...
This actually exposed an infinite recursion bug in ComputeValueKnownInPredecessors which theoretically already existed (in JumpThreading's
handling of and/or of i1's), but never manifested before. This patch adds a tracking set to prevent this case.
llvm-svn: 112589
2010-08-31 07:36:34 +00:00
Owen Anderson
b58b3c0dda
Fix a typo.
...
llvm-svn: 112560
2010-08-30 23:59:30 +00:00
Owen Anderson
b974dbbdd7
Cleanups suggested by Chris.
...
llvm-svn: 112553
2010-08-30 23:34:17 +00:00
Owen Anderson
c910acb54a
Re-apply r112539, being more careful to respect the return values of the constant folding methods. Additionally,
...
use the ConstantExpr::get*() methods to simplify some constant folding.
llvm-svn: 112550
2010-08-30 23:22:36 +00:00
Owen Anderson
30bacbdfdf
Add statistics to evaluate this pass.
...
llvm-svn: 112545
2010-08-30 22:45:55 +00:00
Owen Anderson
1ddcbbe49c
Revert r112539. It accidentally introduced a miscompilation.
...
llvm-svn: 112543
2010-08-30 22:33:41 +00:00
Owen Anderson
75f6037c7c
Fixes and cleanups pointed out by Chris. In general, be careful to handle 0 results from ComputeValueKnownInPredecessors
...
(indicating undef), and re-use existing constant folding APIs.
llvm-svn: 112539
2010-08-30 22:07:52 +00:00
Chris Lattner
c843fca2fd
rewrite DwarfEHPrepare to use SSAUpdater to promote its allocas
...
instead of PromoteMemToReg. This allows it to stop using DF and DT,
eliminating a computation of DT and DF from clang -O3. Clang is now
down to 2 runs of DomFrontier.
llvm-svn: 112457
2010-08-29 19:54:28 +00:00
Chris Lattner
f58382ed87
two changes: 1) make AliasSet hold the list of call sites with an
...
assertingvh so we get a violent explosion if the pointer dangles.
2) Fix AliasSetTracker::deleteValue to remove call sites with
by-pointer comparisons instead of by-alias queries. Using
findAliasSetForCallSite can cause alias sets to get merged
when they shouldn't, and can also miss alias sets when the
call is readonly.
#2 fixes PR6889, which only repros with a .c file :(
llvm-svn: 112452
2010-08-29 18:42:23 +00:00
Chris Lattner
263f804699
LICM does get dead instructions input to it. Instead of sinking them
...
out of loops, just delete them.
llvm-svn: 112451
2010-08-29 18:22:25 +00:00
Chris Lattner
6ac0659a1c
use moveBefore instead of remove+insert, it avoids some
...
symtab manipulation, so its faster (in addition to being
more elegant)
llvm-svn: 112450
2010-08-29 18:18:40 +00:00
Chris Lattner
f03b4eac48
revert 112448 for now.
...
llvm-svn: 112449
2010-08-29 18:11:16 +00:00
Chris Lattner
11f8ad8211
optimize LICM::hoist to use moveBefore. Correct its updating
...
of AST to remove the hoisted instruction from the AST, since it
is no longer in the loop.
llvm-svn: 112448
2010-08-29 18:03:33 +00:00
Chris Lattner
1a1ed69435
fix some bugs (found by inspection) where LICM would not update
...
LICM correctly. When sinking an instruction, it should not add
entries for the sunk instruction to the AST, it should remove
the entry for the sunk instruction. The blocks being sunk to
are not in the loop, so their instructions shouldn't be in the
AST (yet)!
llvm-svn: 112447
2010-08-29 18:00:00 +00:00
Chris Lattner
cc9cbc66a3
rework the ownership of subloop alias information: instead of
...
keeping them around until the pass is destroyed, keep them
around a) just when useful (not for outer loops) and b) destroy
them right after we use them. This should reduce memory use
and fixes potential bugs where a loop is deleted and another
loop gets allocated to the same address.
llvm-svn: 112446
2010-08-29 17:46:00 +00:00
Chris Lattner
bc1a65ac6c
apparently unswitch had the same "Feature". Stop its
...
claims that it preserves domfrontier if it doesn't really.
llvm-svn: 112445
2010-08-29 17:23:19 +00:00
Chris Lattner
d6f46b8af8
now that loop passes don't use DomFrontier, there is no reason
...
for the unroller to pretend it supports updating it. It still
has a horrible hack for DomTree.
llvm-svn: 112444
2010-08-29 17:21:35 +00:00
Dan Gohman
002ff89cbd
Optionally rerun dedicated-register filtering after applying
...
other filtering techniques, as those may allow it to filter
out more obviously unprofitable candidates.
llvm-svn: 112441
2010-08-29 16:39:22 +00:00
Dan Gohman
f031792cc6
Fix several areas in LSR to do a better job keeping the main
...
LSRInstance data structures up to date. This fixes some
pessimizations caused by stale data which will be exposed
in an upcoming change.
llvm-svn: 112440
2010-08-29 16:32:54 +00:00
Dan Gohman
e9e0873b08
Refactor the three main groups of code out of
...
NarrowSearchSpaceUsingHeuristics into separate functions.
llvm-svn: 112439
2010-08-29 16:09:42 +00:00
Dan Gohman
37a0f68036
Delete a bogus check.
...
llvm-svn: 112438
2010-08-29 15:30:29 +00:00
Dan Gohman
b6a520d63c
Add some comments.
...
llvm-svn: 112437
2010-08-29 15:27:08 +00:00
Dan Gohman
bf673e0652
Move this debug output into GenerateAllReuseFormula, to declutter
...
the high-level logic.
llvm-svn: 112436
2010-08-29 15:21:38 +00:00
Dan Gohman
d366b6d5c8
Delete an unused declaration.
...
llvm-svn: 112435
2010-08-29 15:19:11 +00:00
Dan Gohman
4f13bbfefc
Do one lookup instead of two.
...
llvm-svn: 112434
2010-08-29 15:18:49 +00:00
Chris Lattner
f94f6bb0ba
licm preserves the cfg, it doesn't have to explicitly say it
...
preserves domfrontier. It does preserve AA though.
llvm-svn: 112419
2010-08-29 07:02:56 +00:00
Chris Lattner
abe61ef3b4
now that it doesn't use the PromoteMemToReg function, LICM doesn't
...
require DomFrontier. Dropping this doesn't actually save any runs
of the pass though.
llvm-svn: 112418
2010-08-29 06:49:44 +00:00
Chris Lattner
1dc98b47b5
completely rewrite the memory promotion algorithm in LICM.
...
Among other things, this uses SSAUpdater instead of
PromoteMemToReg.
llvm-svn: 112417
2010-08-29 06:43:52 +00:00
Chris Lattner
9c3931a544
use getUniqueExitBlocks instead of a manual set.
...
llvm-svn: 112412
2010-08-29 05:12:21 +00:00
Chris Lattner
85bf5421e1
reimplement LICM::sink to use SSAUpdater instead of PromoteMemToReg.
...
This leads to much simpler code.
llvm-svn: 112410
2010-08-29 04:55:06 +00:00
Chris Lattner
b50407f104
remove dead proto
...
llvm-svn: 112408
2010-08-29 04:53:24 +00:00
Chris Lattner
cd96b4df56
reduce indentation in LICM::sink by using early exits, use
...
getUniqueExitBlocks instead of getExitBlocks and a manual
set to eliminate dupes.
llvm-svn: 112405
2010-08-29 04:28:20 +00:00
Chris Lattner
188cc5a0fc
modernize this pass a bit: use efficient set/map and reduce indentation.
...
llvm-svn: 112404
2010-08-29 04:23:04 +00:00
Chris Lattner
504e5100d3
remove the ABCD and SSI passes. They don't have any clients that
...
I'm aware of, aren't maintained, and LVI will be replacing their value.
nlewycky approved this on irc.
llvm-svn: 112355
2010-08-28 03:51:24 +00:00
Chris Lattner
95bb297c26
squish dead code.
...
llvm-svn: 112350
2010-08-28 03:21:03 +00:00
Benjamin Kramer
83f9ff0452
Update CMake build. Add newline at end of file.
...
llvm-svn: 112332
2010-08-28 00:11:12 +00:00
Owen Anderson
cf7f941121
Add a prototype of a new peephole optimizing pass that uses LazyValue info to simplify PHIs and select's.
...
This pass addresses the missed optimizations from PR2581 and PR4420.
llvm-svn: 112325
2010-08-27 23:31:36 +00:00
Owen Anderson
99d4cb861b
Fix typos in comments.
...
llvm-svn: 112286
2010-08-27 20:32:56 +00:00
Owen Anderson
6ebbd92380
Use LVI to eliminate conditional branches where we've tested a related condition previously. Update tests for this change.
...
This fixes PR5652.
llvm-svn: 112270
2010-08-27 17:12:29 +00:00
Owen Anderson
bd2ecc7e68
Make JumpThreading smart enough to properly thread StrSwitch when it's compiled with clang++.
...
llvm-svn: 112198
2010-08-26 17:40:24 +00:00
Chris Lattner
8df99b523e
remove some llvmcontext arguments that are now dead post-refactoring.
...
llvm-svn: 112104
2010-08-25 23:00:45 +00:00
Owen Anderson
7c853e877e
Turn LVI on, previously detected failures should be fixed now.
...
llvm-svn: 111923
2010-08-24 17:21:18 +00:00
Owen Anderson
6ffa3f2aea
Turn LVI back off, I have a testcase now.
...
llvm-svn: 111834
2010-08-23 19:59:27 +00:00
Owen Anderson
630add39a6
Re-enable LazyValueInfo. Monitoring for failures.
...
llvm-svn: 111816
2010-08-23 18:12:23 +00:00
Owen Anderson
d31d82d75c
Now that PassInfo and Pass::ID have been separated, move the rest of the passes over to the new registration API.
...
llvm-svn: 111815
2010-08-23 17:52:01 +00:00
Owen Anderson
aac8cbb261
Disable LVI while I evaluate a failure.
...
llvm-svn: 111551
2010-08-19 19:47:08 +00:00
Owen Anderson
5c87dd55d3
Tentatively enabled LVI by default. I'll be monitoring for any failures.
...
llvm-svn: 111543
2010-08-19 19:04:40 +00:00
Dan Gohman
129a816ee6
Process the step before the start, because it's usually the simpler
...
of the two.
llvm-svn: 111495
2010-08-19 01:02:31 +00:00
Owen Anderson
208636fa33
Inform LazyValueInfo whenever a block is deleted, to avoid dangling pointer issues.
...
llvm-svn: 111382
2010-08-18 18:39:01 +00:00
Chris Lattner
3c603024bb
Fix PR7755: knowing something about an inval for a pred
...
from the LHS should disable reconsidering that pred on the
RHS. However, knowing something about the pred on the RHS
shouldn't disable subsequent additions on the RHS from
happening.
llvm-svn: 111349
2010-08-18 03:14:36 +00:00
Chris Lattner
b45de95345
remove some dead code.
...
llvm-svn: 111344
2010-08-18 02:41:56 +00:00
Chris Lattner
6aabb66139
remove dead prototype.
...
llvm-svn: 111342
2010-08-18 02:37:06 +00:00
Dan Gohman
5047ca0c02
When rotating loops, put the original header at the bottom of the
...
loop, making the resulting loop significantly less ugly. Also, zap
its trivial PHI nodes, since it's easy.
llvm-svn: 111255
2010-08-17 17:39:21 +00:00
Evan Cheng
8b637b177c
Add an option to disable codegen prepare critical edge splitting. In theory, PHI elimination is already doing all (most?) of the splitting needed. But machine-licm and machine-sink seem to miss some important optimizations when splitting is disabled.
...
llvm-svn: 111224
2010-08-17 01:34:49 +00:00
Dan Gohman
89fdbaf99a
Instead of having CollectSubexpr's categorize operands as interesting or
...
uninteresting, just put all the operands on one list and make
GenerateReassociations make the decision about what's interesting.
This is simpler, and it avoids an extra ScalarEvolution::getAddExpr call.
llvm-svn: 111133
2010-08-16 15:50:00 +00:00
Dan Gohman
9b7632df26
Put add operands in ScalarEvolution-canonical order, when convenient.
...
This isn't necessary, because ScalarEvolution sorts them anyway,
but it's tidier this way.
llvm-svn: 111132
2010-08-16 15:39:27 +00:00
Dan Gohman
4a63fad976
Teach SimplifyCFG how to simplify indirectbr instructions.
...
- Eliminate redundant successors.
- Convert an indirectbr with one successor into a direct branch.
Also, generalize SimplifyCFG to be able to be run on a function entry block.
It knows quite a few simplifications which are applicable to the entry
block, and it only needs a few checks to avoid trouble with the entry block.
llvm-svn: 111060
2010-08-14 00:29:42 +00:00
Dan Gohman
081ffcd00b
Fix LSR's ExtractImmediate and ExtractSymbol to avoid calling
...
ScalarEvolution::getAddExpr, which can be pretty expensive, when nothing
has changed, which is pretty common.
llvm-svn: 111042
2010-08-13 21:17:19 +00:00
Chris Lattner
363226dfe8
fix PR7876: If ipsccp decides that a function's address is taken
...
before it rewrites the code, we need to use that in the post-rewrite pass.
llvm-svn: 110962
2010-08-12 22:25:23 +00:00
Owen Anderson
0398607714
Don't attempt the PRE inline asm calls, since we don't value number them yet. Fixes PR7835.
...
llvm-svn: 110489
2010-08-07 00:20:35 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Nick Lewycky
5a2849e166
Fix uninitialized variable warning.
...
Also move 'default' case next to a real case to help compiler optimize in
non-Debug builds.
No functionality change.
llvm-svn: 110435
2010-08-06 07:43:46 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
755aceb5d0
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
...
ID member as the sole unique type identifier. Clean up APIs related to this change.
llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Owen Anderson
4674dd6cf5
Give JumpThreading+LVI a long-form cl::opt so that it's easier to toggle the default.
...
llvm-svn: 110384
2010-08-05 22:11:31 +00:00
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