oota-llvm.git
13 years agoUpdate test for the extra =.
Rafael Espindola [Mon, 6 Dec 2010 15:05:36 +0000 (15:05 +0000)]
Update test for the extra =.

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

13 years agoAdd an EmitAbsValue helper method and use it in cases where we want to be sure
Rafael Espindola [Mon, 6 Dec 2010 14:53:14 +0000 (14:53 +0000)]
Add an EmitAbsValue helper method and use it in cases where we want to be sure
that no relocations are used (on MochO).
Fixes llc producing different output from llc + llvm-mc.

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

13 years agoFix clang warning: "extra ';' inside a class [-pedantic]".
Frits van Bommel [Mon, 6 Dec 2010 10:48:11 +0000 (10:48 +0000)]
Fix clang warning: "extra ';' inside a class [-pedantic]".

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

13 years agoFix PR8735, a really terrible problem in the inliner's "alloca merging"
Chris Lattner [Mon, 6 Dec 2010 07:52:42 +0000 (07:52 +0000)]
Fix PR8735, a really terrible problem in the inliner's "alloca merging"
optimization.

Consider:
static void foo() {
  A = alloca
  ...
}

static void bar() {
  B = alloca
  ...
  call foo();
}

void main() {
  bar()
}

The inliner proceeds bottom up, but lets pretend it decides not to inline foo
into bar.  When it gets to main, it inlines bar into main(), and says "hey, I
just inlined an alloca "B" into main, lets remember that.  Then it keeps going
and finds that it now contains a call to foo.  It decides to inline foo into
main, and says "hey, foo has an alloca A, and I have an alloca B from another
inlined call site, lets reuse it".  The problem with this of course, is that
the lifetime of A and B are nested, not disjoint.

Unfortunately I can't create a reasonable testcase for this: the one in the
PR is both huge and extremely sensitive, because you minor tweaks end up
causing foo to get inlined into bar too early.  We already have tests for the
basic alloca merging optimization and this does not break them.

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

13 years agoimprove comment
Chris Lattner [Mon, 6 Dec 2010 07:43:04 +0000 (07:43 +0000)]
improve comment

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

13 years agoimprove -debug output and comments a little.
Chris Lattner [Mon, 6 Dec 2010 07:38:40 +0000 (07:38 +0000)]
improve -debug output and comments a little.

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

13 years agoSupport/Windows: Make MinGW happy.
Michael J. Spencer [Mon, 6 Dec 2010 06:02:07 +0000 (06:02 +0000)]
Support/Windows: Make MinGW happy.

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

13 years agoSupport/FileSystem: Add directory_iterator implementation.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:42 +0000 (04:28 +0000)]
Support/FileSystem: Add directory_iterator implementation.

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

13 years agoSupport/PathV2: Fix append to not add a slash to empty or root paths.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:23 +0000 (04:28 +0000)]
Support/PathV2: Fix append to not add a slash to empty or root paths.

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

13 years agoSupport/Windows: Add ScopedHandle and move some clients over to it.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:13 +0000 (04:28 +0000)]
Support/Windows: Add ScopedHandle and move some clients over to it.

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

13 years agoKillTheDoctor: Cleanup error_code usage.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:01 +0000 (04:28 +0000)]
KillTheDoctor: Cleanup error_code usage.

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

13 years agoKillTheDoctor: Fix spelling.
Michael J. Spencer [Mon, 6 Dec 2010 04:27:52 +0000 (04:27 +0000)]
KillTheDoctor: Fix spelling.

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

13 years agoSupport/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
Michael J. Spencer [Mon, 6 Dec 2010 04:27:42 +0000 (04:27 +0000)]
Support/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
implementation needs it for wchar_t and SmallVectorImpl in general.

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

13 years agoptx: add shift instructions
Che-Liang Chiou [Mon, 6 Dec 2010 04:00:03 +0000 (04:00 +0000)]
ptx: add shift instructions

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

13 years agoRemove the getAddress getter, initialize Ordinal in the constructor and use
Rafael Espindola [Mon, 6 Dec 2010 03:48:09 +0000 (03:48 +0000)]
Remove the getAddress getter, initialize Ordinal in the constructor and use
that on the ELF writer to detect a section we created.

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

13 years agoSimplify a bit.
Rafael Espindola [Mon, 6 Dec 2010 03:36:43 +0000 (03:36 +0000)]
Simplify a bit.

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

13 years agoUse getSymbolOffset on the COFF writer.
Rafael Espindola [Mon, 6 Dec 2010 03:24:04 +0000 (03:24 +0000)]
Use getSymbolOffset on the COFF writer.

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

13 years agoDon't use PadSectionToAlignment on windows.
Rafael Espindola [Mon, 6 Dec 2010 03:03:44 +0000 (03:03 +0000)]
Don't use PadSectionToAlignment on windows.

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

13 years agoAdd a getSymbolOffset method and use it in the ELF writer.
Rafael Espindola [Mon, 6 Dec 2010 02:57:26 +0000 (02:57 +0000)]
Add a getSymbolOffset method and use it in the ELF writer.

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

13 years agoFix PR8728, a miscompilation I recently introduced. When optimizing
Chris Lattner [Mon, 6 Dec 2010 01:48:06 +0000 (01:48 +0000)]
Fix PR8728, a miscompilation I recently introduced.  When optimizing
memcpy's like:
  memcpy(A, B)
  memcpy(A, C)

we cannot delete the first memcpy as dead if A and C might be aliases.
If so, we actually get:

  memcpy(A, B)
  memcpy(A, A)

which is not correct to transform into:

  memcpy(A, A)

This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks
Jakub!

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

13 years agoadd a helper method.
Chris Lattner [Mon, 6 Dec 2010 01:01:28 +0000 (01:01 +0000)]
add a helper method.

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

13 years agoEliminate unneeded #include's.
Evan Cheng [Sun, 5 Dec 2010 23:41:43 +0000 (23:41 +0000)]
Eliminate unneeded #include's.

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

13 years agoARM/CMakeLists.txt: Add missing MLxExpansionPass.cpp since r120960.
NAKAMURA Takumi [Sun, 5 Dec 2010 23:08:57 +0000 (23:08 +0000)]
ARM/CMakeLists.txt: Add missing MLxExpansionPass.cpp since r120960.

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

13 years agoCode clean up.
Evan Cheng [Sun, 5 Dec 2010 23:03:45 +0000 (23:03 +0000)]
Code clean up.

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

13 years agoRemove an unused variable.
Evan Cheng [Sun, 5 Dec 2010 23:03:35 +0000 (23:03 +0000)]
Remove an unused variable.

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

13 years agoSome cleanup before I start committing some incremental progress on
Cameron Zwarich [Sun, 5 Dec 2010 22:34:08 +0000 (22:34 +0000)]
Some cleanup before I start committing some incremental progress on
StrongPHIElimination.

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

13 years agoMaking use of VFP / NEON floating point multiply-accumulate / subtraction is
Evan Cheng [Sun, 5 Dec 2010 22:04:16 +0000 (22:04 +0000)]
Making use of VFP / NEON floating point multiply-accumulate / subtraction is
difficult on current ARM implementations for a few reasons.
1. Even though a single vmla has latency that is one cycle shorter than a pair
   of vmul + vadd, a RAW hazard during the first (4? on Cortex-a8) can cause
   additional pipeline stall. So it's frequently better to single codegen
   vmul + vadd.
2. A vmla folowed by a vmul, vmadd, or vsub causes the second fp instruction to
   stall for 4 cycles. We need to schedule them apart.
3. A vmla followed vmla is a special case. Obvious issuing back to back RAW
   vmla + vmla is very bad. But this isn't ideal either:
     vmul
     vadd
     vmla
   Instead, we want to expand the second vmla:
     vmla
     vmul
     vadd
   Even with the 4 cycle vmul stall, the second sequence is still 2 cycles
   faster.

Up to now, isel simply avoid codegen'ing fp vmla / vmls. This works well enough
but it isn't the optimial solution. This patch attempts to make it possible to
use vmla / vmls in cases where it is profitable.

A. Add missing isel predicates which cause vmla to be codegen'ed.
B. Make sure the fmul in (fadd (fmul)) has a single use. We don't want to
   compute a fmul and a fmla.
C. Add additional isel checks for vmla, avoid cases where vmla is feeding into
   fp instructions (except for the #3 exceptional case).
D. Add ARM hazard recognizer to model the vmla / vmls hazards.
E. Add a special pre-regalloc case to expand vmla / vmls when it's likely the
   vmla / vmls will trigger one of the special hazards.

Work in progress, only A+B are enabled.

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

13 years agoRemove the PHIElimination.h header, as it is no longer needed.
Cameron Zwarich [Sun, 5 Dec 2010 21:39:42 +0000 (21:39 +0000)]
Remove the PHIElimination.h header, as it is no longer needed.

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

13 years agoClarify some of the differences between indexing with getelementptr and indexing...
Frits van Bommel [Sun, 5 Dec 2010 20:54:38 +0000 (20:54 +0000)]
Clarify some of the differences between indexing with getelementptr and indexing with insertvalue/extractvalue.

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

13 years agoFix PR 4170 by having ExtractValueInst::getIndexedType() reject out-of-bounds indexing.
Frits van Bommel [Sun, 5 Dec 2010 20:50:26 +0000 (20:50 +0000)]
Fix PR 4170 by having ExtractValueInst::getIndexedType() reject out-of-bounds indexing.

Also add asserts that the indices are valid in InsertValueInst::init(). ExtractValueInst already asserts when constructed with invalid indices.

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

13 years agoI forgot to actually remove the FindCopyInsertPoint() declaration from
Cameron Zwarich [Sun, 5 Dec 2010 19:58:57 +0000 (19:58 +0000)]
I forgot to actually remove the FindCopyInsertPoint() declaration from
PHIElimination.h.

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

13 years agoRemove the SplitCriticalEdge() method declaration from PHIElimination.h. At one
Cameron Zwarich [Sun, 5 Dec 2010 19:54:23 +0000 (19:54 +0000)]
Remove the SplitCriticalEdge() method declaration from PHIElimination.h. At one
time, this method existed, but now PHIElimination uses the method of the same
name on MachineBasicBlock.

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

13 years agoMove the FindCopyInsertPoint method of PHIElimination to a new standalone
Cameron Zwarich [Sun, 5 Dec 2010 19:51:05 +0000 (19:51 +0000)]
Move the FindCopyInsertPoint method of PHIElimination to a new standalone
function so that it can be shared with StrongPHIElimination.

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

13 years agoRefactor jump threading.
Frits van Bommel [Sun, 5 Dec 2010 19:06:41 +0000 (19:06 +0000)]
Refactor jump threading.
Should have no functional change other than the order of two transformations that are mutually-exclusive and the exact formatting of debug output.
Internally, it now stores the ConstantInt*s as Constant*s, and actual undef values instead of nulls.

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

13 years agoRemove trailing whitespace.
Frits van Bommel [Sun, 5 Dec 2010 19:02:47 +0000 (19:02 +0000)]
Remove trailing whitespace.

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

13 years agoTeach SimplifyCFG to turn
Frits van Bommel [Sun, 5 Dec 2010 18:29:03 +0000 (18:29 +0000)]
Teach SimplifyCFG to turn
  (indirectbr (select cond, blockaddress(@fn, BlockA),
                            blockaddress(@fn, BlockB)))
into
  (br cond, BlockA, BlockB).

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

13 years agoTeach X86ISelLowering that the second result of X86ISD::UMUL is a flags
Chris Lattner [Sun, 5 Dec 2010 07:49:54 +0000 (07:49 +0000)]
Teach X86ISelLowering that the second result of X86ISD::UMUL is a flags
result.  This allows us to compile:

void *test12(long count) {
      return new int[count];
}

into:

test12:
movl $4, %ecx
movq %rdi, %rax
mulq %rcx
movq $-1, %rdi
cmovnoq %rax, %rdi
jmp __Znam                  ## TAILCALL

instead of:

test12:
movl $4, %ecx
movq %rdi, %rax
mulq %rcx
seto %cl
testb %cl, %cl
movq $-1, %rdi
cmoveq %rax, %rdi
jmp __Znam

Of course it would be even better if the regalloc inverted the cmov to 'cmovoq',
which would eliminate the need for the 'movq %rdi, %rax'.

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

13 years agoit turns out that when ".with.overflow" intrinsics were added to the X86
Chris Lattner [Sun, 5 Dec 2010 07:30:36 +0000 (07:30 +0000)]
it turns out that when ".with.overflow" intrinsics were added to the X86
backend that they were all implemented except umul.  This one fell back
to the default implementation that did a hi/lo multiply and compared the
top.  Fix this to check the overflow flag that the 'mul' instruction
sets, so we can avoid an explicit test.  Now we compile:

void *func(long count) {
      return new int[count];
}

into:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
seto %cl                     ## encoding: [0x0f,0x90,0xc1]
testb %cl, %cl                ## encoding: [0x84,0xc9]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL

instead of:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
testq %rdx, %rdx              ## encoding: [0x48,0x85,0xd2]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL

Other than the silly seto+test, this is using the o bit directly, so it's going in the right
direction.

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

13 years agofix the rest of the linux miscompares :)
Chris Lattner [Sun, 5 Dec 2010 02:08:07 +0000 (02:08 +0000)]
fix the rest of the linux miscompares :)

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

13 years agogeneralize the previous check to handle -1 on either side of the
Chris Lattner [Sun, 5 Dec 2010 02:00:51 +0000 (02:00 +0000)]
generalize the previous check to handle -1 on either side of the
select, inserting a not to compensate.  Add a missing isZero check
that I lost somehow.

This improves codegen of:

void *func(long count) {
      return new int[count];
}

from:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
testq %rdx, %rdx              ## encoding: [0x48,0x85,0xd2]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL
                                        ## encoding: [0xeb,A]

to:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
cmpq $1, %rdx                ## encoding: [0x48,0x83,0xfa,0x01]
sbbq %rdi, %rdi              ## encoding: [0x48,0x19,0xff]
notq %rdi                    ## encoding: [0x48,0xf7,0xd7]
orq %rax, %rdi              ## encoding: [0x48,0x09,0xc7]
jmp __Znam                  ## TAILCALL
                                        ## encoding: [0xeb,A]

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

13 years agorelax this to handle linux defaulting to -static.
Chris Lattner [Sun, 5 Dec 2010 01:31:13 +0000 (01:31 +0000)]
relax this to handle linux defaulting to -static.

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

13 years agoImprove an integer select optimization in two ways:
Chris Lattner [Sun, 5 Dec 2010 01:23:24 +0000 (01:23 +0000)]
Improve an integer select optimization in two ways:

1. generalize
    (select (x == 0), -1, 0) -> (sign_bit (x - 1))
to:
    (select (x == 0), -1, y) -> (sign_bit (x - 1)) | y

2. Handle the identical pattern that happens with !=:
   (select (x != 0), y, -1) -> (sign_bit (x - 1)) | y

cmov is often high latency and can't fold immediates or
memory operands.  For example for (x == 0) ? -1 : 1, before
we got:

<  testb %sil, %sil
<  movl $-1, %ecx
<  movl $1, %eax
<  cmovel %ecx, %eax

now we get:

>  cmpb $1, %sil
>  sbbl %eax, %eax
>  orl $1, %eax

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

13 years agomerge some tests into select.ll and make them more specific.
Chris Lattner [Sun, 5 Dec 2010 01:13:58 +0000 (01:13 +0000)]
merge some tests into select.ll and make them more specific.

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

13 years agorename test
Chris Lattner [Sun, 5 Dec 2010 01:02:23 +0000 (01:02 +0000)]
rename test

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

13 years agoremove two tests that aren't really testing anything.
Chris Lattner [Sun, 5 Dec 2010 01:02:13 +0000 (01:02 +0000)]
remove two tests that aren't really testing anything.

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

13 years agoInitialize HasPOPCNT.
Bill Wendling [Sat, 4 Dec 2010 23:57:24 +0000 (23:57 +0000)]
Initialize HasPOPCNT.

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

13 years agoOnce the layout is done we don't need to keep updating which fragments are
Rafael Espindola [Sat, 4 Dec 2010 22:47:22 +0000 (22:47 +0000)]
Once the layout is done we don't need to keep updating which fragments are
valid. Addresses will not change.

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

13 years agoRemember the contents of leb and dwarfline fragments when relaxing. This avoids
Rafael Espindola [Sat, 4 Dec 2010 21:58:52 +0000 (21:58 +0000)]
Remember the contents of leb and dwarfline fragments when relaxing. This avoids
having to evaluate the expression again when writing.

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

13 years agoRemove PHIElimination's private copy of SkipPHIsAndLabels.
Cameron Zwarich [Sat, 4 Dec 2010 20:40:15 +0000 (20:40 +0000)]
Remove PHIElimination's private copy of SkipPHIsAndLabels.

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

13 years agoAdd patterns for the x86 popcnt instruction.
Benjamin Kramer [Sat, 4 Dec 2010 20:32:23 +0000 (20:32 +0000)]
Add patterns for the x86 popcnt instruction.

- Also adds a new POPCNT subtarget feature that is currently enabled if the target
  supports SSE4.2 (nehalem) or SSE4A (barcelona).

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

13 years agoSilence 'may be used uninitialized in this function' warnings. Static analysis
Bill Wendling [Sat, 4 Dec 2010 20:20:34 +0000 (20:20 +0000)]
Silence 'may be used uninitialized in this function' warnings. Static analysis
may determine that they cannot be used uninitialized. But that might be a bit
too much for the compiler to determine.

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

13 years agoSupport/PathV2: Remove redundant calls to make_error_code.
Michael J. Spencer [Sat, 4 Dec 2010 18:45:32 +0000 (18:45 +0000)]
Support/PathV2: Remove redundant calls to make_error_code.

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

13 years agoAPInt: microoptimize a few methods.
Benjamin Kramer [Sat, 4 Dec 2010 18:05:36 +0000 (18:05 +0000)]
APInt: microoptimize a few methods.

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

13 years agoSimplify APInt::getAllOnesValue.
Benjamin Kramer [Sat, 4 Dec 2010 16:37:47 +0000 (16:37 +0000)]
Simplify APInt::getAllOnesValue.

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

13 years agoRemove unneeded zero arrays.
Benjamin Kramer [Sat, 4 Dec 2010 15:28:22 +0000 (15:28 +0000)]
Remove unneeded zero arrays.

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

13 years agoApparently APFloat::getZero doesn't like PPCDoubleDoubles.
Benjamin Kramer [Sat, 4 Dec 2010 14:43:08 +0000 (14:43 +0000)]
Apparently APFloat::getZero doesn't like PPCDoubleDoubles.

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

13 years agoDisable C++ exception handling on MSVC.
Francois Pichet [Sat, 4 Dec 2010 14:30:22 +0000 (14:30 +0000)]
Disable C++ exception handling on MSVC.
Total size of bin\Release on disk goes from 82.9 MB to 74.2 MB. (~10% saving)

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

13 years agoSimplify code. No functionality change.
Benjamin Kramer [Sat, 4 Dec 2010 14:22:24 +0000 (14:22 +0000)]
Simplify code. No functionality change.

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

13 years agoDisable RTTI on Windows.
Francois Pichet [Sat, 4 Dec 2010 09:42:30 +0000 (09:42 +0000)]
Disable RTTI on Windows.
Total size of bin\Release on disk goes from 83.6 MB to 81.8MB. (~2% saving)

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

13 years agoThe Thumb tADDrSPi instruction is not valid when the destination is SP.
Bob Wilson [Sat, 4 Dec 2010 04:40:19 +0000 (04:40 +0000)]
The Thumb tADDrSPi instruction is not valid when the destination is SP.
Check for that and try narrowing it to tADDspi instead.  Radar 8724703.

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

13 years agoRemove trailing whitespace.
Bob Wilson [Sat, 4 Dec 2010 04:40:15 +0000 (04:40 +0000)]
Remove trailing whitespace.

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

13 years agoThere are two reasons why we might want to use
Rafael Espindola [Sat, 4 Dec 2010 03:21:47 +0000 (03:21 +0000)]
There are two reasons why we might want to use

foo = a - b
.long foo
instead of just
.long a - b

First, on darwin9 64 bits the assembler produces the wrong result. Second,
if "a" is the end of the section all darwin assemblers (9, 10 and mc) will not
consider a - b to be a constant but will if the dummy foo is created.

Split how we handle these cases. The first one is something MC should take care
of. The second one has to be handled by the caller.

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

13 years agoUnittests/Support/PathV2: Add FileSystem tests.
Michael J. Spencer [Sat, 4 Dec 2010 03:18:42 +0000 (03:18 +0000)]
Unittests/Support/PathV2: Add FileSystem tests.

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

13 years agoSupport/FileSystem: Add status implementation.
Michael J. Spencer [Sat, 4 Dec 2010 00:32:40 +0000 (00:32 +0000)]
Support/FileSystem: Add status implementation.

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

13 years agoSupport/SystemError: Make error_category and error_code auto-bool-conversion-safe.
Michael J. Spencer [Sat, 4 Dec 2010 00:32:24 +0000 (00:32 +0000)]
Support/SystemError: Make error_category and error_code auto-bool-conversion-safe.

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

13 years agoSupport/Windows/FileSystem: Fix MinGW warnings.
Michael J. Spencer [Sat, 4 Dec 2010 00:32:14 +0000 (00:32 +0000)]
Support/Windows/FileSystem: Fix MinGW warnings.

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

13 years agoSupport/FileSystem: Add file_size implementation.
Michael J. Spencer [Sat, 4 Dec 2010 00:31:48 +0000 (00:31 +0000)]
Support/FileSystem: Add file_size implementation.

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

13 years agoNext step: Only pad debug_line when the target is darwin. Add a FIXME to avoid
Rafael Espindola [Sat, 4 Dec 2010 00:31:13 +0000 (00:31 +0000)]
Next step: Only pad debug_line when the target is darwin. Add a FIXME to avoid
doing that if the target is darwin10 or newer.

This fixes
*) Direct object emission was producing objects without the workaround on
   darwin9.
*) Assembly printing was producing objects with the workaround on linux.

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

13 years agoEncode condition code for Thumb1 conditional branch instruction.
Jim Grosbach [Sat, 4 Dec 2010 00:20:40 +0000 (00:20 +0000)]
Encode condition code for Thumb1 conditional branch instruction.

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

13 years agoDo not try luck by using given name to create temporary file. In parallel builds...
Devang Patel [Fri, 3 Dec 2010 23:58:31 +0000 (23:58 +0000)]
Do not try luck by using given name to create temporary file. In parallel builds it may not work.

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

13 years agoCorrectly size-reduce the t2CMPzrr instruction to tCMPzr when possible.
Jim Grosbach [Fri, 3 Dec 2010 23:54:18 +0000 (23:54 +0000)]
Correctly size-reduce the t2CMPzrr instruction to tCMPzr when possible.
tCMPzhir has undefined behavior when both source registers are low registers.
rdar://8728577

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

13 years agoUse correct variable names to match the patterns.
Bill Wendling [Fri, 3 Dec 2010 23:44:24 +0000 (23:44 +0000)]
Use correct variable names to match the patterns.

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

13 years agoAlso inore '()' while creating mdnode name from ObjC symbol name.
Jakob Stoklund Olesen [Fri, 3 Dec 2010 23:40:45 +0000 (23:40 +0000)]
Also inore '()' while creating mdnode name from ObjC symbol name.

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

13 years agoFirst step in fixing MC. Make it clear that we are avoiding a bug in the
Rafael Espindola [Fri, 3 Dec 2010 23:36:59 +0000 (23:36 +0000)]
First step in fixing MC. Make it clear that we are avoiding a bug in the
darwin9 linker, what is needed to avoid it and where to get more information.

Also make the workaround simpler. Just the regular end_sequence we normally
create is more than 4 bytes.

Tested by building cctools and ld64 from darwin9 on a darwin10 system and using
those. I checked that I was able to reproduce the bootstrap failure when
the the workaround was disabled.

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

13 years agoIgnore '+' while creating mdnode name from ObjC symbol name.
Devang Patel [Fri, 3 Dec 2010 23:29:30 +0000 (23:29 +0000)]
Ignore '+' while creating mdnode name from ObjC symbol name.

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

13 years agoMatch pattern operand names to expected encoding field names. This corrects the
Jim Grosbach [Fri, 3 Dec 2010 23:21:25 +0000 (23:21 +0000)]
Match pattern operand names to expected encoding field names. This corrects the
operand encoding ordering of the instruction.

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

13 years agoRemove incorrect BL target encoding (it's similar to, but not the same as the
Jim Grosbach [Fri, 3 Dec 2010 22:33:42 +0000 (22:33 +0000)]
Remove incorrect BL target encoding (it's similar to, but not the same as the
ARM instruction). Add encoding of bits 13 and 11.

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

13 years agoEncode the 32-bit wide Thumb (and Thumb2) instructions with the high order
Jim Grosbach [Fri, 3 Dec 2010 22:31:40 +0000 (22:31 +0000)]
Encode the 32-bit wide Thumb (and Thumb2) instructions with the high order
halfword being emitted to the stream first. rdar://8728174

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

13 years agoRevert this change since it breaks a couple of the AVX tests.
Nate Begeman [Fri, 3 Dec 2010 22:29:15 +0000 (22:29 +0000)]
Revert this change since it breaks a couple of the AVX tests.
I'm unclear if the tests are actually correct or not, but reverting for now.

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

13 years agoRename virtRegMap to avoid confusion with the VirtRegMap that it isn't.
Jakob Stoklund Olesen [Fri, 3 Dec 2010 22:25:09 +0000 (22:25 +0000)]
Rename virtRegMap to avoid confusion with the VirtRegMap that it isn't.

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

13 years agoCoalesce debug locations when possible, causing less DBG_VALUE instructions to
Jakob Stoklund Olesen [Fri, 3 Dec 2010 22:25:07 +0000 (22:25 +0000)]
Coalesce debug locations when possible, causing less DBG_VALUE instructions to
be emitted.

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

13 years agoScalar f32/f64 are also subregs of ymm regs
Nate Begeman [Fri, 3 Dec 2010 21:54:39 +0000 (21:54 +0000)]
Scalar f32/f64 are also subregs of ymm regs

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

13 years agoRemove SSE1-4 disable when AVX is enabled. While this may be useful for development,
Nate Begeman [Fri, 3 Dec 2010 21:54:14 +0000 (21:54 +0000)]
Remove SSE1-4 disable when AVX is enabled.  While this may be useful for development,
it completely breaks scalar fp in xmm regs when AVX is enabled.

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

13 years agoEmit DBG_VALUE instructions from LiveDebugVariables.
Jakob Stoklund Olesen [Fri, 3 Dec 2010 21:47:10 +0000 (21:47 +0000)]
Emit DBG_VALUE instructions from LiveDebugVariables.

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

13 years agoAlso update virtRegMap when renaming virtual registers.
Jakob Stoklund Olesen [Fri, 3 Dec 2010 21:47:08 +0000 (21:47 +0000)]
Also update virtRegMap when renaming virtual registers.

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

13 years agoWhen using the 'push' mnemonic for Thumb2 stmdb, be explicit when it's the
Jim Grosbach [Fri, 3 Dec 2010 20:33:01 +0000 (20:33 +0000)]
When using the 'push' mnemonic for Thumb2 stmdb, be explicit when it's the
32-bit wide version by adding the .w suffix.

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

13 years agoRemove unused variable.
Benjamin Kramer [Fri, 3 Dec 2010 19:55:37 +0000 (19:55 +0000)]
Remove unused variable.

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

13 years agoReduce t2 ldr/str instructions to the correct t1 versions when there's an
Jim Grosbach [Fri, 3 Dec 2010 19:47:11 +0000 (19:47 +0000)]
Reduce t2 ldr/str instructions to the correct t1 versions when there's an
immediate offset.

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

13 years agofix ARM::fixup_arm_branch, cleanup, and share more code between ELF and Darwin
Jason W Kim [Fri, 3 Dec 2010 19:40:23 +0000 (19:40 +0000)]
fix ARM::fixup_arm_branch, cleanup, and share more code between ELF and Darwin

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

13 years agoNo need to declare EncoderMethod property anymore; just assign to it.
Jim Grosbach [Fri, 3 Dec 2010 19:31:00 +0000 (19:31 +0000)]
No need to declare EncoderMethod property anymore; just assign to it.

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

13 years agoDelete the StrongPHIElimination pass, leaving only a shell.
Jakob Stoklund Olesen [Fri, 3 Dec 2010 19:21:53 +0000 (19:21 +0000)]
Delete the StrongPHIElimination pass, leaving only a shell.

The StrongPHIElimination pass did not work, and nobody has worked on it for two
years.

A rewrite is underway, so I am leaving this shell pass instead of deleting it
completely.

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

13 years agoAdd IntervalMap::iterator::set{Start,Stop,Value} methods that allow limited
Jakob Stoklund Olesen [Fri, 3 Dec 2010 19:02:00 +0000 (19:02 +0000)]
Add IntervalMap::iterator::set{Start,Stop,Value} methods that allow limited
editing of the current interval.

These methods may cause coalescing, there are corresponding set*Unchecked
methods for editing without coalescing. The non-coalescing methods are useful
for applying monotonic transforms to all keys or values in a map without
accidentally coalescing transformed and untransformed intervals.

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

13 years agoSupport/FileSystem: Add equivalent implementation.
Michael J. Spencer [Fri, 3 Dec 2010 18:49:13 +0000 (18:49 +0000)]
Support/FileSystem: Add equivalent implementation.

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

13 years agoSupport/FileSystem: Fix MinGW build. It doesn't have _chsize_s.
Michael J. Spencer [Fri, 3 Dec 2010 18:48:56 +0000 (18:48 +0000)]
Support/FileSystem: Fix MinGW build. It doesn't have _chsize_s.

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

13 years agoAdd FIXMEs.
Jim Grosbach [Fri, 3 Dec 2010 18:37:17 +0000 (18:37 +0000)]
Add FIXMEs.

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

13 years agoSize reduction for tPUSH come from t2STMDB_UPD, not t2STMIA_UPD.
Jim Grosbach [Fri, 3 Dec 2010 18:31:03 +0000 (18:31 +0000)]
Size reduction for tPUSH come from t2STMDB_UPD, not t2STMIA_UPD.

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

13 years agoAnd I really hate line endings.
Michael J. Spencer [Fri, 3 Dec 2010 18:04:11 +0000 (18:04 +0000)]
And I really hate line endings.

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

13 years agoSupport/Windows/FileSystem: Fix MinGW build.
Michael J. Spencer [Fri, 3 Dec 2010 18:03:28 +0000 (18:03 +0000)]
Support/Windows/FileSystem: Fix MinGW build.

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

13 years agoSupport/FileSystem: Add resize_file implementation.
Michael J. Spencer [Fri, 3 Dec 2010 17:54:07 +0000 (17:54 +0000)]
Support/FileSystem: Add resize_file implementation.

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

13 years agoSupport/FileSystem: Add rename implementation.
Michael J. Spencer [Fri, 3 Dec 2010 17:53:55 +0000 (17:53 +0000)]
Support/FileSystem: Add rename implementation.

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