oota-llvm.git
12 years agoDuring MachineCopyPropagation a register may be the source operand of multiple
Lang Hames [Tue, 27 Mar 2012 00:44:47 +0000 (00:44 +0000)]
During MachineCopyPropagation a register may be the source operand of multiple
copies being considered for removal. Make sure to track all of the copies,
rather than just the most recent encountered, by holding a DenseSet instead of
an unsigned in SrcMap.

No test case - couldn't reduce something with a sane size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153487 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReserve hardware registers.
Akira Hatanaka [Tue, 27 Mar 2012 00:40:56 +0000 (00:40 +0000)]
Reserve hardware registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153486 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoARM has a peephole optimization which looks for a def / use pair. The def
Evan Cheng [Mon, 26 Mar 2012 23:31:00 +0000 (23:31 +0000)]
ARM has a peephole optimization which looks for a def / use pair. The def
produces a 32-bit immediate which is consumed by the use. It tries to
fold the immediate by breaking it into two parts and fold them into the
immmediate fields of two uses. e.g
       movw    r2, #40885
       movt    r3, #46540
       add     r0, r0, r3
=>
       add.w   r0, r0, #3019898880
       add.w   r0, r0, #30146560
;
However, this transformation is incorrect if the user produces a flag. e.g.
       movw    r2, #40885
       movt    r3, #46540
       adds    r0, r0, r3
=>
       add.w   r0, r0, #3019898880
       adds.w  r0, r0, #30146560
Note the adds.w may not set the carry flag even if the original sequence
would.

rdar://11116189

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153484 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a debug option to dump PBQP graphs during register allocation.
Lang Hames [Mon, 26 Mar 2012 23:07:23 +0000 (23:07 +0000)]
Add a debug option to dump PBQP graphs during register allocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153483 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSCEV fix: Handle loop invariant loads.
Andrew Trick [Mon, 26 Mar 2012 22:33:59 +0000 (22:33 +0000)]
SCEV fix: Handle loop invariant loads.

Fixes PR11882: NULL dereference in ComputeLoadConstantCompareExitLimit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153480 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd 'undef's to make SWIG happier. Patch by Baozeng Ding.
Bill Wendling [Mon, 26 Mar 2012 22:15:12 +0000 (22:15 +0000)]
Add 'undef's to make SWIG happier. Patch by Baozeng Ding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153479 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd InitializeNativeTargetDisassembler function.
Eric Christopher [Mon, 26 Mar 2012 21:56:56 +0000 (21:56 +0000)]
Add InitializeNativeTargetDisassembler function.

Patch by Ojab.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153476 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUnit test for PR11950: LSR crash.
Andrew Trick [Mon, 26 Mar 2012 21:45:37 +0000 (21:45 +0000)]
Unit test for PR11950: LSR crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153472 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse the file in the inlined die rather than the compile unit for
Eric Christopher [Mon, 26 Mar 2012 21:38:38 +0000 (21:38 +0000)]
Use the file in the inlined die rather than the compile unit for
backtrace locations.

Testcase forthcoming, but I wanted to get some testing here.

Should fix:

PR12323
PR12314
rdar://11091100

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153471 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago153465 was incorrect. In this code we wanted to check that the pointer operand is...
Nadav Rotem [Mon, 26 Mar 2012 21:00:53 +0000 (21:00 +0000)]
153465 was incorrect. In this code we wanted to check that the pointer operand is of pointer type (and not vector type).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153468 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMade RuntimeDyldMachO support vanilla i386
Sean Callanan [Mon, 26 Mar 2012 20:45:52 +0000 (20:45 +0000)]
Made RuntimeDyldMachO support vanilla i386
relocations.  The algorithm is the same as
that for x86_64.  Scattered relocations, a
feature present in i386 but not on x86_64,
are not yet supported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153466 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR12357: The pointer was used before it was checked.
Nadav Rotem [Mon, 26 Mar 2012 20:39:18 +0000 (20:39 +0000)]
PR12357: The pointer was used before it was checked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153465 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoLSR ivchain bug fix: corner case with ConstantExpr.
Andrew Trick [Mon, 26 Mar 2012 20:28:37 +0000 (20:28 +0000)]
LSR ivchain bug fix: corner case with ConstantExpr.

Fixes PR11950.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153463 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agocomment typo
Andrew Trick [Mon, 26 Mar 2012 20:28:35 +0000 (20:28 +0000)]
comment typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153462 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoeliminate an unneeded branch, part of PR12357
Chris Lattner [Mon, 26 Mar 2012 19:13:57 +0000 (19:13 +0000)]
eliminate an unneeded branch, part of PR12357

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153458 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agofix a failure path to print the right thing, part of PR12357
Chris Lattner [Mon, 26 Mar 2012 19:11:51 +0000 (19:11 +0000)]
fix a failure path to print the right thing, part of PR12357

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153457 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTidy.
Eric Christopher [Mon, 26 Mar 2012 19:09:40 +0000 (19:09 +0000)]
Tidy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153456 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTidy.
Eric Christopher [Mon, 26 Mar 2012 19:09:38 +0000 (19:09 +0000)]
Tidy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153455 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r153423 as this is causing failures on our internal nightly testers.
Chad Rosier [Mon, 26 Mar 2012 18:07:14 +0000 (18:07 +0000)]
Revert r153423 as this is causing failures on our internal nightly testers.

Original commit message:
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loading a boolean value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153452 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoLSR cleanup: potential bug caught by PVS-Studio.
Andrew Trick [Mon, 26 Mar 2012 18:03:16 +0000 (18:03 +0000)]
LSR cleanup: potential bug caught by PVS-Studio.

Thanks Andrey.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153451 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agodocs/lit: Add some notes on the lit test run output format.
Daniel Dunbar [Mon, 26 Mar 2012 18:01:14 +0000 (18:01 +0000)]
docs/lit: Add some notes on the lit test run output format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153450 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[tsan] treat vtable pointer updates in a special way (requires tbaa); fix a bug ...
Kostya Serebryany [Mon, 26 Mar 2012 17:35:03 +0000 (17:35 +0000)]
[tsan] treat vtable pointer updates in a special way (requires tbaa); fix a bug (forgot to return true after instrumenting); make sure the tsan tests are run

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153448 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNo need to do an expensive stable sort for a bunch of integers.
Benjamin Kramer [Mon, 26 Mar 2012 14:17:26 +0000 (14:17 +0000)]
No need to do an expensive stable sort for a bunch of integers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153438 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd missing include of <new>
Douglas Gregor [Mon, 26 Mar 2012 14:04:17 +0000 (14:04 +0000)]
Add missing include of <new>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153436 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix GetMainExecutable on kFreeBSD.
Anton Korobeynikov [Mon, 26 Mar 2012 12:05:51 +0000 (12:05 +0000)]
Fix GetMainExecutable on kFreeBSD.
Patch by Sylvestre Ledru!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153435 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove stale CBackend tests.
Benjamin Kramer [Mon, 26 Mar 2012 11:16:50 +0000 (11:16 +0000)]
Remove stale CBackend tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153433 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTableGen: Don't emit the llvm intrinsic -> gcc builtin table, its only user was the...
Benjamin Kramer [Mon, 26 Mar 2012 11:08:03 +0000 (11:08 +0000)]
TableGen: Don't emit the llvm intrinsic -> gcc builtin table, its only user was the c backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153432 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPrune some includes and forward declarations.
Craig Topper [Mon, 26 Mar 2012 06:58:25 +0000 (06:58 +0000)]
Prune some includes and forward declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153429 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a debug statement.
Eric Christopher [Mon, 26 Mar 2012 06:10:32 +0000 (06:10 +0000)]
Add a debug statement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153428 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd some fixes to the configure script for isInf and add
Eric Christopher [Mon, 26 Mar 2012 02:09:01 +0000 (02:09 +0000)]
Add some fixes to the configure script  for isInf and add
--enable-libcpp to projects/sample.

Patch by Dmitri Shubin with additional fixes by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153425 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate documentation for old api changes.
Eric Christopher [Mon, 26 Mar 2012 01:56:34 +0000 (01:56 +0000)]
Update documentation for old api changes.

Fixes PR12050

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153424 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse the new range metadata in computeMaskedBits and add a new optimization to
Rafael Espindola [Mon, 26 Mar 2012 01:44:11 +0000 (01:44 +0000)]
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loding a boolean value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153423 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPrune includes and replace uses of ARMRegisterInfo.h with ARMBaeRegisterInfo.h
Craig Topper [Mon, 26 Mar 2012 00:45:15 +0000 (00:45 +0000)]
Prune includes and replace uses of ARMRegisterInfo.h with ARMBaeRegisterInfo.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153422 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReplace uses of ARMBaseInstrInfo and ARMTargetMachine with the Base versions.
Craig Topper [Sun, 25 Mar 2012 23:49:58 +0000 (23:49 +0000)]
Replace uses of ARMBaseInstrInfo and ARMTargetMachine with the Base versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153421 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTeach instsimplify how to simplify comparisons of pointers which are
Chandler Carruth [Sun, 25 Mar 2012 21:28:14 +0000 (21:28 +0000)]
Teach instsimplify how to simplify comparisons of pointers which are
constant-offsets of a common base using the generic GEP-walking logic
I added for computing pointer differences in the same situation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153419 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch the pointer-difference simplification logic to only work with
Chandler Carruth [Sun, 25 Mar 2012 20:43:07 +0000 (20:43 +0000)]
Switch the pointer-difference simplification logic to only work with
inbounds GEPs. This isn't really necessary for simplifying pointer
differences, but I'm planning to re-use the same code to simplify
pointer comparisons where it is necessary. Since real code almost
exclusively uses inbounds GEPs, it doesn't seem worth it to support the
extra complexity of turning it on and off. If anyone would like that
back, feel free to shout. Note that instcombine will still catch any of
these patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153418 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPrune some includes and forward declarations.
Craig Topper [Sun, 25 Mar 2012 18:10:17 +0000 (18:10 +0000)]
Prune some includes and forward declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153415 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPrune some includes and forward declarations.
Craig Topper [Sun, 25 Mar 2012 18:09:44 +0000 (18:09 +0000)]
Prune some includes and forward declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153414 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThis file is no longer needed (DejaGNU-isms removed from code)
Eli Bendersky [Sun, 25 Mar 2012 12:43:54 +0000 (12:43 +0000)]
This file is no longer needed (DejaGNU-isms removed from code)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153412 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agos/restrict/describe/
Rafael Espindola [Sun, 25 Mar 2012 11:14:35 +0000 (11:14 +0000)]
s/restrict/describe/
Thanks Duncan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153411 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTeach the function cloner (and thus the inliner) to simplify PHINodes
Chandler Carruth [Sun, 25 Mar 2012 10:34:54 +0000 (10:34 +0000)]
Teach the function cloner (and thus the inliner) to simplify PHINodes
aggressively. There are lots of dire warnings about this being expensive
that seem to predate switching to the TrackingVH-based value remapper
that is automatically updated on RAUW. This makes it easy to not just
prune single-entry PHIs, but to fully simplify PHIs, and to recursively
simplify the newly inlined code to propagate PHINode simplifications.

This introduces a bit of a thorny problem though. We may end up
simplifying a branch condition to a constant when we fold PHINodes, and
we would like to nuke any dead blocks resulting from this so that time
isn't wasted continually analyzing them, but this isn't easy. Deleting
basic blocks *after* they are fully cloned and mapped into the new
function currently requires manually updating the value map. The last
piece of the simplification-during-inlining puzzle will require either
switching to WeakVH mappings or some other piece of refactoring. I've
left a FIXME in the testcase about this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153410 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix lit failure on cmake-clang-x64_64-linux bot, apparently due to its having
Eli Bendersky [Sun, 25 Mar 2012 09:42:28 +0000 (09:42 +0000)]
Fix lit failure on cmake-clang-x64_64-linux bot, apparently due to its having
a very (*very*) old version of Python (2.4?)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153409 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoContinue cleanup of LIT, getting rid of the remaining artifacts from dejagnu
Eli Bendersky [Sun, 25 Mar 2012 09:02:19 +0000 (09:02 +0000)]
Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu

* Removed test/lib/llvm.exp - it is no longer needed
* Deleted the dg.exp reading code from test/lit.cfg. There are no dg.exp files
  left in the test suite so this code is no longer required. test/lit.cfg is
  now much shorter and clearer
* Removed a lot of duplicate code in lit.local.cfg files that need access to
  the root configuration, by adding a "root" attribute to the TestingConfig
  object. This attribute is dynamically computed to provide the same
  information as was previously provided by the custom getRoot functions.
* Documented the config.root attribute in docs/CommandGuide/lit.pod

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153408 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove the instruction simplification of callsite arguments in the inliner
Chandler Carruth [Sun, 25 Mar 2012 04:03:40 +0000 (04:03 +0000)]
Move the instruction simplification of callsite arguments in the inliner
to instead rely on much more generic and powerful instruction
simplification in the function cloner (and thus inliner).

This teaches the pruning function cloner to use instsimplify rather than
just the constant folder to fold values during cloning. This can
simplify a large number of things that constant folding alone cannot
begin to touch. For example, it will realize that 'or' and 'and'
instructions with certain constant operands actually become constants
regardless of what their other operand is. It also can thread back
through the caller to perform simplifications that are only possible by
looking up a few levels. In particular, GEPs and pointer testing tend to
fold much more heavily with this change.

This should (in some cases) have a positive impact on compile times with
optimizations on because the inliner itself will simply avoid cloning
a great deal of code. It already attempted to prune proven-dead code,
but now it will be use the stronger simplifications to prove more code
dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153403 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd an asserting ValueHandle to the block simplification code which will
Chandler Carruth [Sun, 25 Mar 2012 03:29:25 +0000 (03:29 +0000)]
Add an asserting ValueHandle to the block simplification code which will
fire if anything ever invalidates the assumption of a terminator
instruction being unchanged throughout the routine.

I've convinced myself that the current definition of simplification
precludes such a transformation, so I think getting some asserts
coverage that we don't violate this agreement is sufficient to make this
code safe for the foreseeable future.

Comments to the contrary or other suggestions are of course welcome. =]
The bots are now happy with this code though, so it appears the bug here
has indeed been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153401 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse the isReachableFromEntry method.
Rafael Espindola [Sat, 24 Mar 2012 23:29:27 +0000 (23:29 +0000)]
Use the isReachableFromEntry method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153400 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't form a WeakVH around the sentinel node in the instructions BB
Chandler Carruth [Sat, 24 Mar 2012 23:03:27 +0000 (23:03 +0000)]
Don't form a WeakVH around the sentinel node in the instructions BB
list. This is a bad idea. ;] I'm hopeful this is the bug that's showing
up with the MSVC bots, but we'll see.

It is definitely unnecessary. InstSimplify won't do anything to
a terminator instruction, we don't need to even include it in the
iteration range. We can also skip the now dead terminator check,
although I've made it an assert to help document that this is an
important invariant.

I'm still a bit queasy about this because there is an implicit
assumption that the terminator instruction cannot be RAUW'ed by the
simplification code. While that appears to be true at the moment, I see
no guarantee that would ensure it remains true in the future. I'm
looking at the cleanest way to solve that...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153399 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAvoid using dominatedBySlowTreeWalk.
Rafael Espindola [Sat, 24 Mar 2012 22:52:25 +0000 (22:52 +0000)]
Avoid using dominatedBySlowTreeWalk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153398 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTry to harden the recursive simplification still further. This is again
Chandler Carruth [Sat, 24 Mar 2012 22:34:26 +0000 (22:34 +0000)]
Try to harden the recursive simplification still further. This is again
spotted by inspection, and I've crafted no test case that triggers it on
my machine, but some of the windows builders are hitting what looks like
memory corruption, so *something* is amiss here.

This patch takes a more generalized approach to eliminating
double-visits. Imagine code such as:

  %x = ...
  %y = add %x, 1
  %z = add %x, %y

You can imagine that if we simplify %x, we would add %y and %z to the
list. If the use-chain order happens to cause us to add them in reverse
order, we could pull %y off first, and simplify it, adding %z to the
list. We now have %z on the list twice, and will reference it after it
is deleted.

Currently, all my test cases happen to not trigger this, likely due to
the use-chain ordering, but there seems no guarantee that such
a situation could not occur, so we should handle it correctly.

Again, if anyone knows how to craft a testcase that actually triggers
this, please let me know.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153397 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't add the instruction about to be RAUW'ed and erased to the
Chandler Carruth [Sat, 24 Mar 2012 22:34:23 +0000 (22:34 +0000)]
Don't add the instruction about to be RAUW'ed and erased to the
worklist. This can happen in theory when an instruction uses itself,
such as a PHI node. This was spotted by inspection, and unfortunately
I've not been able to come up with a test case that would trigger it. If
anyone has ideas, let me know...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153396 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix null to integer conversion warnings.
Jean-Daniel Dupas [Sat, 24 Mar 2012 22:17:50 +0000 (22:17 +0000)]
Fix null to integer conversion warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153395 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFileCheck-ize this test. Note the FIXME I've introduced here: we've
Chandler Carruth [Sat, 24 Mar 2012 21:24:19 +0000 (21:24 +0000)]
FileCheck-ize this test. Note the FIXME I've introduced here: we've
regressed seriously here, we are no longer removing allocas during
inline cleanup. This appears to be because of lifetime markers "using"
them. =/ I'll look into this shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153394 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor the interface to recursively simplifying instructions to be tad
Chandler Carruth [Sat, 24 Mar 2012 21:11:24 +0000 (21:11 +0000)]
Refactor the interface to recursively simplifying instructions to be tad
bit simpler by handling a common case explicitly.

Also, refactor the implementation to use a worklist based walk of the
recursive users, rather than trying to use value handles to detect and
recover from RAUWs during the recursive descent. This fixes a very
subtle bug in the previous implementation where degenerate control flow
structures could cause mutually recursive instructions (PHI nodes) to
collapse in just such a way that From became equal to To after some
amount of recursion. At that point, we hit the inf-loop that the assert
at the top attempted to guard against. This problem is defined away when
not using value handles in this manner. There are lots of comments
claiming that the WeakVH will protect against just this sort of error,
but they're not accurate about the actual implementation of WeakVHs,
which do still track RAUWs.

I don't have any test case for the bug this fixes because it requires
running the recursive simplification on unreachable phi nodes. I've no
way to either run this or easily write an input that triggers it. It was
found when using instruction simplification inside the inliner when
running over the nightly test-suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153393 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove always true variable.
Rafael Espindola [Sat, 24 Mar 2012 20:02:25 +0000 (20:02 +0000)]
Remove always true variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153392 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a small release not about the range metadata.
Rafael Espindola [Sat, 24 Mar 2012 19:02:32 +0000 (19:02 +0000)]
Add a small release not about the range metadata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153391 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix small-integer VAARG on SVR4 ABI PPC64.
Hal Finkel [Sat, 24 Mar 2012 03:53:55 +0000 (03:53 +0000)]
Fix small-integer VAARG on SVR4 ABI PPC64.

The PPC64 SVR4 ABI requires integer stack arguments, and thus the var. args., that
are smaller than 64 bits be zero extended to 64 bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153373 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd the ability to promote legal integer VAARGs. This is required for the PPC64 SVR4...
Hal Finkel [Sat, 24 Mar 2012 03:53:52 +0000 (03:53 +0000)]
Add the ability to promote legal integer VAARGs. This is required for the PPC64 SVR4 ABI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153372 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix the MSVC build.
Francois Pichet [Sat, 24 Mar 2012 01:36:37 +0000 (01:36 +0000)]
Fix the MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153366 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPTX: Fix predicate logic bug
Justin Holewinski [Sat, 24 Mar 2012 01:23:20 +0000 (01:23 +0000)]
PTX: Fix predicate logic bug

Code such as:

%vreg100 = setcc %vreg10, -1, SETNE
brcond %vreg10, %tgt

was being incorrectly morphed into

%vreg100 = and %vreg10, 1
brcond %vreg10, %tgt

where the 'and' instruction could be eliminated since
such logic is on 1-bit types in the PTX back-end, leaving
us with just:

brcond %vreg10, %tgt

which essentially gives us inverted branch conditions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153364 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMore IndVarSimplify cleanup.
Andrew Trick [Sat, 24 Mar 2012 00:51:17 +0000 (00:51 +0000)]
More IndVarSimplify cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153362 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFirst part of PR12251. Add documentation and verifier support for the range
Rafael Espindola [Sat, 24 Mar 2012 00:14:51 +0000 (00:14 +0000)]
First part of PR12251. Add documentation and verifier support for the range
metadata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153359 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoadd EP_OptimizerLast extension point
Kostya Serebryany [Fri, 23 Mar 2012 23:22:59 +0000 (23:22 +0000)]
add EP_OptimizerLast extension point

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153353 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIt's possible for two types, which are isomorphic, to be added to the
Bill Wendling [Fri, 23 Mar 2012 23:17:38 +0000 (23:17 +0000)]
It's possible for two types, which are isomorphic, to be added to the
destination module, but one of them isn't used in the destination module. If
another module comes along and the uses the unused type, there could be type
conflicts when the modules are finally linked together. (This happened when
building LLVM.)

The test that was reduced is:

Module A:

%Z = type { %A }
%A = type { %B.1, [7 x x86_fp80] }
%B.1 = type { %C }
%C = type { i8* }

declare void @func_x(%C*, i64, i64)
declare void @func_z(%Z* nocapture)

Module B:

%B = type { %C.1 }
%C.1 = type { i8* }
%A.2 = type { %B.3, [5 x x86_fp80] }
%B.3 = type { %C.1 }

define void @func_z() {
  %x = alloca %A.2, align 16
  %y = getelementptr inbounds %A.2* %x, i64 0, i32 0, i32 0
  call void @func_x(%C.1* %y, i64 37, i64 927) nounwind
  ret void
}

declare void @func_x(%C.1*, i64, i64)
declare void @func_y(%B* nocapture)

(Unfortunately, this test doesn't fail under llvm-link, only during an LTO
linking.) The '%C' and '%C.1' clash. The destination module gets the '%C'
declaration. When merging Module B, it looks at the '%C.1' subtype of the '%B'
structure. It adds that in, because that's cool. And when '%B.3' is processed,
it uses the '%C.1'. But the '%B' has used '%C' and we prefer to use '%C'. So the
'@func_x' type is changed to 'void (%C*, i64, i64)', but the type of '%x' in
'@func_z' remains '%A.2'. The GEP resolves to a '%C.1', which conflicts with the
'@func_x' signature.

We can resolve this situation by making sure that the type is used in the
destination before saying that it should be used in the module being merged in.

With this fix, LLVM and Clang both compile under LTO.
<rdar://problem/10913281>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153351 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoARM tidy up ARMConstantIsland.cpp.
Jim Grosbach [Fri, 23 Mar 2012 23:07:03 +0000 (23:07 +0000)]
ARM tidy up ARMConstantIsland.cpp.

No functional change, just tidy up the code and nomenclature a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153347 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPretty-printing comments for literal floating point in .s files.
Jim Grosbach [Fri, 23 Mar 2012 23:06:47 +0000 (23:06 +0000)]
Pretty-printing comments for literal floating point in .s files.

Dump the hex representation to the comment stream as well as the float
value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153346 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a hook in MCELFObjectTargetWriter to allow targets to sort relocation
Akira Hatanaka [Fri, 23 Mar 2012 23:06:45 +0000 (23:06 +0000)]
Add a hook in MCELFObjectTargetWriter to allow targets to sort relocation
entries in the relocation table before they are written out to the file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153345 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't convert objc_retainAutoreleasedReturnValue to objc_retain if it
Dan Gohman [Fri, 23 Mar 2012 18:09:00 +0000 (18:09 +0000)]
Don't convert objc_retainAutoreleasedReturnValue to objc_retain if it
is retaining the return value of an invoke that it immediately follows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153344 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIt's not possible to insert code immediately after an invoke in the
Dan Gohman [Fri, 23 Mar 2012 17:47:54 +0000 (17:47 +0000)]
It's not possible to insert code immediately after an invoke in the
same basic block, and it's not safe to insert code in the successor
blocks if the edges are critical edges. Splitting those edges is
possible, but undesirable, especially on the unwind side. Instead,
make the bottom-up code motion to consider invokes to be part of
their successor blocks, rather than part of their parent blocks, so
that it doesn't push code past them and onto the edges. This fixes
PR12307.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153343 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake it feasible for clients using EngineBuilder to capture the TargetMachine that...
Owen Anderson [Fri, 23 Mar 2012 17:40:56 +0000 (17:40 +0000)]
Make it feasible for clients using EngineBuilder to capture the TargetMachine that is created as part of selecting the appropriate target.
This is necessary if the client wants to be able to mutate TargetOptions (for example, fast FP math mode) after the initial creation of the ExecutionEngine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for register masks to PBQP.
Lang Hames [Fri, 23 Mar 2012 17:33:42 +0000 (17:33 +0000)]
Add support for register masks to PBQP.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153341 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInclude cctype for std::isprint.
Benjamin Kramer [Fri, 23 Mar 2012 11:49:32 +0000 (11:49 +0000)]
Include cctype for std::isprint.

This should unbreak the msvc build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153329 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInclude cstdio in a few place that depended on getting it transitively through String...
Benjamin Kramer [Fri, 23 Mar 2012 11:35:30 +0000 (11:35 +0000)]
Include cstdio in a few place that depended on getting it transitively through StringExtras.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153328 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove ftostr into its last user (cppbackend) and simplify it a bit.
Benjamin Kramer [Fri, 23 Mar 2012 11:26:29 +0000 (11:26 +0000)]
Move ftostr into its last user (cppbackend) and simplify it a bit.

New code should use raw_ostream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153326 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd soname to LLVM shared library on Linux. Probably the same stuff is necessary...
Anton Korobeynikov [Fri, 23 Mar 2012 10:00:42 +0000 (10:00 +0000)]
Add soname to LLVM shared library on Linux. Probably the same stuff is necessary for *BSD.
Patch from Mageia!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153324 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen propagating equalities, eg replacing A with B in every basic block
Duncan Sands [Fri, 23 Mar 2012 08:45:52 +0000 (08:45 +0000)]
When propagating equalities, eg replacing A with B in every basic block
dominated by Root, check that B is available throughout the scope.  This
is obviously true (famous last words?) given the current logic, but the
check may be helpful if more complicated reasoning is added one day.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153323 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIndentation.
Duncan Sands [Fri, 23 Mar 2012 08:29:04 +0000 (08:29 +0000)]
Indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153322 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIgnore the last message.
Bill Wendling [Fri, 23 Mar 2012 07:22:49 +0000 (07:22 +0000)]
Ignore the last message.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153315 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert patch. It broke the build.
Bill Wendling [Fri, 23 Mar 2012 07:21:18 +0000 (07:21 +0000)]
Revert patch. It broke the build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153314 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDematerialize the source functions after we're done with them. This saves a bit
Bill Wendling [Fri, 23 Mar 2012 07:18:22 +0000 (07:18 +0000)]
Dematerialize the source functions after we're done with them. This saves a bit
of memory during LTO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153313 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the C backend.
Eric Christopher [Fri, 23 Mar 2012 05:50:46 +0000 (05:50 +0000)]
Remove the C backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153307 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix up cmake build.
Eric Christopher [Fri, 23 Mar 2012 03:55:14 +0000 (03:55 +0000)]
Fix up cmake build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153306 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTake out the debug info probe stuff. It's making some changes to
Eric Christopher [Fri, 23 Mar 2012 03:54:05 +0000 (03:54 +0000)]
Take out the debug info probe stuff. It's making some changes to
the PassManager annoying and should be reimplemented as a decorator
on top of existing passes (as should the timing data).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153305 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoExplicitly close optionally closed <li> tags.
Nick Lewycky [Fri, 23 Mar 2012 00:56:26 +0000 (00:56 +0000)]
Explicitly close optionally closed <li> tags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153296 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove -enable-lsr-retry in time for 3.1.
Andrew Trick [Thu, 22 Mar 2012 22:42:51 +0000 (22:42 +0000)]
Remove -enable-lsr-retry in time for 3.1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153287 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove -enable-lsr-nested in time for 3.1.
Andrew Trick [Thu, 22 Mar 2012 22:42:45 +0000 (22:42 +0000)]
Remove -enable-lsr-nested in time for 3.1.

Tests cases have been removed but attached to open PR12330.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153286 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSome whitespace and comment cleanup.
Bill Wendling [Thu, 22 Mar 2012 20:47:54 +0000 (20:47 +0000)]
Some whitespace and comment cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153278 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unneeded #ifdefs.
Bill Wendling [Thu, 22 Mar 2012 20:30:41 +0000 (20:30 +0000)]
Remove unneeded #ifdefs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153277 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a 'dump' method to the type map. Doxygenify some of the comments and add a
Bill Wendling [Thu, 22 Mar 2012 20:28:27 +0000 (20:28 +0000)]
Add a 'dump' method to the type map. Doxygenify some of the comments and add a
few comments where none existed before. Also change a function's name to match
the current coding standard.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153276 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSource order scheduler should not preschedule nodes with multiple uses. rdar://11096639
Evan Cheng [Thu, 22 Mar 2012 19:31:17 +0000 (19:31 +0000)]
Source order scheduler should not preschedule nodes with multiple uses. rdar://11096639

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153270 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAssign node orders to target intrinsics which do not produce results. rdar://11096639
Evan Cheng [Thu, 22 Mar 2012 19:29:09 +0000 (19:29 +0000)]
Assign node orders to target intrinsics which do not produce results. rdar://11096639

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153269 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor the code for visiting instructions out into helper functions.
Dan Gohman [Thu, 22 Mar 2012 18:24:56 +0000 (18:24 +0000)]
Refactor the code for visiting instructions out into helper functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153267 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCleanup IVUsers::addUsersIfInteresting.
Andrew Trick [Thu, 22 Mar 2012 17:47:33 +0000 (17:47 +0000)]
Cleanup IVUsers::addUsersIfInteresting.

Keep the public interface clean, even though LLVM proper does not
currently use it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153263 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused simplifyIVUsers
Andrew Trick [Thu, 22 Mar 2012 17:47:30 +0000 (17:47 +0000)]
Remove unused simplifyIVUsers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153262 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove -enable-iv-rewrite, which has been unsupported since 3.0.
Andrew Trick [Thu, 22 Mar 2012 17:10:11 +0000 (17:10 +0000)]
Remove -enable-iv-rewrite, which has been unsupported since 3.0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153260 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoConvert -indvars tests that rely on SCEV expansion to -loop-reduce tests.
Andrew Trick [Thu, 22 Mar 2012 17:10:07 +0000 (17:10 +0000)]
Convert -indvars tests that rely on SCEV expansion to -loop-reduce tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153259 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove tests: indvars trivially preserves GEPs now.
Andrew Trick [Thu, 22 Mar 2012 17:09:46 +0000 (17:09 +0000)]
Remove tests: indvars trivially preserves GEPs now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153258 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove test: trivial canonical IV test which is covered by other SCEV tests.
Andrew Trick [Thu, 22 Mar 2012 17:09:34 +0000 (17:09 +0000)]
Remove test: trivial canonical IV test which is covered by other SCEV tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153257 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest scalar evolution directly instead of testing the result of
Andrew Trick [Thu, 22 Mar 2012 17:09:31 +0000 (17:09 +0000)]
Test scalar evolution directly instead of testing the result of
canonical indvars.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153256 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove redundant -enable-iv-rewrite=false flags from test cases.
Andrew Trick [Thu, 22 Mar 2012 17:09:04 +0000 (17:09 +0000)]
Remove redundant -enable-iv-rewrite=false flags from test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153255 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdded soft fail checks for the disassembler when decoding some corner cases of the...
Silviu Baranga [Thu, 22 Mar 2012 14:14:49 +0000 (14:14 +0000)]
Added soft fail checks for the disassembler when decoding some corner cases of the STRD, STRH, LDRD, LDRH, LDRSH and LDRSB instructions on ARM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153252 91177308-0d34-0410-b5e6-96231b3b80d8