Commit Graph

7182 Commits

Author SHA1 Message Date
Nick Lewycky
2b6c01b40b Fix major bug in thunk detection. Also verify the calling convention.
Switch from isWeakForLinker to mayBeOverridden which is more accurate.

Add more statistics and debugging info. Add comments. Move static function
outside anonymous namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 01:42:10 +00:00
Chris Lattner
0cccd7633e fix PR8067, an over-aggressive assertion in LICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 05:11:24 +00:00
Chris Lattner
50fb46983c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 01:10:22 +00:00
Chris Lattner
adc799112d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 01:05:37 +00:00
Chris Lattner
3ae0924d6b more cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113115 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 20:13:07 +00:00
Chris Lattner
bdabacdcca Change lower atomic pass to use IntrinsicInst to simplify it a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 20:10:47 +00:00
Chris Lattner
906a675db8 eliminate some non-obvious casts. UndefValue isa Constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 20:03:09 +00:00
Nick Lewycky
e110abb313 Fix warning reported by MSVC++ builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 09:11:38 +00:00
Nick Lewycky
b0e17779ba Switch FnSet to containing the ComparableFunction instead of a pointer to one.
This reduces malloc traffic (yay!) and removes MergeFunctionsEqualityInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 09:00:32 +00:00
Nick Lewycky
b0104e1bb5 Fix many bugs when merging weak-strong and weak-weak pairs. We now merge all
strong functions first to make sure they're the canonical definitions and then
do a second pass looking only for weak functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 08:22:49 +00:00
Chris Lattner
17aa68055b zap dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113073 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 18:12:00 +00:00
Dan Gohman
ffa75cdcf8 Fix LoopSimplify to notify ScalarEvolution when splitting a loop backedge
into an inner loop, as the new loop iteration may differ substantially.
This fixes PR8078.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113057 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 02:42:48 +00:00
Chris Lattner
469996400c 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 00:12:30 +00:00
Owen Anderson
597dad35b8 Propagate non-local comparisons. Fixes PR1757.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 22:47:08 +00:00
Owen Anderson
1593dd6779 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112994 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 19:08:37 +00:00
Chris Lattner
9c282011e6 fix more AST updating bugs, correcting miscompilation in PR8041
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 22:19:10 +00:00
Duncan Sands
fc6e29d4ab 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 08:14:03 +00:00
Chris Lattner
72eaa0e5eb deepen my MMX/SRoA hack to avoid hurting non-x86 codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 23:09:27 +00:00
Dan Gohman
b0a57210a4 Fix loop unswitching's assumption that a code path which either
infinite loops or exits will eventually exit. This fixes PR5373.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 21:46:45 +00:00
Owen Anderson
9bfa6fec06 JumpThreading keeps LazyValueInfo up to date, so we don't need to rerun it
if we schedule another LVI-using pass afterwards.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 18:27:22 +00:00
Eric Christopher
adc581f5cb Speculatively revert 112699 and 112702, they seem to be causing
self host errors on clang-x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112719 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 17:29:10 +00:00
Duncan Sands
4d588bceb0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 10:29:33 +00:00
Chris Lattner
91abace4ef 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 05:14:33 +00:00
Dan Gohman
191bd64a39 Revert 112442 and 112440 until the compile time problems introduced
by 112440 are resolved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 01:45:53 +00:00
Chris Lattner
2ac6e2354a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112669 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 23:00:16 +00:00
Chris Lattner
b5d84d13bc tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 21:21:25 +00:00
Owen Anderson
0eb355ab6b More cleanups of my JumpThreading transforms, including extracting some duplicated code into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 20:26:04 +00:00
Owen Anderson
9ba353627a Add an RAII helper to make cleanup of the RecursionSet more fool-proof.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112628 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 19:24:27 +00:00
Owen Anderson
869a144f4e Only try to clean up the current block if we changed that block already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112625 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 18:55:52 +00:00
Owen Anderson
c1bdac66ff Refactor my fix for PR5652 to terminate the predecessor lookups after the first failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112620 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 18:48:48 +00:00
Nick Lewycky
65a0af3855 Fix an infinite loop; merging two functions will create a new function (if the
two are weak, we make them thunks to a new strong function) so don't iterate
through the function list as we're modifying it.

Also add back the outermost loop which got removed during the cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 08:29:37 +00:00
Owen Anderson
7c37f6d2d9 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 07:55:56 +00:00
Owen Anderson
25e9405272 Rename ValuePropagation to a more descriptive CorrelatedValuePropagation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112591 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 07:48:34 +00:00
Owen Anderson
7aff1cd038 Rename file to something more descriptive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 07:41:39 +00:00
Owen Anderson
cb21190cbd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112589 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 07:36:34 +00:00
Nick Lewycky
f53de86cba Switch to DenseSet, simplifying much more code. We now have a single iteration
where we hash, compare and fold, instead of one iteration where we build up
the hash buckets and a second one to fold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 05:53:05 +00:00
Owen Anderson
c97fb52799 Remove r111665, which implemented store-narrowing in InstCombine. Chris discovered a miscompilation in it, and it's not easily
fixable at the optimizer level. I'll investigate reimplementing it in DAGCombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112575 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 04:41:06 +00:00
Owen Anderson
49998ce46a Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112560 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 23:59:30 +00:00
Owen Anderson
a081d15b84 Cleanups suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112553 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 23:34:17 +00:00
Owen Anderson
327ca7bec2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 23:22:36 +00:00
Owen Anderson
f523b3e087 Add statistics to evaluate this pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 22:45:55 +00:00
Owen Anderson
d930f205db Revert r112539. It accidentally introduced a miscompilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 22:33:41 +00:00
Owen Anderson
1e35610f20 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 22:07:52 +00:00
Chris Lattner
4455608818 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 19:54:28 +00:00
Chris Lattner
cb7f653422 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 :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 18:42:23 +00:00
Chris Lattner
0de5cad74d LICM does get dead instructions input to it. Instead of sinking them
out of loops, just delete them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 18:22:25 +00:00
Chris Lattner
d9a5daeb77 use moveBefore instead of remove+insert, it avoids some
symtab manipulation, so its faster (in addition to being
more elegant)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112450 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 18:18:40 +00:00
Chris Lattner
1b9c848d0a revert 112448 for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112449 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 18:11:16 +00:00
Chris Lattner
bb07ed3bb5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112448 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 18:03:33 +00:00
Chris Lattner
98917503c7 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)!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112447 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 18:00:00 +00:00
Chris Lattner
4282e32712 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 17:46:00 +00:00
Chris Lattner
ea1092374c apparently unswitch had the same "Feature". Stop its
claims that it preserves domfrontier if it doesn't really.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112445 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 17:23:19 +00:00
Chris Lattner
937790195e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 17:21:35 +00:00
Dan Gohman
4f7e18dee3 Optionally rerun dedicated-register filtering after applying
other filtering techniques, as those may allow it to filter
out more obviously unprofitable candidates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 16:39:22 +00:00
Dan Gohman
25608f7f4b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 16:32:54 +00:00
Dan Gohman
4aa5c2e90f Refactor the three main groups of code out of
NarrowSearchSpaceUsingHeuristics into separate functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 16:09:42 +00:00
Dan Gohman
e39a47c5b3 Delete a bogus check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112438 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 15:30:29 +00:00
Dan Gohman
6a83271532 Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 15:27:08 +00:00
Dan Gohman
3902f9fca8 Move this debug output into GenerateAllReuseFormula, to declutter
the high-level logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 15:21:38 +00:00
Dan Gohman
a7d0d64b7a Delete an unused declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 15:19:11 +00:00
Dan Gohman
46fd7a6ef8 Do one lookup instead of two.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 15:18:49 +00:00
Chris Lattner
e418ac832c licm preserves the cfg, it doesn't have to explicitly say it
preserves domfrontier.  It does preserve AA though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 07:02:56 +00:00
Chris Lattner
44e2bd31f1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112418 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 06:49:44 +00:00
Chris Lattner
e488064922 completely rewrite the memory promotion algorithm in LICM.
Among other things, this uses SSAUpdater instead of 
PromoteMemToReg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 06:43:52 +00:00
Chris Lattner
63a75c13b1 use getUniqueExitBlocks instead of a manual set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112412 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 05:12:21 +00:00
Chris Lattner
a6a36f59b4 reimplement LICM::sink to use SSAUpdater instead of PromoteMemToReg.
This leads to much simpler code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 04:55:06 +00:00
Chris Lattner
ffd9beefb8 implement SSAUpdater::RewriteUseAfterInsertions, a helpful form of RewriteUse.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112409 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 04:54:06 +00:00
Chris Lattner
abd2a75900 remove dead proto
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 04:53:24 +00:00
Chris Lattner
d7bc19dfee reduce indentation in LICM::sink by using early exits, use
getUniqueExitBlocks instead of getExitBlocks and a manual
set to eliminate dupes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 04:28:20 +00:00
Chris Lattner
dc1ceb370a modernize this pass a bit: use efficient set/map and reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112404 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 04:23:04 +00:00
Chris Lattner
61c70e98ac remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 04:09:24 +00:00
Chris Lattner
5f88af5376 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 03:51:24 +00:00
Chris Lattner
157d4ead36 for completeness, allow undef also.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112351 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 03:36:51 +00:00
Chris Lattner
b188a3789e squish dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112350 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 03:21:03 +00:00
Chris Lattner
7900779543 handle the constant case of vector insertion. For something
like this:

struct S { float A, B, C, D; };

struct S g;
struct S bar() { 
  struct S A = g;
  ++A.B;
  A.A = 42;
  return A;
}

we now generate:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movq	_g@GOTPCREL(%rip), %rax
	movss	12(%rax), %xmm0
	pshufd	$16, %xmm0, %xmm0
	movss	4(%rax), %xmm2
	movss	8(%rax), %xmm1
	pshufd	$16, %xmm1, %xmm1
	unpcklps	%xmm0, %xmm1
	addss	LCPI1_0(%rip), %xmm2
	pshufd	$16, %xmm2, %xmm2
	movss	LCPI1_1(%rip), %xmm0
	pshufd	$16, %xmm0, %xmm0
	unpcklps	%xmm2, %xmm0
	ret

instead of:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movq	_g@GOTPCREL(%rip), %rax
	movss	12(%rax), %xmm0
	pshufd	$16, %xmm0, %xmm0
	movss	4(%rax), %xmm2
	movss	8(%rax), %xmm1
	pshufd	$16, %xmm1, %xmm1
	unpcklps	%xmm0, %xmm1
	addss	LCPI1_0(%rip), %xmm2
	movd	%xmm2, %eax
	shlq	$32, %rax
	addq	$1109917696, %rax       ## imm = 0x42280000
	movd	%rax, %xmm0
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112345 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 01:50:57 +00:00
Chris Lattner
3dd08734c1 optimize bitcasts from large integers to vector into vector
element insertion from the pieces that feed into the vector.
This handles a pattern that occurs frequently due to code
generated for the x86-64 abi.  We now compile something like
this:

struct S { float A, B, C, D; };
struct S g;
struct S bar() { 
  struct S A = g;
  ++A.A;
  ++A.C;
  return A;
}

into all nice vector operations:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movq	_g@GOTPCREL(%rip), %rax
	movss	LCPI1_0(%rip), %xmm1
	movss	(%rax), %xmm0
	addss	%xmm1, %xmm0
	pshufd	$16, %xmm0, %xmm0
	movss	4(%rax), %xmm2
	movss	12(%rax), %xmm3
	pshufd	$16, %xmm2, %xmm2
	unpcklps	%xmm2, %xmm0
	addss	8(%rax), %xmm1
	pshufd	$16, %xmm1, %xmm1
	pshufd	$16, %xmm3, %xmm2
	unpcklps	%xmm2, %xmm1
	ret

instead of icky integer operations:

_bar:                                   ## @bar
	movq	_g@GOTPCREL(%rip), %rax
	movss	LCPI1_0(%rip), %xmm1
	movss	(%rax), %xmm0
	addss	%xmm1, %xmm0
	movd	%xmm0, %ecx
	movl	4(%rax), %edx
	movl	12(%rax), %esi
	shlq	$32, %rdx
	addq	%rcx, %rdx
	movd	%rdx, %xmm0
	addss	8(%rax), %xmm1
	movd	%xmm1, %eax
	shlq	$32, %rsi
	addq	%rax, %rsi
	movd	%rsi, %xmm1
	ret

This resolves rdar://8360454



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 01:20:38 +00:00
Benjamin Kramer
6cfabc7974 Update CMake build. Add newline at end of file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112332 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 00:11:12 +00:00
Owen Anderson
a0b59f6bd2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112325 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 23:31:36 +00:00
Chris Lattner
4ece577019 Enhance the shift propagator to handle the case when you have:
A = shl x, 42
...
B = lshr ..., 38

which can be transformed into:
A = shl x, 4
...

iff we can prove that the would-be-shifted-in bits
are already zero.  This eliminates two shifts in the testcase
and allows eliminate of the whole i128 chain in the real example.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 22:53:44 +00:00
Chris Lattner
29cc0b3660 Implement a pretty general logical shift propagation
framework, which is good at ripping through bitfield
operations.  This generalize a bunch of the existing
xforms that instcombine does, such as 
  (x << c) >> c -> and
to handle intermediate logical nodes.  This is useful for
ripping up the "promote to large integer" code produced by
SRoA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 22:24:38 +00:00
Chris Lattner
2d0822a937 remove some special shift cases that have been subsumed into the
more general simplify demanded bits logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112291 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 21:04:34 +00:00
Owen Anderson
fc2fb17fb7 Fix typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112286 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 20:32:56 +00:00
Chris Lattner
f9d05ab007 teach the truncation optimization that an entire chain of
computation can be truncated if it is fed by a sext/zext that doesn't
have to be exactly equal to the truncation result type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 20:32:06 +00:00
Chris Lattner
784f333aef Add an instcombine to clean up a common pattern produced
by the SRoA "promote to large integer" code, eliminating
some type conversions like this:

   %94 = zext i16 %93 to i32                       ; <i32> [#uses=2]
   %96 = lshr i32 %94, 8                           ; <i32> [#uses=1]
   %101 = trunc i32 %96 to i8                      ; <i8> [#uses=1]

This also unblocks other xforms from happening, now clang is able to compile:

struct S { float A, B, C, D; };
float foo(struct S A) { return A.A + A.B+A.C+A.D; }

into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	pshufd	$1, %xmm0, %xmm2
	addss	%xmm0, %xmm2
	movdqa	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	pshufd	$1, %xmm1, %xmm0
	addss	%xmm3, %xmm0
	ret

on x86-64, instead of:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	movd	%xmm0, %rax
	shrq	$32, %rax
	movd	%eax, %xmm2
	addss	%xmm0, %xmm2
	movapd	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	movd	%xmm1, %rax
	shrq	$32, %rax
	movd	%eax, %xmm0
	addss	%xmm3, %xmm0
	ret

This seems pretty close to optimal to me, at least without
using horizontal adds.  This also triggers in lots of other
code, including SPEC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 18:31:05 +00:00
Owen Anderson
660cab32fe Use LVI to eliminate conditional branches where we've tested a related condition previously. Update tests for this change.
This fixes PR5652.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 17:12:29 +00:00
Chris Lattner
26dbe7ec18 optimize "integer extraction out of the middle of a vector" as produced
by SRoA.  This is part of rdar://7892780, but needs another xform to
expose this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 22:14:59 +00:00
Chris Lattner
e5a1426174 optimize bitcast(trunc(bitcast(x))) where the result is a float and 'x'
is a vector to be a vector element extraction.  This allows clang to
compile:

struct S { float A, B, C, D; };
float foo(struct S A) { return A.A + A.B+A.C+A.D; }

into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	movd	%xmm0, %rax
	shrq	$32, %rax
	movd	%eax, %xmm2
	addss	%xmm0, %xmm2
	movapd	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	movd	%xmm1, %rax
	shrq	$32, %rax
	movd	%eax, %xmm0
	addss	%xmm3, %xmm0
	ret

instead of:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	movd	%xmm0, %rax
	movd	%eax, %xmm0
	shrq	$32, %rax
	movd	%eax, %xmm2
	addss	%xmm0, %xmm2
	movd	%xmm1, %rax
	movd	%eax, %xmm1
	addss	%xmm2, %xmm1
	shrq	$32, %rax
	movd	%eax, %xmm0
	addss	%xmm1, %xmm0
	ret

... eliminating half of the horribleness.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 21:55:42 +00:00
Owen Anderson
62efd3b385 Make JumpThreading smart enough to properly thread StrSwitch when it's compiled with clang++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112198 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 17:40:24 +00:00
Dan Gohman
6cb8c23db1 Reapply r112091 and r111922, support for metadata linking, with a
fix: add a flag to MapValue and friends which indicates whether
any module-level mappings are being made. In the common case of
inlining, no module-level mappings are needed, so MapValue doesn't
need to examine non-function-local metadata, which can be very
expensive in the case of a large module with really deep metadata
(e.g. a large C++ program compiled with -g).

This flag is a little awkward; perhaps eventually it can be moved
into the ClonedCodeInfo class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:41:53 +00:00
Daniel Dunbar
076137c424 Revert r111922, "MapValue support for MDNodes. This is similar to r109117,
except ...", it is causing *massive* performance regressions when building Clang
with itself (-O3 -g).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 03:48:11 +00:00
Daniel Dunbar
fd406f1ee2 Revert r112091, "Remap metadata attached to instructions when remapping
individual ...", which depends on r111922, which I am reverting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 03:48:08 +00:00
Chris Lattner
2a36545176 zap dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 01:13:54 +00:00
Dan Gohman
b4e3cda118 Rewrite ExtractGV, removing a bunch of stuff that didn't fully work,
and was over-complicated, and replacing it with a simple implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 00:22:55 +00:00
Chris Lattner
aafe626c7f remove some llvmcontext arguments that are now dead post-refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 23:00:45 +00:00
Dan Gohman
ce934260dc Remap metadata attached to instructions when remapping individual
instructions, not when remapping modules.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 21:36:50 +00:00
Devang Patel
1955cf1950 DIGlobalVariable can be used to encode debug info for globals that are directly folded into a constant by FE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 18:52:02 +00:00
Dan Gohman
05ea54e886 Use MapValue in the Linker instead of having a private function
which does the same thing. This eliminates redundant code and
handles MDNodes better. MDNode linking still doesn't fully
work yet though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111941 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 18:50:07 +00:00
Owen Anderson
53c36c41ae Turn LVI on, previously detected failures should be fixed now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 17:21:18 +00:00
Dan Gohman
4ce307f963 MapValue support for MDNodes. This is similar to r109117, except
that it avoids a lot of unnecessary cloning by avoiding remapping
MDNode cycles when none of the nodes in the cycle actually need to
be remapped. Also it uses the new temporary MDNode mechanism.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 17:10:10 +00:00
Owen Anderson
b6ad691ad7 Turn LVI back off, I have a testcase now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111834 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 19:59:27 +00:00
Owen Anderson
0e2c359a3e Re-enable LazyValueInfo. Monitoring for failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 18:12:23 +00:00
Owen Anderson
02dd53e1c5 Now that PassInfo and Pass::ID have been separated, move the rest of the passes over to the new registration API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111815 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 17:52:01 +00:00
Owen Anderson
a4cba04a03 Re-apply r111568 with a fix for the clang self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 18:24:43 +00:00
Owen Anderson
45c3b65eb7 Revert r111568 to unbreak clang self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111571 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:25:16 +00:00
Owen Anderson
9419cab4c3 When a set of bitmask operations, typically from a bitfield initialization, only modifies the low bytes of a value,
we can narrow the store to only over-write the affected bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111568 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 22:15:40 +00:00
Owen Anderson
684d8d5b50 Disable LVI while I evaluate a failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 19:47:08 +00:00
Owen Anderson
f2d197b77a Tentatively enabled LVI by default. I'll be monitoring for any failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 19:04:40 +00:00
Dan Gohman
694a15eabe Process the step before the start, because it's usually the simpler
of the two.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 01:02:31 +00:00
Owen Anderson
00ac77ef88 Inform LazyValueInfo whenever a block is deleted, to avoid dangling pointer issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 18:39:01 +00:00
Chris Lattner
2fa7b48eb5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111349 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 03:14:36 +00:00
Chris Lattner
c7e31fcf49 fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111348 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 03:13:35 +00:00
Chris Lattner
473fc96889 remove some dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 02:41:56 +00:00
Chris Lattner
3126f1c028 remove dead prototype.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111342 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 02:37:06 +00:00
Eric Christopher
68c23f8616 Temporarily revert r110987 as it's causing some miscompares in
vector heavy code.  I'll re-enable when we've tracked down the problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111318 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 22:55:27 +00:00
Dan Gohman
fc8042a122 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 17:39:21 +00:00
Dan Gohman
1c034dcbbc Use the getUniquePredecessor() utility function, instead of doing
what it does manually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 17:07:02 +00:00
Evan Cheng
e1bcb440dc 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 01:34:49 +00:00
Dan Gohman
3e22b7c916 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 15:50:00 +00:00
Dan Gohman
4065f60912 Put add operands in ScalarEvolution-canonical order, when convenient.
This isn't necessary, because ScalarEvolution sorts them anyway,
but it's tidier this way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 15:39:27 +00:00
Dan Gohman
ebd9923bd8 Avoid #include <ScalarEvolution.h> in LoopSimplify.cpp, which doesn't
actually use ScalarEvolution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 14:44:03 +00:00
Dan Gohman
7a4994356b Instead, teach SimplifyCFG to trim non-address-taken blocks from
indirectbr destination lists.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 14:41:14 +00:00
Dan Gohman
c2f40066bb LoopSimplify shouldn't split loop backedges that use indirectbr. PR7867.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 00:43:09 +00:00
Dan Gohman
e2c6d131d1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 00:29:42 +00:00
Dan Gohman
e62d58884a Fix LSR's ExtractImmediate and ExtractSymbol to avoid calling
ScalarEvolution::getAddExpr, which can be pretty expensive, when nothing
has changed, which is pretty common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 21:17:19 +00:00
Nate Begeman
7f1f4089a1 Reapply this transformation now that it is passing the external test which it previously failed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 00:17:53 +00:00
Chris Lattner
1522ce9770 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 22:25:23 +00:00
Eric Christopher
7486278900 Temporarily revert 110737 and 110734, they were causing failures
in an external testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 07:01:22 +00:00
Nate Begeman
95743d8748 Add the minimal amount of smarts necessary to instcombine of shufflevectors to recognize
patterns generated by clang for transpose of a matrix in generic vectors.  This is made
of two parts:

1) Propagating vector extracts of hi/lo half into their users
2) Recognizing an insertion of even elements followed by the odd elements as an unpack.

Testcase to come, but this shrinks the # of shuffle instructions generated on x86 from ~40 to the minimal 8.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 21:38:12 +00:00
Nick Lewycky
3221834f8a Fix a use after free error caught by the valgrind builders.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110601 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09 21:03:28 +00:00
Eli Friedman
4fffb345ed PR7853: fix a silly mistake introduced in r101899, and add a test to make sure
it doesn't regress again.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110597 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09 20:49:43 +00:00
Nick Lewycky
be04fdeb6c Do more to modernize MergeFunctions. Refactor in response to Chris' code review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-08 05:04:23 +00:00
Owen Anderson
5015b3417f Don't attempt the PRE inline asm calls, since we don't value number them yet. Fixes PR7835.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110489 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 00:20:35 +00:00
Dan Gohman
60493c3f4f Eliminate PromoteMemoryToRegisterID; just use addPreserved("mem2reg")
instead, as an example of what this looks like.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 21:48:06 +00:00
Owen Anderson
90c579de5a Reapply r110396, with fixes to appease the Linux buildbot gods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 18:33:48 +00:00
Nick Lewycky
e52e9d6045 Fix uninitialized variable warning.
Also move 'default' case next to a real case to help compiler optimize in
non-Debug builds.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 07:43:46 +00:00
Nick Lewycky
c9dcbed6a3 Work in progress, cleaning up MergeFuncs.
Further clean up the comparison function by removing overly generalized
"domains".
Remove all understanding of ELF aliases and simplify folding code and comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 07:21:30 +00:00
Owen Anderson
1f74590e9d Revert r110396 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 00:23:35 +00:00
Owen Anderson
9ccaf53ada 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 23:42:04 +00:00
Owen Anderson
f35b08db50 Give JumpThreading+LVI a long-form cl::opt so that it's easier to toggle the default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 22:11:31 +00:00
Owen Anderson
b57e6558c7 Experiments show that we can safely increase our unrolling threshold without unduly impacting code size, particularly
since unrolling is not enabled at -Os.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 18:32:46 +00:00
Dan Gohman
4eaee28e34 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 17:43:57 +00:00
Dan Gohman
2511bd06de Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 01:16:35 +00:00
Dan Gohman
79fca6fea8 Thread const correctness through a bunch of AliasAnalysis interfaces and
eliminate several const_casts.

Make CallSite implicitly convertible to ImmutableCallSite.

Rename the getModRefBehavior for intrinsic IDs to
getIntrinsicModRefBehavior to avoid overload ambiguity with CallSite,
which happens to be implicitly convertible to bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110155 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 21:48:53 +00:00
Dan Gohman
0fd353376b Make instcombine set explicit alignments on load or store
instructions with alignment 0, so that subsequent passes don't
need to bother checking the TargetData ABI size manually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110128 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 18:20:32 +00:00
Peter Collingbourne
3bababf880 Add an atomic lowering pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 16:19:16 +00:00
Dan Gohman
795e70e431 Use unary + instead of a separate local variable for working
around std::min vs static const friction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110112 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 16:15:50 +00:00
Owen Anderson
61378363b7 Re-apply the infamous r108614, with a fix pointed out by Dirk Steinke.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 09:32:13 +00:00
Oscar Fuentes
ee56c42168 Prefix next' iterator operation with llvm::'.
Fixes potential ambiguity problems on VS 2010.

Patch by nobled!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 06:00:15 +00:00
Daniel Dunbar
44c7486c63 Fix a -Wreorder warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 05:43:46 +00:00
Nick Lewycky
78d4330fd8 Work in progress.
Start cleaning up MergeFunctions to look more like the rest of LLVM. The
primary change here is to move the methods responsible for comparison into the
new FunctionComparator object. Some comments added. There's more to do.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110021 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 05:23:03 +00:00