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