oota-llvm.git
12 years agoDon't call 'FilesToRemove[0]' when the vector is empty, even to compute
Chandler Carruth [Sat, 16 Jun 2012 00:44:07 +0000 (00:44 +0000)]
Don't call 'FilesToRemove[0]' when the vector is empty, even to compute
the address of it. Found by a checking STL implementation used on
a dragonegg builder. Sorry about this one. =/

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

12 years agoHarden the Unix signals code to be more async signal safe.
Chandler Carruth [Sat, 16 Jun 2012 00:09:41 +0000 (00:09 +0000)]
Harden the Unix signals code to be more async signal safe.

This is likely only the tip of the ice berg, but this particular bug
caused any double-free on a glibc system to turn into a deadlock! It is
not generally safe to either allocate or release heap memory from within
the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting
memory and causing the deadlock. What's worse, eraseFromDisk in PathV1
has lots of allocation and deallocation paths. We even passed 'true' in
a place that would have caused the *signal handler* to try to run the
'system' system call and shell out to 'rm -rf'. That was never going to
work...

This patch switches the file removal to use a vector of strings so that
the exact text needed for the 'unlink' system call can be stored there.
It switches the loop to be a boring indexed loop, and directly calls
unlink without looking at the error. It also works quite hard to ensure
that calling 'c_str()' is safe, by ensuring that the non-signal-handling
code path that manipulates the vector always leaves it in a state where
every element has already had 'c_str()' called at least once.

I dunno exactly how overkill this is, but it fixes the
deadlock-on-double free issue, and seems likely to prevent any other
issues from sneaking up.

Sorry for not having a test case, but I *really* don't know how to test
signal handling code easily....

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

12 years agoRemove final verification in RABasic.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 23:48:48 +0000 (23:48 +0000)]
Remove final verification in RABasic.

We now have a proper machine code verifier pass between register
allocation and rewriting.

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

12 years agoPrint out register number in InlineSpiller.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 23:47:09 +0000 (23:47 +0000)]
Print out register number in InlineSpiller.

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

12 years agoUnit test for LSR kind=Special fix: r158536.
Andrew Trick [Fri, 15 Jun 2012 22:46:31 +0000 (22:46 +0000)]
Unit test for LSR kind=Special fix: r158536.

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

12 years agoAccept null PhysReg arguments to checkRegMaskInterference.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 22:24:22 +0000 (22:24 +0000)]
Accept null PhysReg arguments to checkRegMaskInterference.

Calling checkRegMaskInterference(VirtReg) checks if VirtReg crosses any
regmask operands, regardless of the registers they clobber.

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

12 years ago[docs] Make it pretty.
Michael J. Spencer [Fri, 15 Jun 2012 22:17:44 +0000 (22:17 +0000)]
[docs] Make it pretty.

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

12 years agoFix the encoding of the armv7m (MClass) for MSR registers other than aspr,
Kevin Enderby [Fri, 15 Jun 2012 22:14:44 +0000 (22:14 +0000)]
Fix the encoding of the armv7m (MClass) for MSR registers other than aspr,
iaspr, espr and xpsr which also needed to have 0b10 in their mask encoding bits.

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

12 years agoARM: optimization for sub+abs.
Manman Ren [Fri, 15 Jun 2012 21:32:12 +0000 (21:32 +0000)]
ARM: optimization for sub+abs.

This patch will optimize abs(x-y)
FROM
sub, movs, rsbmi
TO
subs, rsbmi

For abs, we will use cmp instead of movs. This is necessary because we already
have an existing peephole pass which optimizes away cmp following sub.

rdar: 11633193

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

12 years ago*fixed to separate mnemonic from operands with tab
Kay Tiong Khoo [Fri, 15 Jun 2012 21:04:21 +0000 (21:04 +0000)]
*fixed to separate mnemonic from operands with tab

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

12 years agoLSR: fix expansion of scaled reg in non-address type formulae.
Andrew Trick [Fri, 15 Jun 2012 20:07:29 +0000 (20:07 +0000)]
LSR: fix expansion of scaled reg in non-address type formulae.

For non-address users, Base and Scaled registers are not specially
associated to fit an address mode, so SCEVExpander should apply normal
expansion rules. Otherwise we may sink computation into inner loops
that have already been optimized.

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

12 years agoLSR fix: "Special" users are just like "Basic" users but allow -1 scale.
Andrew Trick [Fri, 15 Jun 2012 20:07:26 +0000 (20:07 +0000)]
LSR fix: "Special" users are just like "Basic" users but allow -1 scale.

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

12 years agoRemove assignments which aren't used afterwards.
Bill Wendling [Fri, 15 Jun 2012 19:30:42 +0000 (19:30 +0000)]
Remove assignments which aren't used afterwards.

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

12 years agoRemove assignments which aren't used afterwards.
Bill Wendling [Fri, 15 Jun 2012 19:28:20 +0000 (19:28 +0000)]
Remove assignments which aren't used afterwards.

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

12 years agoAllow SROA to split up an array of vectors into multiple vectors, even when the vecto...
Pete Cooper [Fri, 15 Jun 2012 18:07:29 +0000 (18:07 +0000)]
Allow SROA to split up an array of vectors into multiple vectors, even when the vectors are dynamically indexed

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

12 years agoSome optimizations done by globalopt are safe only for internal linkage, not
Rafael Espindola [Fri, 15 Jun 2012 18:00:24 +0000 (18:00 +0000)]
Some optimizations done by globalopt are safe only for internal linkage, not
linkonce linkage. For example, it is not valid to add unnamed_addr.

This also fixes a crash in g++.dg/opt/static5.C.

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

12 years agoPreserve <undef> flags in ARMExpandPseudo.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 17:46:54 +0000 (17:46 +0000)]
Preserve <undef> flags in ARMExpandPseudo.

This probably mostly shows up in bugpoint-generated code.

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

12 years agoUse regunit liveness in RegisterCoalescer when it is available.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 17:36:48 +0000 (17:36 +0000)]
Use regunit liveness in RegisterCoalescer when it is available.

We only do very limited physreg coalescing now, but we still merge
virtual registers into reserved registers.

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

12 years agoFactor macro argument parsing into helper methods and add support for .irp.
Rafael Espindola [Fri, 15 Jun 2012 14:02:34 +0000 (14:02 +0000)]
Factor macro argument parsing into helper methods and add support for .irp.
Patch extracted from a larger one by the PaX team. I added the testcases
and tightened error handling a bit.

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

12 years agoFree the allocated filename. Found by clang static analyzer.
Bill Wendling [Fri, 15 Jun 2012 09:11:47 +0000 (09:11 +0000)]
Free the allocated filename. Found by clang static analyzer.

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

12 years agoFix issues (infinite loop and/or crash) with self-referential instructions, for
Duncan Sands [Fri, 15 Jun 2012 08:37:50 +0000 (08:37 +0000)]
Fix issues (infinite loop and/or crash) with self-referential instructions, for
example degenerate phi nodes and binops that use themselves in unreachable code.
Thanks to Charles Davis for the testcase that uncovered this can of worms.

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

12 years agoMove AVX version of convert instructions that write to GPRs to the Op1 table.
Craig Topper [Fri, 15 Jun 2012 07:02:58 +0000 (07:02 +0000)]
Move AVX version of convert instructions that write to GPRs to the Op1 table.

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

12 years agoHad a closing brace inside an #ifdef -- oops!
Marshall Clow [Fri, 15 Jun 2012 01:15:47 +0000 (01:15 +0000)]
Had a closing brace inside an #ifdef -- oops!

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

12 years agoAdding acessors to COFFObjectFile so that clients can get at the (non-generic) bits
Marshall Clow [Fri, 15 Jun 2012 01:08:25 +0000 (01:08 +0000)]
Adding acessors to COFFObjectFile so that clients can get at the (non-generic) bits

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

12 years agoRecommit r158407: Allow SROA to look at a vector type and see if the offset is out...
Pete Cooper [Thu, 14 Jun 2012 23:53:53 +0000 (23:53 +0000)]
Recommit r158407: Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access.  Now with additional fix and test for indexing into a vector inside a struct

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

12 years agoImplement the isSafeToDiscardIfUnused predicate and use it in globalopt and
Rafael Espindola [Thu, 14 Jun 2012 22:48:13 +0000 (22:48 +0000)]
Implement the isSafeToDiscardIfUnused predicate and use it in globalopt and
globaldce. Globaldce was already removing linkonce globals, but globalopt was
not.

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

12 years agoMove X86::VCVTTSD2SIrr from the 2 operand to 1 operand MemRegOp table.
Pete Cooper [Thu, 14 Jun 2012 22:12:58 +0000 (22:12 +0000)]
Move X86::VCVTTSD2SIrr from the 2 operand to 1 operand MemRegOp table.

Can someone with more knowledge of this please look at other entries
to see if others need moved.

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

12 years agoFix coding style violations. Remove white spaces and tabs.
Akira Hatanaka [Thu, 14 Jun 2012 21:10:56 +0000 (21:10 +0000)]
Fix coding style violations. Remove white spaces and tabs.

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

12 years ago1. introduce MipsPat in place of Pat in order to exclude those from
Akira Hatanaka [Thu, 14 Jun 2012 21:03:23 +0000 (21:03 +0000)]
1. introduce MipsPat in place of Pat in order to exclude those from
being used by Mips16 or Micro Mips
2. clean up a few lines too long encountered

Patch by Reed Kotler.

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

12 years agoMake machine verifier check the first instruction of the last bundle instead of
Akira Hatanaka [Thu, 14 Jun 2012 20:51:13 +0000 (20:51 +0000)]
Make machine verifier check the first instruction of the last bundle instead of
the last instruction of a basic block.

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

12 years agoMake comment slightly more helpful.
Lang Hames [Thu, 14 Jun 2012 20:37:15 +0000 (20:37 +0000)]
Make comment slightly more helpful.

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

12 years agoRevert r158454: Allow SROA to look at a vector type... Its breaking the vectorise...
Pete Cooper [Thu, 14 Jun 2012 18:32:52 +0000 (18:32 +0000)]
Revert r158454: Allow SROA to look at a vector type...  Its breaking the vectorise buildbot

This reverts commit 12c1f86ffa731e2952c80d2cc577000c96b8962c.

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

12 years agomisched: disable SSA check pending PR13112.
Andrew Trick [Thu, 14 Jun 2012 17:48:49 +0000 (17:48 +0000)]
misched: disable SSA check pending PR13112.

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

12 years agoSmallMap, FlatArrayMap::copyFrom
Stepan Dyatkovskiy [Thu, 14 Jun 2012 16:59:43 +0000 (16:59 +0000)]
SmallMap, FlatArrayMap::copyFrom
Replaced memcpy with std::copy, since the first one may work improperly with non POD data.

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

12 years agoRemove/modify C backend references from LLVM documentation.
David Blaikie [Thu, 14 Jun 2012 16:52:55 +0000 (16:52 +0000)]
Remove/modify C backend references from LLVM documentation.

Patch by Wei-Ren Chen.

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

12 years agoRemove C backend reference from the FAQ.
David Blaikie [Thu, 14 Jun 2012 16:43:11 +0000 (16:43 +0000)]
Remove C backend reference from the FAQ.

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

12 years agoRecommit r158407: Allow SROA to look at a vector type and see if the offset is out...
Pete Cooper [Thu, 14 Jun 2012 16:38:13 +0000 (16:38 +0000)]
Recommit r158407: Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access.  Now with additional fix and test for indexing into a vector inside a struct

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

12 years agoClarify a bit that the types have to be the same. Came up on IRC.
Duncan Sands [Thu, 14 Jun 2012 14:58:28 +0000 (14:58 +0000)]
Clarify a bit that the types have to be the same.  Came up on IRC.

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

12 years agoMipsLongBranch.cpp: Tweak llvm::next() to appease msvc.
NAKAMURA Takumi [Thu, 14 Jun 2012 12:29:48 +0000 (12:29 +0000)]
MipsLongBranch.cpp: Tweak llvm::next() to appease msvc.

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

12 years agoReplace assertion failure for badly formatted CPS instrution with error message.
Richard Barton [Thu, 14 Jun 2012 10:48:04 +0000 (10:48 +0000)]
Replace assertion failure for badly formatted CPS instrution with error message.

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

12 years agoCleanup whitespace.
Jush Lu [Thu, 14 Jun 2012 06:08:19 +0000 (06:08 +0000)]
Cleanup whitespace.

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

12 years agoRevert: test/CodeGen/ARM/iabs.ll in r158441
Manman Ren [Thu, 14 Jun 2012 06:04:02 +0000 (06:04 +0000)]
Revert: test/CodeGen/ARM/iabs.ll in r158441

Sorry that I accidently checked in this file with my previous commit.

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

12 years agoInstCombine: fix a bug when combining (fcmp cc0 x, y) && (fcmp cc1 x, y).
Manman Ren [Thu, 14 Jun 2012 05:57:42 +0000 (05:57 +0000)]
InstCombine: fix a bug when combining (fcmp cc0 x, y) && (fcmp cc1 x, y).

uno && ueq was converted to ueq, it should be converted to uno.

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

12 years agoTest case for MIPS long branch pass.
Akira Hatanaka [Thu, 14 Jun 2012 02:12:21 +0000 (02:12 +0000)]
Test case for MIPS long branch pass.

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

12 years agoFix Mips/CMakeLists.txt.
Akira Hatanaka [Thu, 14 Jun 2012 01:23:55 +0000 (01:23 +0000)]
Fix Mips/CMakeLists.txt.

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

12 years agoAdd file MipsLongBranch.cpp.
Akira Hatanaka [Thu, 14 Jun 2012 01:22:24 +0000 (01:22 +0000)]
Add file MipsLongBranch.cpp.

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

12 years agoFix test cases.
Akira Hatanaka [Thu, 14 Jun 2012 01:21:00 +0000 (01:21 +0000)]
Fix test cases.

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

12 years agoRemove code in MipsAsmPrinter and MipsMCInstLower.
Akira Hatanaka [Thu, 14 Jun 2012 01:20:12 +0000 (01:20 +0000)]
Remove code in MipsAsmPrinter and MipsMCInstLower.

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

12 years agoAdd long branch expansion pass for MIPS.
Akira Hatanaka [Thu, 14 Jun 2012 01:19:35 +0000 (01:19 +0000)]
Add long branch expansion pass for MIPS.

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

12 years agoAdd AT to the list of registers clobbered by branches so that it is available
Akira Hatanaka [Thu, 14 Jun 2012 01:17:59 +0000 (01:17 +0000)]
Add AT to the list of registers clobbered by branches so that it is available
as a scratch register when they are expanded to long branches.

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

12 years agoIn MipsRegisterInfo::eliminateFrameIndex, call Mips::loadImmediate
Akira Hatanaka [Thu, 14 Jun 2012 01:17:36 +0000 (01:17 +0000)]
In MipsRegisterInfo::eliminateFrameIndex, call Mips::loadImmediate
to load an immediate that does not fit into 16-bit.

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

12 years agoIn MipsFrameLowering::emitPrologue and emitEpilogue, call Mips::loadImmediate
Akira Hatanaka [Thu, 14 Jun 2012 01:17:13 +0000 (01:17 +0000)]
In MipsFrameLowering::emitPrologue and emitEpilogue, call Mips::loadImmediate
to load an immediate that does not fit into 16-bit. Also, take into
consideration the global base register slot on the stack when computing the
stack size.

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

12 years agoDefine function MipsInstrInfo::GetInstSizeInBytes, which will be called to
Akira Hatanaka [Thu, 14 Jun 2012 01:16:45 +0000 (01:16 +0000)]
Define function MipsInstrInfo::GetInstSizeInBytes, which will be called to
compute the size of basic blocks in a function. Also, define a function which
emits a series of instructions to load an immediate.

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

12 years agoIn MipsISelDAGToDAG.cpp, store the global base register to a stack frame object.
Akira Hatanaka [Thu, 14 Jun 2012 01:16:15 +0000 (01:16 +0000)]
In MipsISelDAGToDAG.cpp, store the global base register to a stack frame object.
Long-branches need access to the global base register to get the destination
address.

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

12 years agoAdd methods to MipsFunctionInfo for initializing and accessing the stack frame
Akira Hatanaka [Thu, 14 Jun 2012 01:15:36 +0000 (01:15 +0000)]
Add methods to MipsFunctionInfo for initializing and accessing the stack frame
object for the global base register.

This is the first of a series of patches which implements long branch expansion
for MIPS.

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

12 years agoBundle jump/branch instructions with the instructions in the delay slot in
Akira Hatanaka [Wed, 13 Jun 2012 23:25:52 +0000 (23:25 +0000)]
Bundle jump/branch instructions with the instructions in the delay slot in
delay slot filler pass of MIPS, per suggestion of Jakob Stoklund Olesen.

This change, along with the fix in r158154, enables machine verification
to be run after delay slot filling.

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

12 years agoGroup the 'unsigned' members after the pointer to avoid 4 bytes of
Chandler Carruth [Wed, 13 Jun 2012 21:44:07 +0000 (21:44 +0000)]
Group the 'unsigned' members after the pointer to avoid 4 bytes of
padding on x86-64.

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

12 years agoImplement a DAGCombine in MipsISelLowering.cpp which transforms the following
Akira Hatanaka [Wed, 13 Jun 2012 20:33:18 +0000 (20:33 +0000)]
Implement a DAGCombine in MipsISelLowering.cpp which transforms the following
pattern:

(add v0, (add v1, abs_lo(tjt))) => (add (add v0, v1), abs_lo(tjt))

"tjt" is a TargetJumpTable node.

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

12 years agoSet a higher value for maxStoresPerMemcpy in MipsISelLowering.cpp.
Akira Hatanaka [Wed, 13 Jun 2012 19:33:32 +0000 (19:33 +0000)]
Set a higher value for maxStoresPerMemcpy in MipsISelLowering.cpp.

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

12 years agoSimplify CreateLoadLR and CreateStoreLR in MipsISelLowering.cpp.
Akira Hatanaka [Wed, 13 Jun 2012 19:06:08 +0000 (19:06 +0000)]
Simplify CreateLoadLR and CreateStoreLR in MipsISelLowering.cpp.

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

12 years agoImplement fastcc calling convention for MIPS.
Akira Hatanaka [Wed, 13 Jun 2012 18:06:00 +0000 (18:06 +0000)]
Implement fastcc calling convention for MIPS.

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

12 years agoFix pattern for MKMSK instruction.
Richard Osborne [Wed, 13 Jun 2012 17:59:12 +0000 (17:59 +0000)]
Fix pattern for MKMSK instruction.

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

12 years agoRevert "Allow SROA to look at a vector type and see if the offset is out of range...
Pete Cooper [Wed, 13 Jun 2012 17:55:22 +0000 (17:55 +0000)]
Revert "Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access"

This reverts commit 51786e0aaec76b973205066bd44f7f427b21969f.

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

12 years agoAllow SROA to look at a vector type and see if the offset is out of range to be repla...
Pete Cooper [Wed, 13 Jun 2012 17:30:34 +0000 (17:30 +0000)]
Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access

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

12 years agoFix building ThreadLocal.cpp with --disable-threads.
Argyrios Kyrtzidis [Wed, 13 Jun 2012 16:30:06 +0000 (16:30 +0000)]
Fix building ThreadLocal.cpp with --disable-threads.

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

12 years ago*typo: Cyles changed to Cycles
Kay Tiong Khoo [Wed, 13 Jun 2012 15:53:04 +0000 (15:53 +0000)]
*typo: Cyles changed to Cycles

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

12 years agoUse LTO_CODEGEN_PIC_MODEL_DYNAMIC for PIE. This requirest a git version of
Rafael Espindola [Wed, 13 Jun 2012 13:30:24 +0000 (13:30 +0000)]
Use LTO_CODEGEN_PIC_MODEL_DYNAMIC for PIE. This requirest a git version of
gold to work. Since the enum value LDPO_PIE has just been added to plugin-api.h,
use a numeric constant for now so that we don't require an unreleased
version of gold to build.

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

12 years agoIt is possible for several constants which aren't individually absorbing to
Duncan Sands [Wed, 13 Jun 2012 12:15:56 +0000 (12:15 +0000)]
It is possible for several constants which aren't individually absorbing to
combine to the absorbing element.  Thanks to nbjoerg on IRC for pointing this
out.

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

12 years agoWhen linearizing a multiplication, return at once if we see a factor of zero,
Duncan Sands [Wed, 13 Jun 2012 09:42:13 +0000 (09:42 +0000)]
When linearizing a multiplication, return at once if we see a factor of zero,
since then the entire expression must equal zero (similarly for other operations
with an absorbing element).  With this in place a bunch of reassociate code for
handling constants is dead since it is all taken care of when linearizing.  No
intended functionality change.

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

12 years agoFix intrinsics for XOP frczss/sd instructions. These instructions only take one sourc...
Craig Topper [Wed, 13 Jun 2012 07:18:53 +0000 (07:18 +0000)]
Fix intrinsics for XOP frczss/sd instructions. These instructions only take one source register and zero the upper bits of the destination rather than preserving them.

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

12 years agoAdd another missing 64-bit itinerary definition for the PPC A2 core.
Hal Finkel [Wed, 13 Jun 2012 05:55:09 +0000 (05:55 +0000)]
Add another missing 64-bit itinerary definition for the PPC A2 core.

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

12 years agoSimplifyCFG: fold unconditional branch to its predecessor if profitable.
Manman Ren [Wed, 13 Jun 2012 05:43:29 +0000 (05:43 +0000)]
SimplifyCFG: fold unconditional branch to its predecessor if profitable.

This patch extends FoldBranchToCommonDest to fold unconditional branches.
For unconditional branches, we fold them if it is easy to update the phi nodes
in the common successors.

rdar://10554090

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

12 years agoEliminate struct TableGenBackend.
Jakob Stoklund Olesen [Wed, 13 Jun 2012 05:15:49 +0000 (05:15 +0000)]
Eliminate struct TableGenBackend.

TableGen backends are simply written as functions now.

Patch by Sean Silva!

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

12 years agoClean up trailing blanks in Mips16InstrFormats.td
Akira Hatanaka [Wed, 13 Jun 2012 02:42:47 +0000 (02:42 +0000)]
Clean up trailing blanks in Mips16InstrFormats.td

Patch by Reed Kotler.

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

12 years agodisable use of directive .set nomicromips
Akira Hatanaka [Wed, 13 Jun 2012 02:41:14 +0000 (02:41 +0000)]
disable use of directive .set nomicromips
until this directive is pushed in gas to open source fsf

Patch by Reed Kotler.

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

12 years agosched: fix latency of memory dependence chain edges for consistency.
Andrew Trick [Wed, 13 Jun 2012 02:39:03 +0000 (02:39 +0000)]
sched: fix latency of memory dependence chain edges for consistency.

For store->load dependencies that may alias, we should always use
TrueMemOrderLatency, which may eventually become a subtarget hook. In
effect, we should guarantee at least TrueMemOrderLatency on at least
one DAG path from a store to a may-alias load.

This should fix the standard mode as well as -enable-aa-sched-mi".

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

12 years agosched: Avoid trivially redundant DAG edges. Take the one with higher latency.
Andrew Trick [Wed, 13 Jun 2012 02:39:00 +0000 (02:39 +0000)]
sched: Avoid trivially redundant DAG edges. Take the one with higher latency.

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

12 years ago1. fix places where immed is used in place of imm to be consistent with
Akira Hatanaka [Wed, 13 Jun 2012 02:37:54 +0000 (02:37 +0000)]
1. fix places where immed is used in place of imm to be consistent with
non mips16
2. fix some comments to change OPcode->EXTEND for extended instructions

Patch by Reed Kotler.

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

12 years agoAdd some missing 64-bit itinerary definitions for the PPC A2 core.
Hal Finkel [Tue, 12 Jun 2012 20:32:29 +0000 (20:32 +0000)]
Add some missing 64-bit itinerary definitions for the PPC A2 core.

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

12 years agoUse DenseMap as SmallMap workaround rather than std::map, at Chandler's request.
Duncan Sands [Tue, 12 Jun 2012 20:26:43 +0000 (20:26 +0000)]
Use DenseMap as SmallMap workaround rather than std::map, at Chandler's request.

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

12 years agoUse std::map rather than SmallMap because SmallMap assumes that the value has
Duncan Sands [Tue, 12 Jun 2012 20:16:51 +0000 (20:16 +0000)]
Use std::map rather than SmallMap because SmallMap assumes that the value has
POD type, causing memory corruption when mapping to APInts with bitwidth > 64.
Merge another crash testcase into crash.ll while there.

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

12 years ago[arm-fast-isel] Add support for -arm-long-calls.
Chad Rosier [Tue, 12 Jun 2012 19:25:13 +0000 (19:25 +0000)]
[arm-fast-isel] Add support for -arm-long-calls.
Patch by Jush Lu <jush.msn@gmail.com>.

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

12 years agoSplit out the PPC instruction class IntSimple from IntGeneral.
Hal Finkel [Tue, 12 Jun 2012 19:01:24 +0000 (19:01 +0000)]
Split out the PPC instruction class IntSimple from IntGeneral.

On the POWER7, adds and logical operations can also be handled
in the load/store pipelines. We'll call these IntSimple.

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

12 years agoRemove use of GNU extension to resolve Clang warning.
David Blaikie [Tue, 12 Jun 2012 17:06:32 +0000 (17:06 +0000)]
Remove use of GNU extension to resolve Clang warning.

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

12 years agoFixes for PPC host detection and features.
Hal Finkel [Tue, 12 Jun 2012 16:39:23 +0000 (16:39 +0000)]
Fixes for PPC host detection and features.

POWER4 is a 64-bit CPU (better matched to the 970).
The g3 is really the 750 (no altivec), the g4+ is the 74xx (not the 750).

Patch by Andreas Tobler.

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

12 years agoUse correct syntax highliter in code blocks. Noticed by Sean Silva.
Dmitri Gribenko [Tue, 12 Jun 2012 15:45:07 +0000 (15:45 +0000)]
Use correct syntax highliter in code blocks.  Noticed by Sean Silva.

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

12 years agoNow that Reassociate's LinearizeExprTree can look through arbitrary expression
Duncan Sands [Tue, 12 Jun 2012 14:33:56 +0000 (14:33 +0000)]
Now that Reassociate's LinearizeExprTree can look through arbitrary expression
topologies, it is quite possible for a leaf node to have huge multiplicity, for
example: x0 = x*x, x1 = x0*x0, x2 = x1*x1, ... rapidly gives a value which is x
raised to a vast power (the multiplicity, or weight, of x).  This patch fixes
the computation of weights by correctly computing them no matter how big they
are, rather than just overflowing and getting a wrong value.  It turns out that
the weight for a value never needs more bits to represent than the value itself,
so it is enough to represent weights as APInts of the same bitwidth and do the
right overflow-avoiding dance steps when computing weights.  As a side-effect it
reduces the number of multiplies needed in some cases of large powers.  While
there, in view of external uses (eg by the vectorizer) I made LinearizeExprTree
static, pushing the rank computation out into users.  This is progress towards
fixing PR13021.

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

12 years agoAdd two newlines in ParseSubtargetFeatures's debug output after the CPU is printed.
Hal Finkel [Tue, 12 Jun 2012 04:21:36 +0000 (04:21 +0000)]
Add two newlines in ParseSubtargetFeatures's debug output after the CPU is printed.

There is otherwise not a newline between the CPU name and the start of the next
pass's output which makes both difficult to read.

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

12 years agoReapply r158337, this time properly protect Darwin/PPC host CPU use with __ppc__.
Hal Finkel [Tue, 12 Jun 2012 03:03:13 +0000 (03:03 +0000)]
Reapply r158337, this time properly protect Darwin/PPC host CPU use with __ppc__.

Original commit message:
Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().

Both the new Linux functionality and the old Darwin functions have been moved.
This change also allows this information to be queried directly by clang and
other frontends (clang, for example, will now have real -mcpu=native support).

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

12 years agoSatisfy C++ aliasing rules, per suggestion by Chandler.
Argyrios Kyrtzidis [Tue, 12 Jun 2012 01:06:16 +0000 (01:06 +0000)]
Satisfy C++ aliasing rules, per suggestion by Chandler.

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

12 years agoRevert r158337 "Move PPC host-CPU detection logic from PPCSubtarget into sys::getHost...
Jakob Stoklund Olesen [Tue, 12 Jun 2012 00:58:40 +0000 (00:58 +0000)]
Revert r158337 "Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName()."

This commit broke most of the PowerPC unit tests when running on
Intel/Apple.

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

12 years agoFileCheck docs: remove leftover HTML markup.
Dmitri Gribenko [Tue, 12 Jun 2012 00:48:47 +0000 (00:48 +0000)]
FileCheck docs: remove leftover HTML markup.

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

12 years agoFor llvm::sys::ThreadLocalImpl instead of malloc'ing the platform-specific
Argyrios Kyrtzidis [Tue, 12 Jun 2012 00:21:31 +0000 (00:21 +0000)]
For llvm::sys::ThreadLocalImpl instead of malloc'ing the platform-specific
thread local data, embed them in the class using a uint64_t and make sure
we get compiler errors if there's a platform where this is not big enough.

This makes ThreadLocal more safe for using it in conjunction with CrashRecoveryContext.

Related to crash in rdar://11434201.

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

12 years agomisched: When querying RegisterPressureTracker, always save current and max pressure.
Andrew Trick [Mon, 11 Jun 2012 23:42:23 +0000 (23:42 +0000)]
misched: When querying RegisterPressureTracker, always save current and max pressure.

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

12 years agomisched: regpressure getMaxPressureDelta, revert accidental checkin.
Andrew Trick [Mon, 11 Jun 2012 23:42:20 +0000 (23:42 +0000)]
misched: regpressure getMaxPressureDelta, revert accidental checkin.

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

12 years agoMove PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().
Hal Finkel [Mon, 11 Jun 2012 23:14:31 +0000 (23:14 +0000)]
Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().

Both the new Linux functionality and the old Darwin functions have been moved.
This change also allows this information to be queried directly by clang and
other frontends (clang, for example, will now have real -mcpu=native support).

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

12 years agoFix test that depends on register allocation.
Jakob Stoklund Olesen [Mon, 11 Jun 2012 21:14:28 +0000 (21:14 +0000)]
Fix test that depends on register allocation.

The test is really checking the prolog/epilog load/store multiple
formation.

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

12 years agoEnable MFOCRF generation on the PPC A2 core.
Hal Finkel [Mon, 11 Jun 2012 19:57:04 +0000 (19:57 +0000)]
Enable MFOCRF generation on the PPC A2 core.

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

12 years agoRename the PPC target feature gpul to mfocrf.
Hal Finkel [Mon, 11 Jun 2012 19:57:01 +0000 (19:57 +0000)]
Rename the PPC target feature gpul to mfocrf.

The PPC target feature gpul (IsGigaProcessor) was only used for one thing:
To enable the generation of the MFOCRF instruction. Furthermore, this
instruction is available on other PPC cores outside of the G5 line. This
feature now corresponds to the HasMFOCRF flag.

No functionality change.

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

12 years agoAdd A2 to the list of PPC CPUs recognized by Linux host CPU-type detection.
Hal Finkel [Mon, 11 Jun 2012 19:56:57 +0000 (19:56 +0000)]
Add A2 to the list of PPC CPUs recognized by Linux host CPU-type detection.

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