oota-llvm.git
12 years agoRevert the business end of r164636 and try again. I'll come in again. ;]
Chandler Carruth [Wed, 26 Sep 2012 07:41:40 +0000 (07:41 +0000)]
Revert the business end of r164636 and try again. I'll come in again. ;]

This should really, really fix PR13916. For real this time. The
underlying bug is... a bit more subtle than I had imagined.

The setup is a code pattern that leads to an @llvm.memcpy call with two
equal pointers to an alloca in the source and dest. Now, not any pattern
will do. The alloca needs to be formed just so, and both pointers should
be wrapped in different bitcasts etc. When this precise pattern hits,
a funny sequence of events transpires. First, we correctly detect the
potential for overlap, and correctly optimize the memcpy. The first
time. However, we do simplify the set of users of the alloca, and that
causes us to run the alloca back through the SROA pass in case there are
knock-on simplifications. At this point, a curious thing has happened.
If we happen to have an i8 alloca, we have direct i8 pointer values. So
we don't bother creating a cast, we rewrite the arguments to the memcpy
to dircetly refer to the alloca.

Now, in an unrelated area of the pass, we have clever logic which
ensures that when visiting each User of a particular pointer derived
from an alloca, we only visit that User once, and directly inspect all
of its operands which refer to that particular pointer value. However,
the mechanism used to detect memcpy's with the potential to overlap
relied upon getting visited once per *Use*, not once per *User*. This is
always true *unless* the same exact value is both source and dest. It
turns out that almost nothing actually produces that pattern though.

We can hand craft test cases that more directly test this behavior of
course, and those are included. Also, note that there is a significant
missed optimization here -- we prove in many cases that there is
a non-volatile memcpy call with identical source and dest addresses. We
shouldn't prevent splitting the alloca in that case, and in fact we
should just remove such memcpy calls eagerly. I'll address that in
a subsequent commit.

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

12 years agoAdd is16BitVector and is32BitVector to MVT and call them from EVT. Matches other...
Craig Topper [Wed, 26 Sep 2012 07:17:37 +0000 (07:17 +0000)]
Add is16BitVector and is32BitVector to MVT and call them from EVT. Matches other similar methods.

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

12 years agoReplace calls to getSizeInBits with getExtendedSizeInBits since its already known...
Craig Topper [Wed, 26 Sep 2012 07:11:42 +0000 (07:11 +0000)]
Replace calls to getSizeInBits with getExtendedSizeInBits since its already known its an extended type.

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

12 years agoRename virtual table anchors from Anchor() to anchor() for consistency with the rest...
Craig Topper [Wed, 26 Sep 2012 06:36:36 +0000 (06:36 +0000)]
Rename virtual table anchors from Anchor() to anchor() for consistency with the rest of the tree.

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

12 years agoRemove hasNoAVX method. Can just invert hasAVX instead.
Craig Topper [Wed, 26 Sep 2012 06:29:37 +0000 (06:29 +0000)]
Remove hasNoAVX method. Can just invert hasAVX instead.

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

12 years agoMark extended type querying methods as 'readonly' to reduce compile size.
Craig Topper [Wed, 26 Sep 2012 06:28:26 +0000 (06:28 +0000)]
Mark extended type querying methods as 'readonly' to reduce compile size.

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

12 years agoGenerate an error message instead of asserting or segfaulting when we have a
Bill Wendling [Wed, 26 Sep 2012 06:16:18 +0000 (06:16 +0000)]
Generate an error message instead of asserting or segfaulting when we have a
scalar-to-vector conversion that we cannot handle. For instance, when an invalid
constraint is used in an inline asm statement.
<rdar://problem/12284092>

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

12 years agoAdd 'lock' prefix output support in assembly printer
Michael Liao [Wed, 26 Sep 2012 05:13:44 +0000 (05:13 +0000)]
Add 'lock' prefix output support in assembly printer

- Instead of embedding 'lock' into each mnemonic of atomic
  instructions except 'xchg', we teach X86 assembly printer to output 'lock'
  prefix similar to or consistent with code emitter.

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

12 years agoGenerate an error message instead of asserting or segfaulting when we have a
Bill Wendling [Wed, 26 Sep 2012 04:04:19 +0000 (04:04 +0000)]
Generate an error message instead of asserting or segfaulting when we have a
scalar-to-vector conversion that we cannot handle. For instance, when an invalid
constraint is used in an inline asm statement.
<rdar://problem/12284092>

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

12 years agoExpansions for u/srem, using the udiv expansion. More unit tests for udiv and u/srem.
Michael Ilseman [Wed, 26 Sep 2012 01:55:01 +0000 (01:55 +0000)]
Expansions for u/srem, using the udiv expansion. More unit tests for udiv and u/srem.

Fixed issue with Release build.

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

12 years agoRevert "Add --program-prefix support to build"
Jordan Rose [Wed, 26 Sep 2012 00:01:00 +0000 (00:01 +0000)]
Revert "Add --program-prefix support to build"

The Apple buildbots are set up to pass --target to configure for both
cross- and non-cross-compile builds, and the standard autoconf response
to this is to set the program prefix to '<target>-'. Until we can figure
out the proper way to handle this (don't pass --target? pass an explicit
--program-prefix=""? don't auto-populate program_prefix with target_alias?)
it's more important to keep the buildbots running.

This reverts r164633 / ba48ceb1a3802e20e781ef04ea2573ffae2ac414.

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

12 years agoInitialize boolean variables in MipsSubtarget's constructor.
Akira Hatanaka [Tue, 25 Sep 2012 23:07:11 +0000 (23:07 +0000)]
Initialize boolean variables in MipsSubtarget's constructor.

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

12 years agoDon't drop the alignment on a memcpy intrinsic when producing a store. This is
Nick Lewycky [Tue, 25 Sep 2012 22:46:21 +0000 (22:46 +0000)]
Don't drop the alignment on a memcpy intrinsic when producing a store. This is
only a missed optimization opportunity if the store is over-aligned, but a
miscompile if the store's new type has a higher natural alignment than the
memcpy did. Fixes PR13920!

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

12 years agoblank line for test commit
Reed Kotler [Tue, 25 Sep 2012 22:34:20 +0000 (22:34 +0000)]
blank line for test commit

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

12 years agoRevert the business end of r164634, and replace it with a different fix. The
Nick Lewycky [Tue, 25 Sep 2012 21:50:37 +0000 (21:50 +0000)]
Revert the business end of r164634, and replace it with a different fix. The
reason we were getting two of the same alloca is because of a memmove/memcpy
which had the same alloca in both the src and dest. Now we detect that case
directly. This has the same testcase as before, but fixes a clang test
CodeGenObjC/exceptions.m which runs clang -O2.

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

12 years agoDon't try to promote the same alloca twice. Fixes PR13916!
Nick Lewycky [Tue, 25 Sep 2012 21:15:50 +0000 (21:15 +0000)]
Don't try to promote the same alloca twice. Fixes PR13916!

Chandler, it's not obvious that it's okay that this alloca gets into the list
twice to begin with. Please review and see whether this is the fix you really
want, but I wanted to get a fix checked in quickly.

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

12 years agoAdd --program-prefix support to build
Sebastian Pop [Tue, 25 Sep 2012 21:15:08 +0000 (21:15 +0000)]
Add --program-prefix support to build

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

12 years agoMove remaining methods inside the Attributes class. Merge the 'Attribute' namespaces.
Bill Wendling [Tue, 25 Sep 2012 20:57:48 +0000 (20:57 +0000)]
Move remaining methods inside the Attributes class. Merge the 'Attribute' namespaces.

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

12 years agodocs: Sphinxify HowToSubmitABug
Sean Silva [Tue, 25 Sep 2012 20:52:04 +0000 (20:52 +0000)]
docs: Sphinxify HowToSubmitABug

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

12 years agoMove Attribute::typeIncompatible inside of the Attributes class.
Bill Wendling [Tue, 25 Sep 2012 20:38:59 +0000 (20:38 +0000)]
Move Attribute::typeIncompatible inside of the Attributes class.

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

12 years agoTargetLowering interface to set/get minimum block entries for jump tables.
Sebastian Pop [Tue, 25 Sep 2012 20:35:36 +0000 (20:35 +0000)]
TargetLowering interface to set/get minimum block entries for jump tables.

Provide interface in TargetLowering to set or get the minimum number of basic
blocks whereby jump tables are generated for switch statements rather than an
if sequence.

    getMinimumJumpTableEntries() defaults to 4.
    setMinimumJumpTableEntries() allows target configuration.

    This patch changes the default for the Hexagon architecture to 5
    as it improves performance on some benchmarks.

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

12 years agoRevert r164614 to appease the buildbots.
Chad Rosier [Tue, 25 Sep 2012 19:57:20 +0000 (19:57 +0000)]
Revert r164614 to appease the buildbots.

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

12 years agoMake this test check the transforms it's actually doing. Also add a test that it
Nick Lewycky [Tue, 25 Sep 2012 18:17:38 +0000 (18:17 +0000)]
Make this test check the transforms it's actually doing. Also add a test that it
doesn't transform the trivially unsafe case.

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

12 years agoAdd missing i64 max/min/umax/umin on 32-bit target
Michael Liao [Tue, 25 Sep 2012 18:08:13 +0000 (18:08 +0000)]
Add missing i64 max/min/umax/umin on 32-bit target

- Turn on atomic6432.ll and add specific test case as well

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

12 years agoARM: Darwin BL/BLX relocations to out-of-range symbols.
Jim Grosbach [Tue, 25 Sep 2012 18:07:17 +0000 (18:07 +0000)]
ARM: Darwin BL/BLX relocations to out-of-range symbols.

When a BL/BLX references a symbol in the same translation unit that is
out of range, use an external relocation. The linker will use this to
generate a branch island rather than a direct reference, allowing the
relocation to resolve correctly.

rdar://12359919

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

12 years agoExpansions for u/srem, using the udiv expansion. More unit tests for udiv and u/srem.
Michael Ilseman [Tue, 25 Sep 2012 17:56:47 +0000 (17:56 +0000)]
Expansions for u/srem, using the udiv expansion. More unit tests for udiv and u/srem.

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

12 years agoConsistently specify the assembly variant to MatchInstructionImpl.
Bob Wilson [Tue, 25 Sep 2012 17:19:29 +0000 (17:19 +0000)]
Consistently specify the assembly variant to MatchInstructionImpl.

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

12 years agoFix a case where SROA did not correctly detect dead PHI or selects due
Chandler Carruth [Tue, 25 Sep 2012 10:03:40 +0000 (10:03 +0000)]
Fix a case where SROA did not correctly detect dead PHI or selects due
to chains or cycles between PHIs and/or selects. Also add a couple of
really nice test cases reduced from Kostya's reports in PR13905 and
PR13906. Both are fixed by this patch.

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

12 years agoChange the way the lint sanity checking pass detects misaligned memory accesses.
Duncan Sands [Tue, 25 Sep 2012 10:00:49 +0000 (10:00 +0000)]
Change the way the lint sanity checking pass detects misaligned memory accesses.
Previously it was only be able to detect problems if the pointer was a numerical
value (eg inttoptr i32 1 to i32*), but not if it was an alloca or globa.  The
reason was the use of ComputeMaskedBits: imagine you have "alloca i8, align 2",
and ask ComputeMaskedBits what it knows about the bits of the alloca pointer.
It can tell you that the bottom bit is known zero (due to align 2) but it can't
tell you that bit 1 is known one.  That's because the address could be an even
multiple of 2 rather than an odd multiple, eg it might be a multiple of 4.  Thus
trying to use KnownOne is ineffective in the case of an alloca as it will never
have any bits set.  Instead look explicitly for constant offsets from allocas
and globals.

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

12 years agoFix an illegal tailcall opt where the callee returns a double via xmm while caller...
Evan Cheng [Tue, 25 Sep 2012 05:32:34 +0000 (05:32 +0000)]
Fix an illegal tailcall opt where the callee returns a double via xmm while caller returns x86_fp80 via st0. rdar://12229511

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

12 years agoFix a -Wparentheses warning in the mingw build
Nico Weber [Tue, 25 Sep 2012 05:24:16 +0000 (05:24 +0000)]
Fix a -Wparentheses warning in the mingw build

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

12 years agoFix a crash in SROA. This was reported independently by Takumi and
Chandler Carruth [Tue, 25 Sep 2012 02:42:03 +0000 (02:42 +0000)]
Fix a crash in SROA. This was reported independently by Takumi and
David (I think), but I would appreciate folks verifying that this fixes
the big crasher.

I'm still working on a reduced test case, but because this was causing
problems I wanted to get the fix checked in quickly.

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

12 years agoDon't forget that strcpy and friends return a pointer to the destination, so
Nick Lewycky [Tue, 25 Sep 2012 01:55:59 +0000 (01:55 +0000)]
Don't forget that strcpy and friends return a pointer to the destination, so
it's not a dead store if that pointer is used. Whoops!

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

12 years agoUnit tests for IntegerDivision. Currently, just a basic sanity check to ensure that...
Michael Ilseman [Tue, 25 Sep 2012 01:33:33 +0000 (01:33 +0000)]
Unit tests for IntegerDivision. Currently, just a basic sanity check to ensure that the code was generated properly. Future work would be finding some way to test the actual result that would be computed.

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

12 years agoARM: 'add Rd, pc, #imm' is an alias for 'adr Rd, #imm'.
Jim Grosbach [Tue, 25 Sep 2012 00:08:13 +0000 (00:08 +0000)]
ARM: 'add Rd, pc, #imm' is an alias for 'adr Rd, #imm'.

rdar://9795790

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

12 years agoRemove unused name of variable to quiet a warning. Also canonicalize a
Nick Lewycky [Mon, 24 Sep 2012 23:47:23 +0000 (23:47 +0000)]
Remove unused name of variable to quiet a warning. Also canonicalize a
declaration to use the same form as in the rest of the file. No functionality
change.

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

12 years agoMark jump tables in code sections with DataRegion directives.
Jim Grosbach [Mon, 24 Sep 2012 23:06:27 +0000 (23:06 +0000)]
Mark jump tables in code sections with DataRegion directives.

Even out-of-line jump tables can be in the code section, so mark them
as data-regions for those targets which support the directives.

rdar://12362871&12362974

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

12 years agoTypo.
Chad Rosier [Mon, 24 Sep 2012 23:04:25 +0000 (23:04 +0000)]
Typo.

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

12 years agoRather then have a wrapper function, have tblgen instantiate the implementation.
Chad Rosier [Mon, 24 Sep 2012 22:57:55 +0000 (22:57 +0000)]
Rather then have a wrapper function, have tblgen instantiate the implementation.
Also remove an unused argument.

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

12 years agoClear UNIVERSAL_SDK_PATH setting when building host tools. <rdar://12360497>
Bob Wilson [Mon, 24 Sep 2012 22:51:19 +0000 (22:51 +0000)]
Clear UNIVERSAL_SDK_PATH setting when building host tools.  <rdar://12360497>

I also moved the SDKROOT setting into the make flags, since clearing it from
the environment isn't good enough to override a setting on the make command
line.  That hasn't been a problem but it could be, and it's good to be
consistent with the way UNIVERSAL_SDK_PATH is handled.

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

12 years agoTeach DSE that strcpy, strncpy, strcat and strncat are all stores which may be
Nick Lewycky [Mon, 24 Sep 2012 22:09:10 +0000 (22:09 +0000)]
Teach DSE that strcpy, strncpy, strcat and strncat are all stores which may be
dead.

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

12 years agoMove all the calls to AA.getTargetLibraryInfo() to using a TLI member variable.
Nick Lewycky [Mon, 24 Sep 2012 22:07:09 +0000 (22:07 +0000)]
Move all the calls to AA.getTargetLibraryInfo() to using a TLI member variable.
No functionality change.

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

12 years agoSpecify MachinePointerInfo as refering to the argument value and offset of the
Roman Divacky [Mon, 24 Sep 2012 20:47:19 +0000 (20:47 +0000)]
Specify MachinePointerInfo as refering to the argument value and offset of the
store when handling byval arguments. Thus preventing reordering of the store
with load with post-RA scheduler.

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

12 years agoRather then have a wrapper function, have tblgen instantiate the implementation.
Chad Rosier [Mon, 24 Sep 2012 19:32:29 +0000 (19:32 +0000)]
Rather then have a wrapper function, have tblgen instantiate the implementation.

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

12 years agoAdd missing : in CHECK line.
Richard Osborne [Mon, 24 Sep 2012 17:22:43 +0000 (17:22 +0000)]
Add missing : in CHECK line.

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

12 years agoAdd missing check for presence of target data.
Richard Osborne [Mon, 24 Sep 2012 17:10:03 +0000 (17:10 +0000)]
Add missing check for presence of target data.

This avoids a crash in visitAllocaInst when target data isn't available.

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

12 years agoEnable the new SROA pass by default.
Chandler Carruth [Mon, 24 Sep 2012 01:10:25 +0000 (01:10 +0000)]
Enable the new SROA pass by default.

Queue the fallout. ;]

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

12 years agoAddress one of the original FIXMEs for the new SROA pass by implementing
Chandler Carruth [Mon, 24 Sep 2012 00:34:20 +0000 (00:34 +0000)]
Address one of the original FIXMEs for the new SROA pass by implementing
integer promotion analogous to vector promotion. When there is an
integer alloca being accessed both as its integer type and as a narrower
integer type, promote the narrower access to "insert" and "extract" the
smaller integer from the larger one, and make the integer alloca
a candidate for promotion.

In the new formulation, we don't care about target legal integer or use
thresholds to control things. Instead, we only perform this promotion to
an integer type which the frontend has already emitted a load or store
for. This bounds the scope and prevents optimization passes from
coalescing larger and larger entities into a single integer.

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

12 years agoEmit dtors into proper section while compiling in vcpp-compatible mode.
Anton Korobeynikov [Sun, 23 Sep 2012 15:53:47 +0000 (15:53 +0000)]
Emit dtors into proper section while compiling in vcpp-compatible mode.
Patch by Kai!

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

12 years agoSwitch to a signed representation for the dynamic offsets while walking
Chandler Carruth [Sun, 23 Sep 2012 11:43:14 +0000 (11:43 +0000)]
Switch to a signed representation for the dynamic offsets while walking
across the uses of the alloca. It's entirely possible for negative
numbers to come up here, and in some rare cases simply doing the 2's
complement arithmetic isn't the correct decision. Notably, we can't zext
the index of the GEP. The definition of GEP is that these offsets are
sign extended or truncated to the size of the pointer, and then wrapping
2's complement arithmetic used.

This patch fixes an issue that comes up with *no* input from the
buildbots or bootstrap afaict. The only place where it manifested,
disturbingly, is Clang's own regression test suite. A reduced and
targeted collection of tests are added to cope with this. Note that I've
tried to pin down the potential cases of overflow, but may have missed
some cases. I've tried to add a few cases to test this, but its hard
because LLVM has quite limited support for >64bit constructs.

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

12 years agoDon't do actual work inside an assert statement. Fixes PR11760!
Nick Lewycky [Sun, 23 Sep 2012 03:58:21 +0000 (03:58 +0000)]
Don't do actual work inside an assert statement. Fixes PR11760!

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

12 years agoRevise test to avoid using of 'grep'
Michael Liao [Sun, 23 Sep 2012 02:41:47 +0000 (02:41 +0000)]
Revise test to avoid using of 'grep'

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

12 years agoAdd LLVM_OVERRIDE to methods that override their base classes.
Craig Topper [Sun, 23 Sep 2012 02:12:10 +0000 (02:12 +0000)]
Add LLVM_OVERRIDE to methods that override their base classes.

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

12 years agoEnhance test case of atomic16 to verify inst encoding fixed in r164453.
Michael Liao [Sat, 22 Sep 2012 21:07:59 +0000 (21:07 +0000)]
Enhance test case of atomic16 to verify inst encoding fixed in r164453.

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

12 years agoARMInstPrinter.cpp: Fix a warning in -Asserts. [-Wunused-variable]
NAKAMURA Takumi [Sat, 22 Sep 2012 13:12:28 +0000 (13:12 +0000)]
ARMInstPrinter.cpp: Fix a warning in -Asserts. [-Wunused-variable]

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

12 years agoWhitespace.
NAKAMURA Takumi [Sat, 22 Sep 2012 13:12:22 +0000 (13:12 +0000)]
Whitespace.

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

12 years agoFix edge cases of ARM shift operands in arith instructions.
Tim Northover [Sat, 22 Sep 2012 11:18:19 +0000 (11:18 +0000)]
Fix edge cases of ARM shift operands in arith instructions.

As before with load instructions, oddities like "asr #32", "rrx" could
be printed incorrectly.

Patch by Chris Lidbury.

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

12 years agoFix the handling of edge cases in ARM shifted operands.
Tim Northover [Sat, 22 Sep 2012 11:18:12 +0000 (11:18 +0000)]
Fix the handling of edge cases in ARM shifted operands.

This patch fixes load/store instructions to handle less common cases
like "asr #32", "rrx" properly throughout the MC layer.

Patch by Chris Lidbury.

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

12 years agoFix 16-bit atomic inst encoding and keep pseudo-inst starting with '#'
Michael Liao [Sat, 22 Sep 2012 05:41:15 +0000 (05:41 +0000)]
Fix 16-bit atomic inst encoding and keep pseudo-inst starting with '#'

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

12 years agoFix typo in r164357
Michael Liao [Sat, 22 Sep 2012 03:39:42 +0000 (03:39 +0000)]
Fix typo in r164357

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

12 years agoMachine Model (-schedmodel only). Added SchedAliases.
Andrew Trick [Sat, 22 Sep 2012 02:24:21 +0000 (02:24 +0000)]
Machine Model (-schedmodel only). Added SchedAliases.

Allow subtargets to tie SchedReadWrite types to processor specific
sequences or variants.

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

12 years agoAdd llvm::getOrdinalSuffix to get the appropriate -st, -nd, -rd, -th suffix.
Jordan Rose [Sat, 22 Sep 2012 01:24:21 +0000 (01:24 +0000)]
Add llvm::getOrdinalSuffix to get the appropriate -st, -nd, -rd, -th suffix.

Used by clang to print parameter indexes.

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

12 years agoCasting: assert that pointer arguments to isa<> are non-null.
Jordan Rose [Sat, 22 Sep 2012 01:24:18 +0000 (01:24 +0000)]
Casting: assert that pointer arguments to isa<> are non-null.

This silences several analyzer warnings within LLVM, and provides a slightly
nicer crash experience when someone calls isa<>, cast<>, or dyn_cast<> with
a null pointer.

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

12 years agoDenseMap: assert that we have found a bucket before we try to insert into it.
Jordan Rose [Sat, 22 Sep 2012 01:24:16 +0000 (01:24 +0000)]
DenseMap: assert that we have found a bucket before we try to insert into it.

This silences literally dozens of analyzer warnings on LLVM (since DenseMap
is such a commonly-used class).

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

12 years agoMIPS DSP: Add immediate leaves.
Akira Hatanaka [Sat, 22 Sep 2012 00:07:12 +0000 (00:07 +0000)]
MIPS DSP: Add immediate leaves.

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

12 years agoMIPS DSP: Add predicates and instruction template.
Akira Hatanaka [Sat, 22 Sep 2012 00:06:06 +0000 (00:06 +0000)]
MIPS DSP: Add predicates and instruction template.

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

12 years agoAdd MIPS DSP register classes. Set actions of DSP vector operations and override
Akira Hatanaka [Fri, 21 Sep 2012 23:58:31 +0000 (23:58 +0000)]
Add MIPS DSP register classes. Set actions of DSP vector operations and override
TargetLowering's callback functions.

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

12 years agoSelectionDAG node enums for MIPS DSP nodes.
Akira Hatanaka [Fri, 21 Sep 2012 23:52:47 +0000 (23:52 +0000)]
SelectionDAG node enums for MIPS DSP nodes.

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

12 years agoAdd MIPS accumulator and DSP control registers.
Akira Hatanaka [Fri, 21 Sep 2012 23:48:37 +0000 (23:48 +0000)]
Add MIPS accumulator and DSP control registers.

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

12 years agoAdd flags and feature bits for mips dsp.
Akira Hatanaka [Fri, 21 Sep 2012 23:41:49 +0000 (23:41 +0000)]
Add flags and feature bits for mips dsp.

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

12 years agoFix a case where the new SROA pass failed to zap dead operands to
Chandler Carruth [Fri, 21 Sep 2012 23:36:40 +0000 (23:36 +0000)]
Fix a case where the new SROA pass failed to zap dead operands to
selects with a constant condition. This resulted in the operands
remaining live through the SROA rewriter. Most of the time, this just
caused some dead allocas to persist and get zapped by later passes, but
in one case found by Joerg, it caused a crash when we tried to *promote*
the alloca despite it having this dead use. We already have the
mechanisms in place to handle this, just wire select up to them.

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

12 years agoAdd an --enable-backtraces option to configure to determine
Eric Christopher [Fri, 21 Sep 2012 23:03:29 +0000 (23:03 +0000)]
Add an --enable-backtraces option to configure to determine
whether or not we want to print out backtrace information. Useful
for libraries that don't need backtrace information on a crash.

rdar://11844710

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

12 years agoAdd an MDBuilder utility for creating !tbaa.struct nodes.
Dan Gohman [Fri, 21 Sep 2012 23:00:37 +0000 (23:00 +0000)]
Add an MDBuilder utility for creating !tbaa.struct nodes.

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

12 years ago[CMake] Respect LLVM_BUILD_RUNTIME.
Michael J. Spencer [Fri, 21 Sep 2012 22:49:06 +0000 (22:49 +0000)]
[CMake] Respect LLVM_BUILD_RUNTIME.

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

12 years ago[ms-inline asm] Expose the mnemonicIsValid() function in the AsmParser.
Chad Rosier [Fri, 21 Sep 2012 22:21:26 +0000 (22:21 +0000)]
[ms-inline asm] Expose the mnemonicIsValid() function in the AsmParser.

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

12 years agoHave the DbgVariable "isArtificial" and "isObjectPointer" not
Eric Christopher [Fri, 21 Sep 2012 22:18:52 +0000 (22:18 +0000)]
Have the DbgVariable "isArtificial" and "isObjectPointer" not
care about it being an argument variable so that we can decide
that captured block and lambda vars that don't happen to
be arguments could be an argument pointer.

Add the object pointer for one case onto the subprogram die.

rdar://12001329

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

12 years agoAdd comment.
Chad Rosier [Fri, 21 Sep 2012 21:08:46 +0000 (21:08 +0000)]
Add comment.

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

12 years agoAdd comment.
Chad Rosier [Fri, 21 Sep 2012 20:51:43 +0000 (20:51 +0000)]
Add comment.

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

12 years agoFix a significant recent(?) regression. StackSlotColoring no longer did anything
Evan Cheng [Fri, 21 Sep 2012 20:04:28 +0000 (20:04 +0000)]
Fix a significant recent(?) regression. StackSlotColoring no longer did anything
because LiveStackAnalysis was not preserved by VirtRegWriter. This caused
big stack usage regression in some cases.

rdar://12340383

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

12 years agodocs: Fix long-standing typo in yaml2obj.rst.
Sean Silva [Fri, 21 Sep 2012 19:48:16 +0000 (19:48 +0000)]
docs: Fix long-standing typo in yaml2obj.rst.

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

12 years agoWhitespace.
Chad Rosier [Fri, 21 Sep 2012 19:25:59 +0000 (19:25 +0000)]
Whitespace.

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

12 years agoSay "bytes" instead of "address units", since that's what the
Dan Gohman [Fri, 21 Sep 2012 18:41:30 +0000 (18:41 +0000)]
Say "bytes" instead of "address units", since that's what the
rest of LangRef uses.

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

12 years agoDocument the new !tbaa.struct metadata.
Dan Gohman [Fri, 21 Sep 2012 18:21:48 +0000 (18:21 +0000)]
Document the new !tbaa.struct metadata.

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

12 years agoAdd missing 'to' and rephrase an explanation of GCC's assumptions.
David Blaikie [Fri, 21 Sep 2012 18:03:02 +0000 (18:03 +0000)]
Add missing 'to' and rephrase an explanation of GCC's assumptions.

Wordsmithing by Matt Beaumont-Gay in response to r164389.

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

12 years agoDocument "do not use defaults in covered switch-over-enum" coding standard.
David Blaikie [Fri, 21 Sep 2012 17:47:36 +0000 (17:47 +0000)]
Document "do not use defaults in covered switch-over-enum" coding standard.

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

12 years agoLoopIdiom: Give up when the loop is not in canonical form.
Benjamin Kramer [Fri, 21 Sep 2012 17:27:23 +0000 (17:27 +0000)]
LoopIdiom: Give up when the loop is not in canonical form.

We rely on it when doing the transforms. This can happen when there is an
indirectbr in  the loop.

Fixes PR13892.

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

12 years ago[fast-isel] Fallback to SelectionDAG isel if we require strict alignment for
Chad Rosier [Fri, 21 Sep 2012 16:58:35 +0000 (16:58 +0000)]
[fast-isel] Fallback to SelectionDAG isel if we require strict alignment for
non-aligned i32 loads/stores.
rdar://12304911

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

12 years agoInstCombine: Make sure we use the pre-zext type when creating a constant of a value...
Benjamin Kramer [Fri, 21 Sep 2012 16:26:41 +0000 (16:26 +0000)]
InstCombine: Make sure we use the pre-zext type when creating a constant of a value that is zext'd.

Fixes PR13250.

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

12 years agoEncapsulate the "construct*AlignmentFromInt" functions.
Bill Wendling [Fri, 21 Sep 2012 16:07:28 +0000 (16:07 +0000)]
Encapsulate the "construct*AlignmentFromInt" functions.

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

12 years agoFix a typo in r164357
Michael Liao [Fri, 21 Sep 2012 16:03:03 +0000 (16:03 +0000)]
Fix a typo in r164357

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

12 years agoClarify comment.
Dmitri Gribenko [Fri, 21 Sep 2012 15:26:34 +0000 (15:26 +0000)]
Clarify comment.

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

12 years agoMake the 'get*AlignmentFromAttr' functions into member functions within the Attribute...
Bill Wendling [Fri, 21 Sep 2012 15:26:31 +0000 (15:26 +0000)]
Make the 'get*AlignmentFromAttr' functions into member functions within the Attributes class. Now with fix.

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

12 years agoBitcodeReader: Correctly insert blockaddress constant referring to a already parsed...
Benjamin Kramer [Fri, 21 Sep 2012 14:34:31 +0000 (14:34 +0000)]
BitcodeReader: Correctly insert blockaddress constant referring to a already parsed function.

We inserted a placeholder that was never replaced because the function was
already visited. Assert that all placeholders have been resolved when tearing
down the bitcode reader.

Fixes PR13895.

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

12 years agoFix SymbolRef::getAddress implementation for ELF. The 'value' field in symbol table...
Alexey Samsonov [Fri, 21 Sep 2012 07:08:08 +0000 (07:08 +0000)]
Fix SymbolRef::getAddress implementation for ELF. The 'value' field in symbol table entry should be treated differently for relocatable and relocated files. This patch fixes symbol addresses printed by llvm-nm for executables and shared objects.

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

12 years agollvm/test/CodeGen/X86/pr5145.ll: Tweak expressions to match for darwin target.
NAKAMURA Takumi [Fri, 21 Sep 2012 05:19:19 +0000 (05:19 +0000)]
llvm/test/CodeGen/X86/pr5145.ll: Tweak expressions to match for darwin target.

.LBB0_1: # Linux
LBB0_1:  # Darwin

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

12 years agoCortex-A9 latency fixes (w/ -schedmodel only).
Andrew Trick [Fri, 21 Sep 2012 05:06:40 +0000 (05:06 +0000)]
Cortex-A9 latency fixes (w/ -schedmodel only).

Quick review against the manual revealed a few obvious mistakes.

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

12 years agoAdd missing i8 max/min/umax/umin support
Michael Liao [Fri, 21 Sep 2012 03:18:52 +0000 (03:18 +0000)]
Add missing i8 max/min/umax/umin support

- Fix PR5145 and turn on test 8-bit atomic ops

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

12 years agoRevise td of X86 atomic instructions
Michael Liao [Fri, 21 Sep 2012 03:00:17 +0000 (03:00 +0000)]
Revise td of X86 atomic instructions

- Rewirte most atomic instructions in templates for both better
  maintenance and future extensions, such as HLE in TSX.

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

12 years agodocs: Fix Sphinx warning over Atomics.rst.
Sean Silva [Fri, 21 Sep 2012 02:46:32 +0000 (02:46 +0000)]
docs: Fix Sphinx warning over Atomics.rst.

Atomics.rst was not linked into the toctree.

Docs now build warning-free!

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

12 years agodocs: Fix Sphinx warning over yaml2obj.rst.
Sean Silva [Fri, 21 Sep 2012 02:46:30 +0000 (02:46 +0000)]
docs: Fix Sphinx warning over yaml2obj.rst.

yaml2obj.rst was not included in the toctree

Input from Michael Spencer.

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