oota-llvm.git
11 years agoAddress Duncan's comments on r164684:
Hans Wennborg [Wed, 26 Sep 2012 14:01:53 +0000 (14:01 +0000)]
Address Duncan's comments on r164684:

- Put statistics in alphabetical order
- Don't use getZextValue when building TableInt, just use APInts
- Introduce Create{Z,S}ExtOrTrunc in IRBuilder.

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

11 years agoAddress Duncan's comments on r164682:
Hans Wennborg [Wed, 26 Sep 2012 11:07:37 +0000 (11:07 +0000)]
Address Duncan's comments on r164682:

- Finish assert messages with exclamation mark
- Move overflow checking into ShouldBuildLookupTable.

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

11 years agoAnalogous fix to memset and memcpy rewriting. Don't have a test case
Chandler Carruth [Wed, 26 Sep 2012 10:59:22 +0000 (10:59 +0000)]
Analogous fix to memset and memcpy rewriting. Don't have a test case
contrived for these yet, as I spotted them by inspection and the test
cases are a bit more tricky to phrase.

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

11 years agoWhen rewriting the pointer operand to a load or store which has
Chandler Carruth [Wed, 26 Sep 2012 10:45:28 +0000 (10:45 +0000)]
When rewriting the pointer operand to a load or store which has
alignment guarantees attached, re-compute the alignment so that we
consider offsets which impact alignment.

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

11 years agoTeach all of the loads, stores, memsets and memcpys created by the
Chandler Carruth [Wed, 26 Sep 2012 10:27:46 +0000 (10:27 +0000)]
Teach all of the loads, stores, memsets and memcpys created by the
rewriter in SROA to carry a proper alignment. This involves
interrogating various sources of alignment, etc. This is a more complete
and principled fix to PR13920 as well as related bugs pointed out by Eli
in review and by inspection in the area.

Also by inspection fix the integer and vector promotion paths to create
aligned loads and stores. I still need to work up test cases for
these... Sorry for the delay, they were found purely by inspection.

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

11 years agoAdd some convenience methods to IRBuilder for constructing aligned loads
Chandler Carruth [Wed, 26 Sep 2012 10:27:40 +0000 (10:27 +0000)]
Add some convenience methods to IRBuilder for constructing aligned loads
and stores. These will be used in subsequnet patches to SROA to more
systematically manage the alignment on loads and stores.

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

11 years agoARM/atomicrmw_minmax.ll: Fix RUN line.
NAKAMURA Takumi [Wed, 26 Sep 2012 10:12:20 +0000 (10:12 +0000)]
ARM/atomicrmw_minmax.ll: Fix RUN line.

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

11 years agoFix tests that didn't test anything.
Benjamin Kramer [Wed, 26 Sep 2012 09:51:39 +0000 (09:51 +0000)]
Fix tests that didn't test anything.

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

11 years agoFix ordering of operands on lowering of atomicrmw min/max nodes on ARM.
James Molloy [Wed, 26 Sep 2012 09:48:32 +0000 (09:48 +0000)]
Fix ordering of operands on lowering of atomicrmw min/max nodes on ARM.

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

11 years agoSimplifyCFG: Make the switch-to-lookup table transformation store the
Hans Wennborg [Wed, 26 Sep 2012 09:44:49 +0000 (09:44 +0000)]
SimplifyCFG: Make the switch-to-lookup table transformation store the
tables in bitmaps when they fit in a target-legal register.

This saves some space, and it also allows for building tables that would
otherwise be deemed too sparse.

One interesting case that this hits is example 7 from
http://blog.regehr.org/archives/320. We currently generate good code
for this when lowering the switch to the selection DAG: we build a
bitmask to decide whether to jump to one block or the other. My patch
will result in the same bitmask, but it removes the need for the jump,
as the return value can just be retrieved from the mask.

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

11 years agoSimplifyCFG: Refactor the switch-to-lookup table transformation by
Hans Wennborg [Wed, 26 Sep 2012 09:34:53 +0000 (09:34 +0000)]
SimplifyCFG: Refactor the switch-to-lookup table transformation by
breaking out the building of lookup tables into a separate class.

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

11 years agollvm/test/CodeGen/X86/mulx*.ll: Fix copypasto.
NAKAMURA Takumi [Wed, 26 Sep 2012 09:24:12 +0000 (09:24 +0000)]
llvm/test/CodeGen/X86/mulx*.ll: Fix copypasto.

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

11 years agoThe assumption that /proc/self/exe always exists is incorrect.
Sylvestre Ledru [Wed, 26 Sep 2012 08:30:35 +0000 (08:30 +0000)]
The assumption that /proc/self/exe always exists is incorrect.
For example, under a Linux chroot, /proc/ might not be mounted.
Therefor, we test if this file exist. If it is the case, use it (the current
behavior). Otherwise, we fall back to the detection used by *BSD.

The issue has been reported initially on the Debian bug tracker:
http://bugs.debian.org/674588

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

11 years agoAdd SARX/SHRX/SHLX code generation support
Michael Liao [Wed, 26 Sep 2012 08:26:25 +0000 (08:26 +0000)]
Add SARX/SHRX/SHLX code generation support

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

11 years agoAdd RORX code generation support
Michael Liao [Wed, 26 Sep 2012 08:24:51 +0000 (08:24 +0000)]
Add RORX code generation support

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

11 years agoAdd MULX code generation support
Michael Liao [Wed, 26 Sep 2012 08:22:37 +0000 (08:22 +0000)]
Add MULX code generation support

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

11 years agoTeach the 'lint' sanity checking pass to detect simple buffer overflows.
Duncan Sands [Wed, 26 Sep 2012 07:45:36 +0000 (07:45 +0000)]
Teach the 'lint' sanity checking pass to detect simple buffer overflows.

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

11 years agoRevert r164663 due to buildbot failure.
Craig Topper [Wed, 26 Sep 2012 07:43:06 +0000 (07:43 +0000)]
Revert r164663 due to buildbot failure.

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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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

11 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