oota-llvm.git
13 years agostrengthen up an assertion: you can't create a constant struct
Chris Lattner [Sun, 7 Aug 2011 04:18:48 +0000 (04:18 +0000)]
strengthen up an assertion: you can't create a constant struct
with an opaque struct type, it doesn't make sense.  This should
resolve PR10473.

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

13 years agoFix typo. Thanks, Andy!
Jakob Stoklund Olesen [Sat, 6 Aug 2011 18:20:24 +0000 (18:20 +0000)]
Fix typo. Thanks, Andy!

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

13 years agoMade SCEV's UDiv expressions more canonical. When dividing a
Andrew Trick [Sat, 6 Aug 2011 07:00:37 +0000 (07:00 +0000)]
Made SCEV's UDiv expressions more canonical. When dividing a
recurrence, the initial values low bits can sometimes be ignored.

To take advantage of this, added FoldIVUser to IndVarSimplify to fold
an IV operand into a udiv/lshr if the operator doesn't affect the
result.

-indvars -disable-iv-rewrite now transforms

i = phi i4
i1 = i0 + 1
idx = i1 >> (2 or more)
i4 = i + 4

into

i = phi i4
idx = i0 >> ...
i4 = i + 4

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

13 years agoReject RS_Spill ranges from local splitting as well.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 23:50:33 +0000 (23:50 +0000)]
Reject RS_Spill ranges from local splitting as well.

All new local ranges are marked as RS_New now, so there is no need to
attempt splitting of RS_Spill ranges any more.

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

13 years agoOnly mark remainder intervals as RS_Spill after per-block splitting.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 23:50:31 +0000 (23:50 +0000)]
Only mark remainder intervals as RS_Spill after per-block splitting.

The local ranges created get to stay in the RS_New stage, just like for
local and region splitting.

This gives tryLocalSplit a bit more freedom the first time it sees one
of these new local ranges.

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

13 years agoRemember to update LiveDebugVariables after per-block splitting.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 23:10:40 +0000 (23:10 +0000)]
Remember to update LiveDebugVariables after per-block splitting.

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

13 years agoExtract per-block splitting into its own method.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 23:04:18 +0000 (23:04 +0000)]
Extract per-block splitting into its own method.

No functional change.

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

13 years agoDelete getMultiUseBlocks and splitSingleBlocks.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 22:52:17 +0000 (22:52 +0000)]
Delete getMultiUseBlocks and splitSingleBlocks.

These functions are no longer used, and they are easily replaced with a
loop calling shouldSplitSingleBlock and splitSingleBlock.

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

13 years agoAlso use shouldSplitSingleBlock() in the fallback splitting mode.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 22:43:23 +0000 (22:43 +0000)]
Also use shouldSplitSingleBlock() in the fallback splitting mode.

Drop the use of SplitAnalysis::getMultiUseBlocks, there is no need to go
through a SmallPtrSet any more.

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

13 years agoSplit around single instructions to enable register class inflation.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 22:20:45 +0000 (22:20 +0000)]
Split around single instructions to enable register class inflation.

Normally, we don't create a live range for a single instruction in a
basic block, the spiller does that anyway. However, when splitting a
live range that belongs to a proper register sub-class, inserting these
extra COPY instructions completely remove the constraints from the
remainder interval, and it may be allocated from the larger super-class.

The spiller will mop up these small live ranges if we end up spilling
anyway. It calls them snippets.

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

13 years agoARM load instruction shifted register index operands.
Jim Grosbach [Fri, 5 Aug 2011 22:03:36 +0000 (22:03 +0000)]
ARM load instruction shifted register index operands.

Parsing and encoding for shifted index operands for load instructions.

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

13 years agoARM indexed load assembly parsing and encoding.
Jim Grosbach [Fri, 5 Aug 2011 21:28:30 +0000 (21:28 +0000)]
ARM indexed load assembly parsing and encoding.

More parsing support for indexed loads. Fix pre-indexed with writeback
parsing for register offsets and handle basic post-indexed offsets.

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

13 years agoDetect proper register sub-classes.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 21:28:14 +0000 (21:28 +0000)]
Detect proper register sub-classes.

Some instructions require restricted register classes, but most of the
time that doesn't affect register allocation. For example, some
instructions don't work with the stack pointer, but that is a reserved
register anyway.

Sometimes it matters, GR32_ABCD only has 4 allocatable registers. For
such a proper sub-class, the register allocator should try to enable
register class inflation since that makes more registers available for
allocation.

Make sure only legal super-classes are considered. For example, tGPR is
not a proper sub-class in Thumb mode, but in ARM mode it is.

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

13 years agoARM refactor indexed store instructions.
Jim Grosbach [Fri, 5 Aug 2011 20:35:44 +0000 (20:35 +0000)]
ARM refactor indexed store instructions.

Refactor STR[B] pre and post indexed instructions to use addressing modes for
memory operands, which is necessary for assembly parsing and is more consistent
with the rest of the memory instruction definitions. Make some incremental
progress on refactoring away the mega-operand addrmode2 along the way, which
is nice.

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

13 years agoAdd ARM LDR parsing tests.
Jim Grosbach [Fri, 5 Aug 2011 20:33:39 +0000 (20:33 +0000)]
Add ARM LDR parsing tests.

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

13 years agoFix liveness computations in BranchFolding.
Jakob Stoklund Olesen [Fri, 5 Aug 2011 18:47:07 +0000 (18:47 +0000)]
Fix liveness computations in BranchFolding.

The old code would look at kills and defs in one pass over the
instruction operands, causing problems with this code:

  %R0<def>, %CPSR<def,dead> = tLSLri %R5<kill>, 2, pred:14, pred:%noreg
  %R0<def>, %CPSR<def,dead> = tADDrr %R4<kill>, %R0<kill>, pred:14, %pred:%noreg

The last instruction kills and redefines %R0, so it is still live after
the instruction.

This caused a register scavenger crash when compiling 483.xalancbmk for
armv6. I am not including a test case because it requires too much bad
luck to expose this old bug.

First you need to convince the register allocator to use %R0 twice on
the tADDrr instruction, then you have to convince BranchFolding to do
something that causes it to run the register scavenger on he bad block.

<rdar://problem/9898200>

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

13 years agoARM simplify the postidx_reg operand encoding.
Jim Grosbach [Fri, 5 Aug 2011 16:11:38 +0000 (16:11 +0000)]
ARM simplify the postidx_reg operand encoding.

The immediate portion of the operand is just a boolean (the 'U' bit indicating
add vs. subtract). Treat it as such.

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

13 years agoARM use a dedicated printer for postidx_reg operands.
Jim Grosbach [Fri, 5 Aug 2011 15:48:21 +0000 (15:48 +0000)]
ARM use a dedicated printer for postidx_reg operands.

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

13 years agoAdd missing register constraint for some VLD3/VLD4 pseudo instructions.
Bob Wilson [Fri, 5 Aug 2011 07:24:09 +0000 (07:24 +0000)]
Add missing register constraint for some VLD3/VLD4 pseudo instructions.
<rdar://problem/9878189>

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

13 years agoSilence unused variable warnings in release builds.
Chandler Carruth [Fri, 5 Aug 2011 01:08:21 +0000 (01:08 +0000)]
Silence unused variable warnings in release builds.

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

13 years agoFix http://llvm.org/bugs/show_bug.cgi?id=10583\n - test for 1 and 2 byte fixups to...
Jason W Kim [Fri, 5 Aug 2011 00:53:03 +0000 (00:53 +0000)]
Fix llvm.org/bugs/show_bug.cgi?id=10583\n - test for 1 and 2 byte fixups to be added

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

13 years agoTemporarily revert r135528 which distinguishes between two copies of one
Chandler Carruth [Fri, 5 Aug 2011 00:51:31 +0000 (00:51 +0000)]
Temporarily revert r135528 which distinguishes between two copies of one
inlined variable, based on the discussion in PR10542.

This explodes the runtime of several passes down the pipeline due to
a large number of "copies" remaining live across a large function. This
only shows up with both debug and opt, but when it does it creates
a many-minute compile when self-hosting LLVM+Clang. There are several
other cases that show these types of regressions.

All of this is tracked in PR10542, and progress is being made on fixing
the issue. Once its addressed, the re-instated, but until then this
restores the performance for self-hosting and other opt+debug builds.

Devang, let me know if this causes any trouble, or impedes fixing it in
any way, and thanks for working on this!

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

13 years agoFix broken encodings for the Thumb2 LDRD/STRD instructions.
Owen Anderson [Thu, 4 Aug 2011 23:18:05 +0000 (23:18 +0000)]
Fix broken encodings for the Thumb2 LDRD/STRD instructions.

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

13 years agoARM assembly parsing and encoding for LDR instructions.
Jim Grosbach [Thu, 4 Aug 2011 23:01:30 +0000 (23:01 +0000)]
ARM assembly parsing and encoding for LDR instructions.

Enhance support for LDR instruction assembly parsing for post-indexed
addressing with immediate values. Add tests.

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

13 years agoCount the total amount of stack space used in compiled functions.
Jakob Stoklund Olesen [Thu, 4 Aug 2011 21:06:09 +0000 (21:06 +0000)]
Count the total amount of stack space used in compiled functions.

Patch by Ivan Krasin!

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

13 years agoPrint DBG_VALUE variable's location info as a comment.
Devang Patel [Thu, 4 Aug 2011 20:44:26 +0000 (20:44 +0000)]
Print DBG_VALUE variable's location info as a comment.

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

13 years agoIncrement counter inside insertDebugValue().
Devang Patel [Thu, 4 Aug 2011 20:42:11 +0000 (20:42 +0000)]
Increment counter inside insertDebugValue().

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

13 years agoWe need to map DebugLoc. It leads to Fuction * (through subprogram entry node) which...
Devang Patel [Thu, 4 Aug 2011 20:02:18 +0000 (20:02 +0000)]
We need to map DebugLoc. It leads to Fuction * (through subprogram entry node) which should be appropriately mapped.

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

13 years agoLinke NamedMDNodes after linking global values as comment suggests.
Devang Patel [Thu, 4 Aug 2011 19:44:28 +0000 (19:44 +0000)]
Linke NamedMDNodes after linking global values as comment suggests.

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

13 years agoallow \r's in .s files.
Chris Lattner [Thu, 4 Aug 2011 19:31:26 +0000 (19:31 +0000)]
allow \r's in .s files.

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

13 years agoIntroduce adjustFixupOffset that adjusts the fixup offset of a relocation.
Roman Divacky [Thu, 4 Aug 2011 19:08:19 +0000 (19:08 +0000)]
Introduce adjustFixupOffset that adjusts the fixup offset of a relocation.
This is meant to be overriden by backends. Implement an override on PowerPC
which adjusts the offset by 2 for ha16/lo16 relocation kinds. This removes
a commented out hack and enables hello world to be compiled on PowerPC.

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

13 years agoAdd counter.
Devang Patel [Thu, 4 Aug 2011 18:45:38 +0000 (18:45 +0000)]
Add counter.

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

13 years agoFix an obvious type. Patch by Ivan Krasin.
Evan Cheng [Thu, 4 Aug 2011 18:40:26 +0000 (18:40 +0000)]
Fix an obvious type. Patch by Ivan Krasin.

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

13 years agoFix an obvious type. Patch by Ivan Krasin.
Evan Cheng [Thu, 4 Aug 2011 18:38:15 +0000 (18:38 +0000)]
Fix an obvious type. Patch by Ivan Krasin.

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

13 years agoLDCL_POST and STCL_POST need one's-complement offsets, rather than two's complement...
Owen Anderson [Thu, 4 Aug 2011 18:24:14 +0000 (18:24 +0000)]
LDCL_POST and STCL_POST need one's-complement offsets, rather than two's complement offsets.  Add an appropriate immediate type for them.

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

13 years agoFix the bitwidth of the remaining fields.
Rafael Espindola [Thu, 4 Aug 2011 17:00:11 +0000 (17:00 +0000)]
Fix the bitwidth of the remaining fields.

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

13 years agoFix a place that was clearly forgotten when the type legalization
Duncan Sands [Thu, 4 Aug 2011 16:01:54 +0000 (16:01 +0000)]
Fix a place that was clearly forgotten when the type legalization
logic moved over to its own enum.  Noticed by Andrey Karpov with
the PVS-studio tool.

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

13 years agoprint st_shndx with the correct number of bits.
Rafael Espindola [Thu, 4 Aug 2011 15:50:13 +0000 (15:50 +0000)]
print st_shndx with the correct number of bits.

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

13 years agoAdd obviously missing "break". Noticed by Andrey Karpov with
Duncan Sands [Thu, 4 Aug 2011 15:45:59 +0000 (15:45 +0000)]
Add obviously missing "break".  Noticed by Andrey Karpov with
the PVS-studio tool.

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

13 years agoprint st_other with the correct number of bits.
Rafael Espindola [Thu, 4 Aug 2011 15:38:19 +0000 (15:38 +0000)]
print st_other with the correct number of bits.

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

13 years agoprint st_type with the correct number of bits.
Rafael Espindola [Thu, 4 Aug 2011 15:24:00 +0000 (15:24 +0000)]
print st_type with the correct number of bits.

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

13 years agoPrint st_bind with the correct number of bits.
Rafael Espindola [Thu, 4 Aug 2011 15:10:35 +0000 (15:10 +0000)]
Print st_bind with the correct number of bits.

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

13 years agoPrint r_sym with the correct number of bits.
Rafael Espindola [Thu, 4 Aug 2011 14:48:27 +0000 (14:48 +0000)]
Print r_sym with the correct number of bits.

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

13 years agoPrint r_type with the correct number of bits.
Rafael Espindola [Thu, 4 Aug 2011 14:39:30 +0000 (14:39 +0000)]
Print r_type with the correct number of bits.

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

13 years agoAnother counter goes decimal.
Rafael Espindola [Thu, 4 Aug 2011 14:27:46 +0000 (14:27 +0000)]
Another counter goes decimal.

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

13 years agoChange anther counter to decimal.
Rafael Espindola [Thu, 4 Aug 2011 14:01:03 +0000 (14:01 +0000)]
Change anther counter to decimal.

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

13 years agoDon't print a counter in hex.
Rafael Espindola [Thu, 4 Aug 2011 13:39:15 +0000 (13:39 +0000)]
Don't print a counter in hex.

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

13 years agoAdd an assert to check that the Addend fits the file format.
Rafael Espindola [Thu, 4 Aug 2011 13:05:26 +0000 (13:05 +0000)]
Add an assert to check that the Addend fits the file format.

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

13 years agoPrint all the bits in the addend.
Rafael Espindola [Thu, 4 Aug 2011 13:00:24 +0000 (13:00 +0000)]
Print all the bits in the addend.

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

13 years agoReword.
Jay Foad [Thu, 4 Aug 2011 10:43:43 +0000 (10:43 +0000)]
Reword.

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

13 years agoFix what seems an obvious typo. Patch by Ivan Krasin. Problem
Duncan Sands [Thu, 4 Aug 2011 10:02:21 +0000 (10:02 +0000)]
Fix what seems an obvious typo.  Patch by Ivan Krasin.  Problem
reported at http://habrahabr.ru/blogs/compilers/125626/.

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

13 years agoReverting r136884 updateUnloop, which crashed a linux builder.
Andrew Trick [Thu, 4 Aug 2011 01:04:37 +0000 (01:04 +0000)]
Reverting r136884 updateUnloop, which crashed a linux builder.

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

13 years agoFix http://llvm.org/bugs/show_bug.cgi?id=10568
Jason W Kim [Thu, 4 Aug 2011 00:38:45 +0000 (00:38 +0000)]
Fix http://llvm.org/bugs/show_bug.cgi?id=10568
Move the reloc size assert into AsmBackend - where it is more apropos.

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

13 years agoOnly access both operands of an INSERT_SUBVECTOR if it is an INSERT_SUBVECTOR.
Bill Wendling [Thu, 4 Aug 2011 00:32:58 +0000 (00:32 +0000)]
Only access both operands of an INSERT_SUBVECTOR if it is an INSERT_SUBVECTOR.
Fixes PR10527.

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

13 years agoARM refactoring assembly parsing of memory address operands.
Jim Grosbach [Wed, 3 Aug 2011 23:50:40 +0000 (23:50 +0000)]
ARM refactoring assembly parsing of memory address operands.

Memory operand parsing is a bit haphazzard at the moment, in no small part
due to the even more haphazzard representations of memory operands in the .td
files. Start cleaning that all up, at least a bit.

The addressing modes in the .td files will be being simplified to not be
so monolithic, especially with regards to immediate vs. register offsets
and post-indexed addressing. addrmode3 is on its way with this patch, for
example.

This patch is foundational to enable going back to smaller incremental patches
for the individual memory referencing instructions themselves. It does just
enough to get the basics in place and handle the "make check" regression tests
we already have.

Follow-up work will be fleshing out the details and adding more robust test
cases for the individual instructions, starting with ARM mode and moving from
there into Thumb and Thumb2.

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

13 years agoAn algorithm for incrementally updating LoopInfo within a
Andrew Trick [Wed, 3 Aug 2011 23:50:25 +0000 (23:50 +0000)]
An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.

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

13 years agowhitespace
Andrew Trick [Wed, 3 Aug 2011 23:45:50 +0000 (23:45 +0000)]
whitespace

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

13 years agoCorrectly handle multiple DBG_VALUE instructions at the same SlotIndex.
Jakob Stoklund Olesen [Wed, 3 Aug 2011 23:44:31 +0000 (23:44 +0000)]
Correctly handle multiple DBG_VALUE instructions at the same SlotIndex.

It is possible to have multiple DBG_VALUEs for the same variable:

32L TEST32rr %vreg0<kill>, %vreg0, %EFLAGS<imp-def>; GR32:%vreg0
    DBG_VALUE 2, 0, !"i"
    DBG_VALUE %noreg, %0, !"i"

When that happens, keep the last one instead of the first.

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

13 years agowhitespace
Andrew Trick [Wed, 3 Aug 2011 23:43:49 +0000 (23:43 +0000)]
whitespace

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

13 years agoAn interface for iterating over a loop's blocks in DFS order.
Andrew Trick [Wed, 3 Aug 2011 23:27:28 +0000 (23:27 +0000)]
An interface for iterating over a loop's blocks in DFS order.

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

13 years agoFix broken encoding of tCBNZ.
Owen Anderson [Wed, 3 Aug 2011 23:21:48 +0000 (23:21 +0000)]
Fix broken encoding of tCBNZ.

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

13 years agoEnable compact region splitting by default.
Jakob Stoklund Olesen [Wed, 3 Aug 2011 23:16:09 +0000 (23:16 +0000)]
Enable compact region splitting by default.

This helps generate better code in functions with high register
pressure.

The previous version of compact region splitting caused regressions
because the regions were a bit too large. A stronger negative bias
applied in r136832 fixed this problem.

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

13 years agoDo not drop undef debug values. These are used as range termination marker by live...
Devang Patel [Wed, 3 Aug 2011 23:13:55 +0000 (23:13 +0000)]
Do not drop undef debug values. These are used as range termination marker by live debug variable pass.

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

13 years agoRemove underscore that's breaking linux buildbots.
Benjamin Kramer [Wed, 3 Aug 2011 23:13:01 +0000 (23:13 +0000)]
Remove underscore that's breaking linux buildbots.

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

13 years agoBe more conservative when forming compact regions.
Jakob Stoklund Olesen [Wed, 3 Aug 2011 23:09:38 +0000 (23:09 +0000)]
Be more conservative when forming compact regions.

Apply twice the negative bias on transparent blocks when computing the
compact regions. This excludes loop backedges from the region when only
one of the loop blocks uses the register.

Previously, we would include the backedge in the region if the loop
preheader and the loop latch both used the register, but the loop header
didn't.

When both the header and latch blocks use the register, we still keep it
live on the backedge.

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

13 years agoFix some warnings from Clang in release builds:
Chandler Carruth [Wed, 3 Aug 2011 23:07:27 +0000 (23:07 +0000)]
Fix some warnings from Clang in release builds:

lib/CodeGen/RegAllocGreedy.cpp:1176:18: warning: unused variable 'B' [-Wunused-variable]
    if (unsigned B = Cand.getBundles(BundleCand, BestCand)) {
                 ^
lib/CodeGen/RegAllocGreedy.cpp:1188:18: warning: unused variable 'B' [-Wunused-variable]
    if (unsigned B = Cand.getBundles(BundleCand, 0)) {
                 ^

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

13 years agoFix typo in #include which revealed in the case-sensitive filesystem.
Jakub Staszak [Wed, 3 Aug 2011 22:53:41 +0000 (22:53 +0000)]
Fix typo in #include which revealed in the case-sensitive filesystem.

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

13 years agoUse MachineBranchProbabilityInfo in If-Conversion instead of its own heuristics.
Jakub Staszak [Wed, 3 Aug 2011 22:34:43 +0000 (22:34 +0000)]
Use MachineBranchProbabilityInfo in If-Conversion instead of its own heuristics.

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

13 years agoRemove the LowerSetJmp pass. It wasn't used effectively by any of the targets.
Bill Wendling [Wed, 3 Aug 2011 22:18:20 +0000 (22:18 +0000)]
Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets.
This is some of my original LLVM code. *wipes tear*

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

13 years agoAdd accessors for manipulating an MCInst's operands.
Owen Anderson [Wed, 3 Aug 2011 21:52:15 +0000 (21:52 +0000)]
Add accessors for manipulating an MCInst's operands.

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

13 years agoAdd more constantness in BlockFrequencyInfo.
Jakub Staszak [Wed, 3 Aug 2011 21:30:57 +0000 (21:30 +0000)]
Add more constantness in BlockFrequencyInfo.

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

13 years agoKill the export list as well.
Evan Cheng [Wed, 3 Aug 2011 21:07:01 +0000 (21:07 +0000)]
Kill the export list as well.

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

13 years agoNew approach to r136737: insert the necessary fences for atomic ops in platform-indep...
Eli Friedman [Wed, 3 Aug 2011 21:06:02 +0000 (21:06 +0000)]
New approach to r136737: insert the necessary fences for atomic ops in platform-independent code, since a bunch of platforms (ARM, Mips, PPC, Alpha are the relevant targets here) need to do essentially the same thing.

I think this completes the basic CodeGen for atomicrmw and cmpxchg.

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

13 years agoRemove CreateUnwind from the IRBuillder.
Bill Wendling [Wed, 3 Aug 2011 20:53:38 +0000 (20:53 +0000)]
Remove CreateUnwind from the IRBuillder.

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

13 years agoRemove unused variables.
Benjamin Kramer [Wed, 3 Aug 2011 19:53:48 +0000 (19:53 +0000)]
Remove unused variables.

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

13 years agoSome revisions to Devang's change r136759 for merged global debug info.
Bob Wilson [Wed, 3 Aug 2011 19:42:51 +0000 (19:42 +0000)]
Some revisions to Devang's change r136759 for merged global debug info.

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

13 years agoGo back to the old definition. It's not clear that a 'resume' can be 'outlined' from...
Bill Wendling [Wed, 3 Aug 2011 18:37:32 +0000 (18:37 +0000)]
Go back to the old definition. It's not clear that a 'resume' can be 'outlined' from the function with the landing pad for all platforms.

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

13 years agoSCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget
Andrew Trick [Wed, 3 Aug 2011 18:32:11 +0000 (18:32 +0000)]
SCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget
to notify SCEV of a change. Add forgetLoop in a couple of those places.

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

13 years agowhitespace
Andrew Trick [Wed, 3 Aug 2011 18:28:21 +0000 (18:28 +0000)]
whitespace

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

13 years agoExplain how clauses are applied.
Bill Wendling [Wed, 3 Aug 2011 17:17:06 +0000 (17:17 +0000)]
Explain how clauses are applied.

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

13 years agoHandle IMPLICIT_DEF instructions in X86FloatingPoint.
Jakob Stoklund Olesen [Wed, 3 Aug 2011 16:33:19 +0000 (16:33 +0000)]
Handle IMPLICIT_DEF instructions in X86FloatingPoint.

This fixes PR10575.

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

13 years agoUse cast<> instead of a C-style cast to get some free assertions.
Jay Foad [Wed, 3 Aug 2011 10:05:04 +0000 (10:05 +0000)]
Use cast<> instead of a C-style cast to get some free assertions.

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

13 years agofix PR10286, a problem with the .ll printer handling block addresses that are out...
Chris Lattner [Wed, 3 Aug 2011 06:15:41 +0000 (06:15 +0000)]
fix PR10286, a problem with the .ll printer handling block addresses that are out-of-scope.

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

13 years agoUse byte offset, instead of element number, to access merged global.
Devang Patel [Wed, 3 Aug 2011 01:25:46 +0000 (01:25 +0000)]
Use byte offset, instead of element number, to access merged global.

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

13 years agoSmall cleanups:
Nick Lewycky [Wed, 3 Aug 2011 01:11:40 +0000 (01:11 +0000)]
Small cleanups:
  - use SmallVectorImpl& for the function argument.
  - ignore the operands on the GEP, even if they aren't constant! Much as we
    pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by
    is not null. It's magic!

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

13 years agoAdd this back in for now. There are still a few passes which create unwind instructio...
Bill Wendling [Wed, 3 Aug 2011 01:07:57 +0000 (01:07 +0000)]
Add this back in for now. There are still a few passes which create unwind instructions at the moment.

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

13 years agoFix logical error when detecting lifetime intrinsics.
Nick Lewycky [Wed, 3 Aug 2011 00:43:35 +0000 (00:43 +0000)]
Fix logical error when detecting lifetime intrinsics.

Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)"
which in turn means "unreachable". What we wanted was a no-op. Instead, analyze
the whole tree and look for all the instructions we need to delete first, then
delete them second, not relying on the use_list to stay consistent.

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

13 years agoReplace the 'UnwindInst' check with a check for 'ResumeInst', which also exits
Bill Wendling [Wed, 3 Aug 2011 00:30:19 +0000 (00:30 +0000)]
Replace the 'UnwindInst' check with a check for 'ResumeInst', which also exits
the function, because the UnwindInst is going away.

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

13 years agoUse the precomputed def presence in RAGreedy::calcSpillCost.
Jakob Stoklund Olesen [Tue, 2 Aug 2011 23:04:08 +0000 (23:04 +0000)]
Use the precomputed def presence in RAGreedy::calcSpillCost.

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

13 years agoInform SpillPlacement about blocks with defs.
Jakob Stoklund Olesen [Tue, 2 Aug 2011 23:04:06 +0000 (23:04 +0000)]
Inform SpillPlacement about blocks with defs.

This information is not used for anything yet.

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

13 years agoRename {First,Last}Use to {First,Last}Instr.
Jakob Stoklund Olesen [Tue, 2 Aug 2011 22:54:14 +0000 (22:54 +0000)]
Rename {First,Last}Use to {First,Last}Instr.

With a 'FirstDef' field right there, it is very confusing that FirstUse
refers to an instruction that may be a def.

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

13 years agolldb doesn't need the edis dylib any more.
Evan Cheng [Tue, 2 Aug 2011 22:53:48 +0000 (22:53 +0000)]
lldb doesn't need the edis dylib any more.

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

13 years agoARM backend support for atomicrmw and cmpxchg with non-monotonic ordering. Not espec...
Eli Friedman [Tue, 2 Aug 2011 22:44:16 +0000 (22:44 +0000)]
ARM backend support for atomicrmw and cmpxchg with non-monotonic ordering.  Not especially pretty, but seems to work well enough.  If this looks okay, I'll put together similar patches for Mips, PPC, and Alpha.

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

13 years agoAdd a BlockInfo::FirstDef field.
Jakob Stoklund Olesen [Tue, 2 Aug 2011 22:37:22 +0000 (22:37 +0000)]
Add a BlockInfo::FirstDef field.

This is either an invalid SlotIndex, or valno->def for the first value
defined inside the block. PHI values are not counted as defined inside
the block.

The FirstDef field will be used when estimating the cost of spilling
around a block.

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

13 years agoDelete BlockInfo::LiveThrough. It wasn't used any more.
Jakob Stoklund Olesen [Tue, 2 Aug 2011 22:37:20 +0000 (22:37 +0000)]
Delete BlockInfo::LiveThrough. It wasn't used any more.

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

13 years agoTeach InstCombine that lifetime intrincs aren't a real user on the result of a
Nick Lewycky [Tue, 2 Aug 2011 22:08:01 +0000 (22:08 +0000)]
Teach InstCombine that lifetime intrincs aren't a real user on the result of a
malloc call.

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

13 years agoExtend the SpillPlacement interface with two new features.
Jakob Stoklund Olesen [Tue, 2 Aug 2011 21:53:03 +0000 (21:53 +0000)]
Extend the SpillPlacement interface with two new features.

The PrefBoth constraint is used for blocks that ideally want a live-in
value both on the stack and in a register. This would be used by a block
that has a use before interference forces a spill.

Secondly, add the ChangesValue flag to BlockConstraint. This tells
SpillPlacement if a live-in value on the stack can be reused as a
live-out stack value for free. If the block redefines the virtual
register, a spill would be required for that.

This extra information will be used by SpillPlacement to more accurately
calculate spill costs when a value can exist both on the stack and in a
register.

The simplest example is a basic block that reads the virtual register,
but doesn't change its value. Spilling around such a block requires a
reload, but no spill in the block.

The spiller already knows this, but the spill placer doesn't. That can
sometimes lead to suboptimal regions.

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

13 years agoAdd the documentation for the 'landingpad' instruction. Improve the 'invoke'
Bill Wendling [Tue, 2 Aug 2011 21:52:38 +0000 (21:52 +0000)]
Add the documentation for the 'landingpad' instruction. Improve the 'invoke'
instruction's documentation to reference the landingpad and resume instructions.

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

13 years agoMove methods in PassManagerBuilder offline.
Rafael Espindola [Tue, 2 Aug 2011 21:50:27 +0000 (21:50 +0000)]
Move methods in PassManagerBuilder offline.

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

13 years agomove PassManagerBuilder.h to IPO. This is a non intuitive place to put it,
Rafael Espindola [Tue, 2 Aug 2011 21:50:24 +0000 (21:50 +0000)]
move PassManagerBuilder.h to IPO. This is a non intuitive place to put it,
but it solves a layering violation since things in Support are not supposed to
use things in Transforms.

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