9 years agoAllow modifying an ImmutableMap without canonicalizing it immediately.
Jordan Rose [Thu, 6 Dec 2012 19:01:24 +0000 (19:01 +0000)]
Allow modifying an ImmutableMap without canonicalizing it immediately.

This is an alternative to the ImmutableMapRef interface where a factory
should still be canonicalizing by default, but in certain cases an
improvement can be made by delaying the canonicalization.

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

9 years agoSimplify code.
Jakub Staszak [Thu, 6 Dec 2012 18:22:59 +0000 (18:22 +0000)]
Simplify code.

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

9 years agoFix a bug in the code that merges consecutive stores. Previously we did not
Nadav Rotem [Thu, 6 Dec 2012 17:34:13 +0000 (17:34 +0000)]
Fix a bug in the code that merges consecutive stores. Previously we did not
check if loads that happen in between stores alias with the first store in the
chain, only with the second store onwards.

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

9 years agoMemorySanitizer.cpp: Suppress a warning. [-Wunused-variable]
NAKAMURA Takumi [Thu, 6 Dec 2012 13:38:00 +0000 (13:38 +0000)]
MemorySanitizer.cpp: Suppress a warning. [-Wunused-variable]

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

9 years ago[msan] Fix a typo in a comment.
Evgeniy Stepanov [Thu, 6 Dec 2012 11:58:59 +0000 (11:58 +0000)]
[msan] Fix a typo in a comment.

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

9 years ago[msan] Do not store origin for clean values.
Evgeniy Stepanov [Thu, 6 Dec 2012 11:41:03 +0000 (11:41 +0000)]
[msan] Do not store origin for clean values.

Instead of unconditionally storing origin with every application store,
only do this when the shadow of the stored value is != 0.

This change also delays instrumentation of stores until after the walk over
function's instructions, because adding new basic blocks confuses InstVisitor.

We only keep 1 origin value per 4 bytes of application memory. This change
fixes the bug when a store of a single clean byte wiped the origin for the
whole 4-byte area.

Since stores of uninitialized values are relatively uncommon, this change
improves performance of track-origins mode by 5% median and by up to 47% on

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

9 years agos/getLowerBoundDefault/getDefaultLowerBound/ for consistency. Also put the more natur...
Bill Wendling [Thu, 6 Dec 2012 07:55:19 +0000 (07:55 +0000)]
s/getLowerBoundDefault/getDefaultLowerBound/ for consistency. Also put the more natural check first in the if-then statement.

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

9 years agoHandle non-default array bounds.
Bill Wendling [Thu, 6 Dec 2012 07:38:10 +0000 (07:38 +0000)]
Handle non-default array bounds.

Some languages, e.g. Ada and Pascal, allow you to specify that the array bounds
are different from the default (1 in these cases). If we have a lower bound
that's non-default, then we emit the lower bound. We also calculate the correct
upper bound in those cases.

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

9 years agoRemove intrinsic specific instructions for (V)MOVQUmr with patterns pointing to the...
Craig Topper [Thu, 6 Dec 2012 07:31:16 +0000 (07:31 +0000)]
Remove intrinsic specific instructions for (V)MOVQUmr with patterns pointing to the normal instructions.

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

9 years agoMark MOVDQ(A/U)rm as ReMaterializable. Mark all MOVDQ(A/U) instructions as neverHasSi...
Craig Topper [Thu, 6 Dec 2012 06:49:16 +0000 (06:49 +0000)]
Mark MOVDQ(A/U)rm as ReMaterializable. Mark all MOVDQ(A/U) instructions as neverHasSideEffects.

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

9 years agoProperly fix the tes.
Evan Cheng [Thu, 6 Dec 2012 02:29:29 +0000 (02:29 +0000)]
Properly fix the tes.

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

9 years agollvm/test/CodeGen/ARM/extload-knownzero.ll: Try to unbreak, to add -O0. I guess Chad...
NAKAMURA Takumi [Thu, 6 Dec 2012 02:22:58 +0000 (02:22 +0000)]
llvm/test/CodeGen/ARM/extload-knownzero.ll: Try to unbreak, to add -O0. I guess Chad expects fastisel here.

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

9 years agoRevert r169456, "change MCContext to work on the doInitialization/doFinalization...
NAKAMURA Takumi [Thu, 6 Dec 2012 02:00:13 +0000 (02:00 +0000)]
Revert r169456, "change MCContext to work on the doInitialization/doFinalization model"

It broke many builders.

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

9 years ago[arm fast-isel] Make the fast-isel implementation of memcpy respect alignment.
Chad Rosier [Thu, 6 Dec 2012 01:34:31 +0000 (01:34 +0000)]
[arm fast-isel] Make the fast-isel implementation of memcpy respect alignment.

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

9 years agoLet targets provide hooks that compute known zero and ones for any_extend
Evan Cheng [Thu, 6 Dec 2012 01:28:01 +0000 (01:28 +0000)]
Let targets provide hooks that compute known zero and ones for any_extend
and extload's. If they are implemented as zero-extend, or implicitly
zero-extend, then this can enable more demanded bits optimizations. e.g.

define void @foo(i16* %ptr, i32 %a) nounwind {
  %tmp1 = icmp ult i32 %a, 100
  br i1 %tmp1, label %bb1, label %bb2
  %tmp2 = load i16* %ptr, align 2
  br label %bb2
  %tmp3 = phi i16 [ 0, %entry ], [ %tmp2, %bb1 ]
  %cmp = icmp ult i16 %tmp3, 24
  br i1 %cmp, label %bb3, label %exit
  call void @bar() nounwind
  br label %exit
  ret void

This compiles to the followings before:
        push    {lr}
        mov     r2, #0
        cmp     r1, #99
        bhi     LBB0_2
@ BB#1:                                 @ %bb1
        ldrh    r2, [r0]
LBB0_2:                                 @ %bb2
        uxth    r0, r2
        cmp     r0, #23
        bhi     LBB0_4
@ BB#3:                                 @ %bb3
        bl      _bar
LBB0_4:                                 @ %exit
        pop     {lr}
        bx      lr

The uxth is not needed since ldrh implicitly zero-extend the high bits. With
this change it's eliminated.


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

9 years agochange MCContext to work on the doInitialization/doFinalization model
Pedro Artigas [Thu, 6 Dec 2012 00:50:55 +0000 (00:50 +0000)]
change MCContext to work on the doInitialization/doFinalization model

reviewed by Evan Cheng <evan.cheng@apple.com>

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

9 years agoSet the 'MadeChange' variable if we are deleting blocks.
Bill Wendling [Thu, 6 Dec 2012 00:30:20 +0000 (00:30 +0000)]
Set the 'MadeChange' variable if we are deleting blocks.

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

9 years agoHave CannotBeNegativeZero() be aware of the nsz fast-math flag
Michael Ilseman [Thu, 6 Dec 2012 00:07:09 +0000 (00:07 +0000)]
Have CannotBeNegativeZero() be aware of the nsz fast-math flag

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

9 years agoTaking ownership of indvars/lsr.
Andrew Trick [Wed, 5 Dec 2012 23:32:44 +0000 (23:32 +0000)]
Taking ownership of indvars/lsr.

Evan nominated me for this a while back, and no one has offered to
save me from it.

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

9 years agoPR10867: Analogue of r169441 for when using external 'sh'. And actually run the test!
Richard Smith [Wed, 5 Dec 2012 23:15:33 +0000 (23:15 +0000)]
PR10867: Analogue of r169441 for when using external 'sh'. And actually run the test!

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

9 years agoRegPressureTracker::dump(): Remove unnecessary argument.
Andrew Trick [Wed, 5 Dec 2012 23:05:22 +0000 (23:05 +0000)]
RegPressureTracker::dump(): Remove unnecessary argument.

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

9 years agoPR10867. lit would interpret
Richard Smith [Wed, 5 Dec 2012 22:54:26 +0000 (22:54 +0000)]
PR10867. lit would interpret

  RUN: a
  RUN: b || true

as "a && (b || true)" in Tcl mode, and as "(a && b) || true" in sh mode.
Everyone seems to (quite reasonably) write tests assuming the Tcl behavior,
so use that in sh mode too.

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

9 years agoDo not run tests MappedMemoryTest.BasicWrite and MultipleWrite unless both
Akira Hatanaka [Wed, 5 Dec 2012 22:43:07 +0000 (22:43 +0000)]
Do not run tests MappedMemoryTest.BasicWrite and MultipleWrite unless both
MF_READ and MF_WRITE are set.

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

9 years agoQuick build fix for c++03 clang. This needs a proper solution. Note that these offset...
Michael J. Spencer [Wed, 5 Dec 2012 22:38:01 +0000 (22:38 +0000)]
Quick build fix for c++03 clang. This needs a proper solution. Note that these offsets are guaranteed to be correct by Endian.h.

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

9 years agoChange std::vector to SmallVector<4> and remove some unused methods.
Eli Bendersky [Wed, 5 Dec 2012 22:11:02 +0000 (22:11 +0000)]
Change std::vector to SmallVector<4> and remove some unused methods.

This is more consistent with other vectors in this code. In addition, I ran some
tests compiling a large program and >96% of fragments have 4 or less fixups, so
SmallVector<4> is a good optimization.

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

9 years agoDefine new-value store instructions with base+immediate addressing mode
Jyotsna Verma [Wed, 5 Dec 2012 22:02:56 +0000 (22:02 +0000)]
Define new-value store instructions with base+immediate addressing mode
using multiclass.

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

9 years agoFix name. The array is unboundED.
Bill Wendling [Wed, 5 Dec 2012 21:43:30 +0000 (21:43 +0000)]
Fix name. The array is unboundED.

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

9 years agoRegisterPressureTracker: fix findUseBetween to handle DebugValue
Andrew Trick [Wed, 5 Dec 2012 21:37:50 +0000 (21:37 +0000)]
RegisterPressureTracker: fix findUseBetween to handle DebugValue

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

9 years agoRegisterPressureTracker: unify virtual registers and physical regunits.
Andrew Trick [Wed, 5 Dec 2012 21:37:47 +0000 (21:37 +0000)]
RegisterPressureTracker: unify virtual registers and physical regunits.

Now that live register units are tracked individually, the code can be simplified.

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

9 years agoRegisterPresssureTracker: Track live physical register by unit.
Andrew Trick [Wed, 5 Dec 2012 21:37:42 +0000 (21:37 +0000)]
RegisterPresssureTracker: Track live physical register by unit.

This is much simpler to reason about, more efficient, and
fixes some corner cases involving implicit super-register defs.
Fixed rdar://12797931.

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

9 years agoCost Model: change the default cost of control flow instructions (br / ret / ......
Nadav Rotem [Wed, 5 Dec 2012 21:21:26 +0000 (21:21 +0000)]
Cost Model: change the default cost of control flow instructions (br / ret / ...) to zero.

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

9 years agoCorrect ARM NOP encoding
David Sehr [Wed, 5 Dec 2012 21:01:27 +0000 (21:01 +0000)]
Correct ARM NOP encoding

The encoding of NOP in ARMAsmBackend.cpp is missing a trailing zero, which
causes the emission of a coprocessor instruction rather than "mov r0, r0"
as indicated in the comment.  The test also checks for the wrong encoding.


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

9 years agoRemove unused methods
Eli Bendersky [Wed, 5 Dec 2012 20:56:39 +0000 (20:56 +0000)]
Remove unused methods

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

9 years ago[NVPTX] Fix crash with unnamed struct arguments
Justin Holewinski [Wed, 5 Dec 2012 20:50:28 +0000 (20:50 +0000)]
[NVPTX] Fix crash with unnamed struct arguments

Patch by Eric Holk

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

9 years agoAdd dump of Win64 EH unwind data.
Michael J. Spencer [Wed, 5 Dec 2012 20:12:35 +0000 (20:12 +0000)]
Add dump of Win64 EH unwind data.

The new command line option -unwind-info dumps the Win64 EH unwind
data to the console. This is a nice feature if you need to debug
generated EH data (e.g. from LLVM). Includes a test case.

Initial patch by João Matos, extensions and rework by Kai Nacke.

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

9 years agoUpdates to Win64EH.h structures.
Michael J. Spencer [Wed, 5 Dec 2012 20:12:13 +0000 (20:12 +0000)]
Updates to Win64EH.h structures.

Change member types of RuntimeFunction and UnwindInfo from uint64_t to
These members represent addresses. According to MSDN, they are image
relative, that is, they are 32-bit offsets from the starting address
of the image that contains the function table entry.
See MSDN for more information:
RUNTIME_FUNCTION: http://msdn.microsoft.com/en-us/library/ft9x1kdx.aspx
UNWIND_INFO: http://msdn.microsoft.com/en-us/library/ddssxxy8.aspx

Make Win64.h platform-neutral:
The standard types unit8_t, uint16_t and uint32_t are replaced with
their counterparts from Endian.h. Accessor functions are introduced to
replace bit fields.

Patch by João Matos and Kai Nacke.

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

9 years agoTest commit.
David Sehr [Wed, 5 Dec 2012 19:47:56 +0000 (19:47 +0000)]
Test commit.

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

9 years agoUse multiclass to define store instructions with base+immediate offset
Jyotsna Verma [Wed, 5 Dec 2012 19:32:03 +0000 (19:32 +0000)]
Use multiclass to define store instructions with base+immediate offset
addressing mode and immediate stored value.

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

9 years agoRemove the non-const getInst accessor. It wasn't being used, and isn't very
Eli Bendersky [Wed, 5 Dec 2012 19:31:33 +0000 (19:31 +0000)]
Remove the non-const getInst accessor. It wasn't being used, and isn't very
good for enacpsulation anyway.

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

9 years agoAdjust JIT target triple on OS X to match the current architecture.
Bob Wilson [Wed, 5 Dec 2012 19:09:13 +0000 (19:09 +0000)]
Adjust JIT target triple on OS X to match the current architecture.

For OS X builds, we generate one version of config.h but then build for
multiple architectures.  This means that the LLVM_HOSTTRIPLE setting may have
the wrong architecture.  Adjust it dynamically to match the current
architecture.  <rdar://problem/12715470>

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

9 years agoFix misplaced closing brace.
Matthew Curtis [Wed, 5 Dec 2012 19:00:34 +0000 (19:00 +0000)]
Fix misplaced closing brace.

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

9 years agoRemove two dead functions resulting from a bad rebase.
Andrew Trick [Wed, 5 Dec 2012 18:52:15 +0000 (18:52 +0000)]
Remove two dead functions resulting from a bad rebase.

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

9 years agoTry to unbreak the build on hosts that don't transitively pull in a definition for...
Benjamin Kramer [Wed, 5 Dec 2012 18:31:11 +0000 (18:31 +0000)]
Try to unbreak the build on hosts that don't transitively pull in a definition for int64_t.

Also use the portable (ugly) format string macros, for MSVC compatibility.

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

9 years agoRemove unused MachineInstr constructors.
Jakob Stoklund Olesen [Wed, 5 Dec 2012 18:27:39 +0000 (18:27 +0000)]
Remove unused MachineInstr constructors.

A MachineInstr can only ever be constructed by CreateMachineInstr() and
CloneMachineInstr(), and those factories don't use the removed

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

9 years agoAdded a option to the disassembler to print immediates as hex.
Kevin Enderby [Wed, 5 Dec 2012 18:13:19 +0000 (18:13 +0000)]
Added a option to the disassembler to print immediates as hex.

This is for the lldb team so most of but not all of the values are
to be printed as hex with this option.  Some small values like the
scale in an X86 address were requested to printed in decimal
without the leading 0x.

There may be some tweaks need to places that may still be in
decimal that they want in hex.  Specially for arm.  I made my best
guess.  Any tweaks from here should be simple.

I also did the best I know now with help from the C++ gurus
creating the cleanest formatImm() utility function and containing
the changes.  But if someone has a better idea to make something
cleaner I'm all ears and game for changing the implementation.


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

9 years ago- Added calls to doInitialization/doFinalization to immutable passes
Pedro Artigas [Wed, 5 Dec 2012 17:12:22 +0000 (17:12 +0000)]
- Added calls to doInitialization/doFinalization to immutable passes
- fixed ordering of calls to doFinalization to be the reverse of the pass run order due to potential dependencies
- fixed machine module info to operate in the doInitialization/doFinalization model, also fixes some FIXMEs

reviewed by Evan Cheng <evan.cheng@apple.com>

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

9 years ago[msan] Instrument bswap intrinsic.
Evgeniy Stepanov [Wed, 5 Dec 2012 14:39:55 +0000 (14:39 +0000)]
[msan] Instrument bswap intrinsic.

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

9 years ago[msan] Initialize callbacks in runOnFunction as opposed to doInitialization.
Evgeniy Stepanov [Wed, 5 Dec 2012 13:14:33 +0000 (13:14 +0000)]
[msan] Initialize callbacks in runOnFunction as opposed to doInitialization.

This mirrors the change in ASan & TSan done in r168864.

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

9 years ago[msan] Change linkage type of __msan_track_origins.
Evgeniy Stepanov [Wed, 5 Dec 2012 12:49:41 +0000 (12:49 +0000)]
[msan] Change linkage type of __msan_track_origins.

LinkOnceODRLinkage globals may be removed in GlobalOpt if not used in the
current module.

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

9 years agoSimplified BLEND pattern matching for shuffles.
Elena Demikhovsky [Wed, 5 Dec 2012 09:24:57 +0000 (09:24 +0000)]
Simplified BLEND pattern matching for shuffles.
Generate VPBLENDD for AVX2 and VPBLENDW for v16i16 type on AVX2.

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

9 years agoRegisterPressure API. Add support for physical register units.
Andrew Trick [Wed, 5 Dec 2012 06:47:12 +0000 (06:47 +0000)]
RegisterPressure API. Add support for physical register units.

At build-time register pressure was always computed in terms of
register units. But the compile-time API was expressed in terms of
register classes because it was intended for virtual registers (and
physical register units weren't yet used anywhere in codegen).

Now that the codegen uses physreg units consistently, prepare for
tracking register pressure also in terms of live units, not live

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

9 years agoAdded RegisterPressureTracker::dump() for debugging.
Andrew Trick [Wed, 5 Dec 2012 06:47:08 +0000 (06:47 +0000)]
Added RegisterPressureTracker::dump() for debugging.

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

9 years agoComment formatting.
Andrew Trick [Wed, 5 Dec 2012 06:47:06 +0000 (06:47 +0000)]
Comment formatting.

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

9 years agodocs: Explain plain preformatted text
Sean Silva [Wed, 5 Dec 2012 04:07:33 +0000 (04:07 +0000)]
docs: Explain plain preformatted text

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

9 years agofix a typo
Shuxin Yang [Wed, 5 Dec 2012 00:33:16 +0000 (00:33 +0000)]
fix a typo

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

9 years agoCopy clang/Driver/<Option parsing stuff> to llvm.
Michael J. Spencer [Wed, 5 Dec 2012 00:29:32 +0000 (00:29 +0000)]
Copy clang/Driver/<Option parsing stuff> to llvm.

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

9 years agodocs: Sphinxify `docs/tutorial/`
Sean Silva [Wed, 5 Dec 2012 00:26:32 +0000 (00:26 +0000)]
docs: Sphinxify `docs/tutorial/`

Sorry for the massive commit, but I just wanted to knock this one down
and it is really straightforward.

There are still a couple trivial (i.e. not related to the content)
things left to fix:

- Use of raw HTML links where :doc:`...` and :ref:`...` could be used
  instead. If you are a newbie and want to help fix this it would make
  for some good bite-sized patches; more experienced developers should
  be focusing on adding new content (to this tutorial or elsewhere, but
  please _do not_ waste your time on formatting when there is such dire
  need for documentation (see docs/SphinxQuickstartTemplate.rst to get
  started writing)).

- Highlighting of the kaleidoscope code blocks (currently left as bare
  `::`).  I will be working on writing a custom Pygments highlighter for
  this, mostly as training for maintaining the `llvm` code-block's lexer
  in-tree. I want to do this because I am extremely unhappy with how it
  just "gives up" on the slightest deviation from the expected syntax
  and leaves the whole code-block un-highlighted.

  More generally I am looking at writing some Sphinx extensions and
  keeping them in-tree as well, to support common use cases that
  currently have no good solution (like "monospace text inside a link").

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

9 years agoAdd x86 isel lowering logic to form bit test with inverted condition. e.g.
Evan Cheng [Wed, 5 Dec 2012 00:10:38 +0000 (00:10 +0000)]
Add x86 isel lowering logic to form bit test with inverted condition. e.g.
x ^ -1.

Patch by David Majnemer.

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

9 years agoAppease GCC's -Wparentheses.
Matt Beaumont-Gay [Tue, 4 Dec 2012 23:54:02 +0000 (23:54 +0000)]
Appease GCC's -Wparentheses.

(TIL that Clang's -Wparentheses ignores 'x || y && "foo"' on purpose. Neat.)

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

9 years agoSplit up the ParseOptionalAttrs method into three different methods for each
Bill Wendling [Tue, 4 Dec 2012 23:40:58 +0000 (23:40 +0000)]
Split up the ParseOptionalAttrs method into three different methods for each
class of attributes. This makes it much easier to check for errors and to reuse
the code.

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

9 years agoLoopVectorizer: Increase the number of pointers that can be tested at runtime. If...
Nadav Rotem [Tue, 4 Dec 2012 23:25:24 +0000 (23:25 +0000)]
LoopVectorizer: Increase the number of pointers that can be tested at runtime. If we cant prove statically that the pointers are disjoint then we add the runtime check.

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

9 years agoEnable if-conversion during vectorization.
Nadav Rotem [Tue, 4 Dec 2012 22:59:52 +0000 (22:59 +0000)]
Enable if-conversion during vectorization.

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

9 years agoARM custom lower ctpop for vector types. Patch by Pete Couperus.
Evan Cheng [Tue, 4 Dec 2012 22:41:50 +0000 (22:41 +0000)]
ARM custom lower ctpop for vector types. Patch by Pete Couperus.

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

9 years agoFix a bug in vectorization of if-converted reduction variables. If the
Nadav Rotem [Tue, 4 Dec 2012 22:40:22 +0000 (22:40 +0000)]
Fix a bug in vectorization of if-converted reduction variables. If the
reduction variable is not used outside the loop then we ran into an
endless loop. This change checks if we found the original PHI.

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

9 years agoSpeed up the AllocationOrder class a bit.
Jakob Stoklund Olesen [Tue, 4 Dec 2012 22:25:16 +0000 (22:25 +0000)]
Speed up the AllocationOrder class a bit.

Allow the central functions to be inlined, and use the argumentless
isHint() function when possible.

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

9 years ago For rdar://12329730, last piece.
Shuxin Yang [Tue, 4 Dec 2012 22:15:32 +0000 (22:15 +0000)]
  For rdar://12329730, last piece.

  This change attempts to simplify (X^Y) -> X or Y in the user's context if we know that
only bits from X or Y are demanded.

  A minimized case is provided bellow. This change will simplify "t>>16" into "var1 >>16".

  unsigned foo (unsigned val1, unsigned val2) {
    unsigned t = val1 ^ 1234;
    return (t >> 16) | t; // NOTE: t is used more than once.

  Note that if the "t" were used only once, the expression would be finally optimized as well.
However, with with this change, the optimization will take place earlier.

  Reviewed by Nadav, Thanks a lot!

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

9 years agoComment change made in r169304 as requested by Eric Christopher.
David Blaikie [Tue, 4 Dec 2012 22:02:33 +0000 (22:02 +0000)]
Comment change made in r169304 as requested by Eric Christopher.

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

9 years agoDefine store instructions with base+register offset addressing mode
Jyotsna Verma [Tue, 4 Dec 2012 21:58:25 +0000 (21:58 +0000)]
Define store instructions with base+register offset addressing mode
using multiclass.

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

9 years agoUse the 'count' attribute to calculate the upper bound of an array.
Bill Wendling [Tue, 4 Dec 2012 21:34:03 +0000 (21:34 +0000)]
Use the 'count' attribute to calculate the upper bound of an array.

The count attribute is more accurate with regards to the size of an array. It
also obviates the upper bound attribute in the subrange. We can also better
handle an unbound array by setting the count to -1 instead of the lower bound to
1 and upper bound to 0.

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

9 years agodocs: Begin Sphinxification of docs/tutorial/
Sean Silva [Tue, 4 Dec 2012 21:16:41 +0000 (21:16 +0000)]
docs: Begin Sphinxification of docs/tutorial/

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

9 years agodocs: fixup legacy HTML link
Sean Silva [Tue, 4 Dec 2012 21:16:34 +0000 (21:16 +0000)]
docs: fixup legacy HTML link

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

9 years agoReapply r160148 (reverted in r163570) fixing spurious breakpoints in modern GDB
David Blaikie [Tue, 4 Dec 2012 21:05:36 +0000 (21:05 +0000)]
Reapply r160148 (reverted in r163570) fixing spurious breakpoints in modern GDB

This reapplies the fix for PR13303 now with more justification. Based on my
execution of the GDB 7.5 test suite this results in:

expected passes: 16101 -> 20890 (+30%)
unexpected failures: 4826 -> 637 (-77%)

There are 23 checks that used to pass and now fail. They are all in
gdb.reverse. Investigating a few looks like they were accidentally passing
due to extra breakpoints being set by this bug. They're generally due to the
difference in end location between gcc and clang, the test suite is trying to
set breakpoints on the closing '}' that clang doesn't associate with any

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

9 years agoRemove a URL from code
Eli Bendersky [Tue, 4 Dec 2012 19:08:43 +0000 (19:08 +0000)]
Remove a URL from code

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

9 years agoMake NaCl naming consistent. The triple OSType is called NaCl and is represented
Eli Bendersky [Tue, 4 Dec 2012 18:37:26 +0000 (18:37 +0000)]
Make NaCl naming consistent. The triple OSType is called NaCl and is represented
textually as NativeClient. Also added a link to the native client project for
readers unfamiliar with it.

A Clang patch will follow shortly.

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

9 years agoAdd support for reduction variables when IF-conversion is enabled.
Nadav Rotem [Tue, 4 Dec 2012 18:17:33 +0000 (18:17 +0000)]
Add support for reduction variables when IF-conversion is enabled.

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

9 years agoAdd patterns to define 'combine', 'tstbit', 'ct0/cl0' (count trailing/leading zeros)
Jyotsna Verma [Tue, 4 Dec 2012 18:05:01 +0000 (18:05 +0000)]
Add patterns to define 'combine', 'tstbit', 'ct0/cl0' (count trailing/leading zeros)

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

9 years agoAdd constant extender support to ALU32 instructions for V2.
Jyotsna Verma [Tue, 4 Dec 2012 17:12:00 +0000 (17:12 +0000)]
Add constant extender support to ALU32 instructions for V2.

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

9 years agoA test in thid directory was not being run because lit.local.cfg didn't
Eli Bendersky [Tue, 4 Dec 2012 17:00:11 +0000 (17:00 +0000)]
A test in thid directory was not being run because lit.local.cfg didn't
include .ll files. Fix that.

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

9 years agoFix comment typo.
Duncan Sands [Tue, 4 Dec 2012 16:36:05 +0000 (16:36 +0000)]
Fix comment typo.

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

9 years agoThis patch introduces initial-exec model support for thread-local storage
Bill Schmidt [Tue, 4 Dec 2012 16:18:08 +0000 (16:18 +0000)]
This patch introduces initial-exec model support for thread-local storage
on 64-bit PowerPC ELF.

The patch includes code to handle external assembly and MC output with the
integrated assembler.  It intentionally does not support the "old" JIT.

For the initial-exec TLS model, the ABI requires the following to calculate
the address of external thread-local variable x:

 Code sequence            Relocation                  Symbol
  ld 9,x@got@tprel(2)      R_PPC64_GOT_TPREL16_DS      x
  add 9,9,x@tls            R_PPC64_TLS                 x

The register 9 is arbitrary here.  The linker will replace x@got@tprel
with the offset relative to the thread pointer to the generated GOT
entry for symbol x.  It will replace x@tls with the thread-pointer
register (13).

The two test cases verify correct assembly output and relocation output
as just described.

PowerPC-specific selection node variants are added for the two
instructions above:  LD_GOT_TPREL and ADD_TLS.  These are inserted
when an initial-exec global variable is encountered by
PPCTargetLowering::LowerGlobalTLSAddress(), and later lowered to
machine instructions LDgotTPREL and ADD8TLS.  LDgotTPREL is a pseudo
that uses the same LDrs support added for medium code model's LDtocL,
with a different relocation type.

The rest of the processing is straightforward.

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

9 years agoUpdate release notes for NVPTX
Justin Holewinski [Tue, 4 Dec 2012 16:11:51 +0000 (16:11 +0000)]
Update release notes for NVPTX

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

9 years agoGet rid of references to Tcl, DejagGNU, old test structure, discourage the use
Eli Bendersky [Tue, 4 Dec 2012 14:34:00 +0000 (14:34 +0000)]
Get rid of references to Tcl, DejagGNU, old test structure, discourage the use
of grep in favor of FileCheck, and other cleanups.

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

9 years agoRemove the very out-of-date listing of "very important LLVM areas". I don't
Eli Bendersky [Tue, 4 Dec 2012 13:55:17 +0000 (13:55 +0000)]
Remove the very out-of-date listing of "very important LLVM areas". I don't
think it adds much and keeping it up-to-date is (obviously) a chore.

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

9 years agoImprove MSan tests.
Evgeniy Stepanov [Tue, 4 Dec 2012 11:42:05 +0000 (11:42 +0000)]
Improve MSan tests.

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

9 years agoKillTheDoctor.cpp: Restore Win32 SDK headers before r169251.
NAKAMURA Takumi [Tue, 4 Dec 2012 11:34:27 +0000 (11:34 +0000)]
KillTheDoctor.cpp: Restore Win32 SDK headers before r169251.

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

9 years agoClean up the sample include orderings, not that it really matters...
Chandler Carruth [Tue, 4 Dec 2012 10:46:21 +0000 (10:46 +0000)]
Clean up the sample include orderings, not that it really matters...

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

9 years agoSort the #include lines for tools/...
Chandler Carruth [Tue, 4 Dec 2012 10:44:52 +0000 (10:44 +0000)]
Sort the #include lines for tools/...

Again, tools are trickier to pick the main module header for than
library source files. I've started to follow the pattern of using
LLVMContext.h when it is included as a stub for program source files.

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

9 years agoSort the #include lines for utils/...
Chandler Carruth [Tue, 4 Dec 2012 10:37:14 +0000 (10:37 +0000)]
Sort the #include lines for utils/...

I've tried to find main moudle headers where possible, but the TableGen
stuff may warrant someone else looking at it.

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

9 years agoSort the #include lines for unittest/...
Chandler Carruth [Tue, 4 Dec 2012 10:23:08 +0000 (10:23 +0000)]
Sort the #include lines for unittest/...

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

9 years agoSort the #include lines of the examples/... tree.
Chandler Carruth [Tue, 4 Dec 2012 10:16:57 +0000 (10:16 +0000)]
Sort the #include lines of the examples/... tree.

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

9 years agoTeach the include sorter to quickly skip files with an extension that
Chandler Carruth [Tue, 4 Dec 2012 10:08:59 +0000 (10:08 +0000)]
Teach the include sorter to quickly skip files with an extension that
doesn't look like it will have C++ code in it.

Suggestions on a better heuristic are welcome.

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

9 years agoTeach the include sorter to skip files under test trees and under INPUTS
Chandler Carruth [Tue, 4 Dec 2012 09:59:54 +0000 (09:59 +0000)]
Teach the include sorter to skip files under test trees and under INPUTS
trees. This allows running the input sorter on the entire clang
repository cleanly now.

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

9 years agoTeach the include sorting script about the gtest headers; sort them with
Chandler Carruth [Tue, 4 Dec 2012 09:44:38 +0000 (09:44 +0000)]
Teach the include sorting script about the gtest headers; sort them with
the system headers.

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

9 years agoVMCoreTests/PassManagerTest.cpp: Appease msvc not to do "using llvm::Pass" in class...
NAKAMURA Takumi [Tue, 4 Dec 2012 07:25:24 +0000 (07:25 +0000)]
VMCoreTests/PassManagerTest.cpp: Appease msvc not to do "using llvm::Pass" in class template.

FIXME: I have not checked whether to be compiled on msvc11.

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

9 years agoSort includes for all of the .h files under the 'lib' tree. These were
Chandler Carruth [Tue, 4 Dec 2012 07:12:27 +0000 (07:12 +0000)]
Sort includes for all of the .h files under the 'lib' tree. These were
missed in the first pass because the script didn't yet handle include

Note that the script is now able to handle all of these headers without
manual edits. =]

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

9 years agoGive scalar if-converted blocks half the score because they are not always executed...
Nadav Rotem [Tue, 4 Dec 2012 07:11:52 +0000 (07:11 +0000)]
Give scalar if-converted blocks half the score because they are not always executed due to CF.

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

9 years agoAddress review comments from Matt on the sort_includes.py script.
Chandler Carruth [Tue, 4 Dec 2012 07:04:58 +0000 (07:04 +0000)]
Address review comments from Matt on the sort_includes.py script.

1) Teach it to handle files with #include on the first line -- these do
   actually exist in LLVM.
2) Support llvm-c and clang-c include projects.
3) Nuke some stail imports.
4) Switch to using os.path to split the file extension off.
5) Remove debugging leftovers.
6) Add docstring (a really puny one) for the sort function.

I'm continuing te avoid stripping the whitespace on the RHS to preserve
whatever newline characters happen to be in the original file.

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

9 years agoAdd a comment about the requirement that the Windows.h header be last.
Chandler Carruth [Tue, 4 Dec 2012 07:04:57 +0000 (07:04 +0000)]
Add a comment about the requirement that the Windows.h header be last.
This comment has the dual effect of blocking reorderings with the
sort_include script.

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

9 years agoAdd a 'count' field to the DWARF subrange.
Bill Wendling [Tue, 4 Dec 2012 06:20:49 +0000 (06:20 +0000)]
Add a 'count' field to the DWARF subrange.

The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.

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

9 years agoAdd the last part that is needed for vectorization of if-converted code.
Nadav Rotem [Tue, 4 Dec 2012 06:15:11 +0000 (06:15 +0000)]
Add the last part that is needed for vectorization of if-converted code.
Added the code that actually performs the if-conversion during vectorization.

We can now vectorize this code:

for (int i=0; i<n; ++i) {
  unsigned k = 0;

  if (a[i] > b[i])   <------ IF inside the loop.
    k = k * 5 + 3;

  a[i] = k;          <---- K is a phi node that becomes vector-select.

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