oota-llvm.git
13 years agoMcARM: Add a variety of asserts on the sanity of memory operands.
Daniel Dunbar [Tue, 18 Jan 2011 05:34:05 +0000 (05:34 +0000)]
McARM: Add a variety of asserts on the sanity of memory operands.

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

13 years agoMcARM: Use a consistent marker for not-set OffsetRegNum.
Daniel Dunbar [Tue, 18 Jan 2011 05:33:57 +0000 (05:33 +0000)]
McARM: Use a consistent marker for not-set OffsetRegNum.

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

13 years agoConvert a std::map to a DenseMap for another 1.7% speedup on -scalarrepl.
Cameron Zwarich [Tue, 18 Jan 2011 04:50:38 +0000 (04:50 +0000)]
Convert a std::map to a DenseMap for another 1.7% speedup on -scalarrepl.

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

13 years agoMake a std::vector a SmallVector<*, 32> like the other vectors in the same
Cameron Zwarich [Tue, 18 Jan 2011 04:41:32 +0000 (04:41 +0000)]
Make a std::vector a SmallVector<*, 32> like the other vectors in the same
function. This seems to be about a 1.5% speedup of -scalarrepl on test-suite
with SPEC2000 and SPEC2006.

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

13 years agoReduce indentation and remove commented out code.
Rafael Espindola [Tue, 18 Jan 2011 04:36:06 +0000 (04:36 +0000)]
Reduce indentation and remove commented out code.

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

13 years agoRemove some now-unused DominanceFrontier methods.
Cameron Zwarich [Tue, 18 Jan 2011 04:21:57 +0000 (04:21 +0000)]
Remove some now-unused DominanceFrontier methods.

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

13 years agoRemove code for updating dominance frontiers and some outdated references to
Cameron Zwarich [Tue, 18 Jan 2011 04:11:31 +0000 (04:11 +0000)]
Remove code for updating dominance frontiers and some outdated references to
dominance and post-dominance frontiers.

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

13 years agoRemove outdated references to dominance frontiers.
Cameron Zwarich [Tue, 18 Jan 2011 03:53:26 +0000 (03:53 +0000)]
Remove outdated references to dominance frontiers.

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

13 years agoMcARM: Start marking T2 address operands as such, for the benefit of the parser.
Daniel Dunbar [Tue, 18 Jan 2011 03:06:03 +0000 (03:06 +0000)]
McARM: Start marking T2 address operands as such, for the benefit of the parser.

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

13 years agoFormatting tweak.
Daniel Dunbar [Tue, 18 Jan 2011 01:59:30 +0000 (01:59 +0000)]
Formatting tweak.

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

13 years agoSupport/CommandLine: Add "Did you mean" print for mismatched operands.
Daniel Dunbar [Tue, 18 Jan 2011 01:59:24 +0000 (01:59 +0000)]
Support/CommandLine: Add "Did you mean" print for mismatched operands.

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

13 years agoThe stub routine that we're calling uses test and so clobbers
Eric Christopher [Tue, 18 Jan 2011 01:37:20 +0000 (01:37 +0000)]
The stub routine that we're calling uses test and so clobbers
the flags.

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

13 years agominor change to rafael's recent patches: if something is
Chris Lattner [Tue, 18 Jan 2011 01:23:44 +0000 (01:23 +0000)]
minor change to rafael's recent patches: if something is
constant but requires a unique address, we can still put it in a
readonly section, just not a mergable one.

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

13 years agoRemove unused variables found by gcc-4.6's -Wunused-but-set-variable.
Jeffrey Yasskin [Tue, 18 Jan 2011 00:51:23 +0000 (00:51 +0000)]
Remove unused variables found by gcc-4.6's -Wunused-but-set-variable.

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

13 years agoRemove checking that prevented overlapping CALLSEQ_START/CALLSEQ_END
Stuart Hastings [Tue, 18 Jan 2011 00:09:27 +0000 (00:09 +0000)]
Remove checking that prevented overlapping CALLSEQ_START/CALLSEQ_END
ranges, add legalizer support for nested calls.  Necessary for ARM
byval support.  Radar 7662569.

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

13 years agoWindows/PathV2.inc: For CryptAcquireContext(), CRYPT_VERIFYCONTEXT may be specified...
NAKAMURA Takumi [Mon, 17 Jan 2011 22:41:34 +0000 (22:41 +0000)]
Windows/PathV2.inc: For CryptAcquireContext(), CRYPT_VERIFYCONTEXT may be specified for easy use.

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

13 years agoWindows/PathV2.inc: MoveFileEx() can behave like Posix's mv(1) to specify MOVEFILE_CO...
NAKAMURA Takumi [Mon, 17 Jan 2011 22:41:25 +0000 (22:41 +0000)]
Windows/PathV2.inc: MoveFileEx() can behave like Posix's mv(1) to specify MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING.

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

13 years agolib/Support/Windows/Signals.inc: "Showstopper" dialogs may be suppressed with SetErro...
NAKAMURA Takumi [Mon, 17 Jan 2011 22:41:15 +0000 (22:41 +0000)]
lib/Support/Windows/Signals.inc: "Showstopper" dialogs may be suppressed with SetErrorMode() on Windows 7.

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

13 years agoRemove dead code, that I apparently wrote a while back. We seem to be doing well...
Owen Anderson [Mon, 17 Jan 2011 22:39:54 +0000 (22:39 +0000)]
Remove dead code, that I apparently wrote a while back.  We seem to be doing well enough
without whatever this was trying to do.  When/if someone has the time to do some empirical
evaluations, it might be worth it to figure out what this code was trying to do and see if
it's worth resurrecting/fixing.

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

13 years agoAdd a missing <cctype> include, from Joerg Sonnenberger!
Douglas Gregor [Mon, 17 Jan 2011 19:17:01 +0000 (19:17 +0000)]
Add a missing <cctype> include, from Joerg Sonnenberger!

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

13 years agoTrailing whitespace.
Jim Grosbach [Mon, 17 Jan 2011 18:34:03 +0000 (18:34 +0000)]
Trailing whitespace.

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

13 years agoFix an off-by-one error in ctpop combining.
Benjamin Kramer [Mon, 17 Jan 2011 18:00:28 +0000 (18:00 +0000)]
Fix an off-by-one error in ctpop combining.

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

13 years agoUpdate tests to accomodate unnamed_addr introduction.
Devang Patel [Mon, 17 Jan 2011 17:54:17 +0000 (17:54 +0000)]
Update tests to accomodate unnamed_addr introduction.

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

13 years agoRoll r123609 back in with two changes that fix test failures with expensive
Cameron Zwarich [Mon, 17 Jan 2011 17:38:41 +0000 (17:38 +0000)]
Roll r123609 back in with two changes that fix test failures with expensive
checks enabled:

1) Use '<' to compare integers in a comparison function rather than '<='.

2) Use the uniqued set DefBlocks rather than Info.DefiningBlocks to initialize
the priority queue.

The speedup of scalarrepl on test-suite + SPEC2000 + SPEC2006 is a bit less, at
just under 16% rather than 17%.

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

13 years agoRevert rr123550. It causes clang build failure on darwin9.
Devang Patel [Mon, 17 Jan 2011 17:34:43 +0000 (17:34 +0000)]
Revert rr123550. It causes clang build failure on darwin9.

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

13 years agoArchive: Fix temp path names.
Michael J. Spencer [Mon, 17 Jan 2011 16:43:30 +0000 (16:43 +0000)]
Archive: Fix temp path names.

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

13 years agoAdd some platform checks. Also fix a typo on a Makefile.
Oscar Fuentes [Mon, 17 Jan 2011 16:35:14 +0000 (16:35 +0000)]
Add some platform checks. Also fix a typo on a Makefile.

Patch by arrowdodger!

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

13 years agoSupport/raw_ostream: Fix uninitalized variable in raw_fd_ostream constructor.
Michael J. Spencer [Mon, 17 Jan 2011 15:53:12 +0000 (15:53 +0000)]
Support/raw_ostream: Fix uninitalized variable in raw_fd_ostream constructor.

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

13 years agoRemove useless Tag enumeration.
Jay Foad [Mon, 17 Jan 2011 15:18:06 +0000 (15:18 +0000)]
Remove useless Tag enumeration.

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

13 years agoSplit up RotateShift itinerary in SPU.
Kalle Raiskila [Mon, 17 Jan 2011 13:33:19 +0000 (13:33 +0000)]
Split up RotateShift itinerary in SPU.
'rotq*' and 'shlq*' instructions go to the odd pipeline,
wheras the inter-vector equivalents 'rot*', 'shl*' go
to the even.

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

13 years agoAdd a DAGCombine to turn (ctpop x) u< 2 into (x & x-1) == 0.
Benjamin Kramer [Mon, 17 Jan 2011 12:04:57 +0000 (12:04 +0000)]
Add a DAGCombine to turn (ctpop x) u< 2 into (x & x-1) == 0.

This shaves off 4 popcounts from the hacked 186.crafty source.

This is enabled even when a native popcount instruction is available. The
combined code is one operation longer but it should be faster nevertheless.

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

13 years agoDon't crash SPU BE with memory accesses with big alignmnet.
Kalle Raiskila [Mon, 17 Jan 2011 11:59:20 +0000 (11:59 +0000)]
Don't crash SPU BE with memory accesses with big alignmnet.

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

13 years agoMaterialize GA addresses with movw + movt pairs for Darwin in PIC mode. e.g.
Evan Cheng [Mon, 17 Jan 2011 08:03:18 +0000 (08:03 +0000)]
Materialize GA addresses with movw + movt pairs for Darwin in PIC mode. e.g.
        movw    r0, :lower16:(L_foo$non_lazy_ptr-(LPC0_0+4))
        movt    r0, :upper16:(L_foo$non_lazy_ptr-(LPC0_0+4))
LPC0_0:
        add     r0, pc, r0

It's not yet enabled by default as some tests are failing. I suspect bugs in
down stream tools.

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

13 years agoRoll out r123609 due to failures on the llvm-x86_64-linux-checks bot.
Cameron Zwarich [Mon, 17 Jan 2011 07:26:51 +0000 (07:26 +0000)]
Roll out r123609 due to failures on the llvm-x86_64-linux-checks bot.

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

13 years agoSuppress warning "switch statement contains 'default' but no 'case' labels" on MSVC.
Francois Pichet [Mon, 17 Jan 2011 02:07:17 +0000 (02:07 +0000)]
Suppress warning "switch statement contains 'default' but no 'case' labels" on MSVC.

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

13 years agoEliminate the use of dominance frontiers in PromoteMemToReg. In addition to
Cameron Zwarich [Mon, 17 Jan 2011 01:08:59 +0000 (01:08 +0000)]
Eliminate the use of dominance frontiers in PromoteMemToReg. In addition to
eliminating a potentially quadratic data structure, this also gives a 17%
speedup when running -scalarrepl on test-suite + SPEC2000 + SPEC2006. My initial
experiment gave a greater speedup around 25%, but I moved the dominator tree
level computation from dominator tree construction to PromoteMemToReg.

Since this approach to computing IDFs has a much lower overhead than the old
code using precomputed DFs, it is worth looking at using this new code for the
second scalarrepl pass as well.

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

13 years agoUnRevert "Revert "Archive: Replace all internal uses of PathV1 with PathV2. The exter...
Michael J. Spencer [Sun, 16 Jan 2011 23:39:59 +0000 (23:39 +0000)]
UnRevert "Revert "Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.""

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

13 years agoFix rename.
Michael J. Spencer [Sun, 16 Jan 2011 22:18:41 +0000 (22:18 +0000)]
Fix rename.

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

13 years agoTest for lazy value info's ability to prove the absense of NULLs in pointers.
Nick Lewycky [Sun, 16 Jan 2011 21:57:20 +0000 (21:57 +0000)]
Test for lazy value info's ability to prove the absense of NULLs in pointers.

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

13 years agoMake everyone happy this time.
Michael J. Spencer [Sun, 16 Jan 2011 21:34:34 +0000 (21:34 +0000)]
Make everyone happy this time.

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

13 years agoProvide instruction sizes for ARMv5 variants of MUL instructions.
Anton Korobeynikov [Sun, 16 Jan 2011 21:28:33 +0000 (21:28 +0000)]
Provide instruction sizes for ARMv5 variants of MUL instructions.
This fixes PR8987

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

13 years agoUpdate README.txt to remove the DAE enhancement.
Anders Carlsson [Sun, 16 Jan 2011 21:26:15 +0000 (21:26 +0000)]
Update README.txt to remove the DAE enhancement.

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

13 years agoTeach DAE to look for functions whose arguments are unused, and change all callers...
Anders Carlsson [Sun, 16 Jan 2011 21:25:33 +0000 (21:25 +0000)]
Teach DAE to look for functions whose arguments are unused, and change all callers to pass in an undefvalue instead.

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

13 years agoUnRevert "Revert the archive part of "Support/PathV2: Add identify_magic.""
Michael J. Spencer [Sun, 16 Jan 2011 21:13:51 +0000 (21:13 +0000)]
UnRevert "Revert the archive part of "Support/PathV2: Add identify_magic.""

This reverts commit dd103021a889a986a181ce36ed7b0e8dc9b645e1.

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

13 years agoTry and fix this test. For some reason llvm-ar thinks that the file exists when
Michael J. Spencer [Sun, 16 Jan 2011 20:52:58 +0000 (20:52 +0000)]
Try and fix this test. For some reason llvm-ar thinks that the file exists when
it shouldn't, but I have no way to verify that it doesn't actually exist on the
buildbot.

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

13 years agoRevert the archive part of "Support/PathV2: Add identify_magic."
Michael J. Spencer [Sun, 16 Jan 2011 19:56:42 +0000 (19:56 +0000)]
Revert the archive part of "Support/PathV2: Add identify_magic."

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

13 years agoUpdate tests.
Rafael Espindola [Sun, 16 Jan 2011 18:02:57 +0000 (18:02 +0000)]
Update tests.

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

13 years agotidy up a comment, as suggested by duncan
Chris Lattner [Sun, 16 Jan 2011 17:46:19 +0000 (17:46 +0000)]
tidy up a comment, as suggested by duncan

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

13 years agoOnly put unnamed_addr constants in mergeable sections. Fixes PR8297.
Rafael Espindola [Sun, 16 Jan 2011 17:19:34 +0000 (17:19 +0000)]
Only put unnamed_addr constants in mergeable sections. Fixes PR8297.

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

13 years agoDon't merge two constants if we care about the address of both.
Rafael Espindola [Sun, 16 Jan 2011 17:05:09 +0000 (17:05 +0000)]
Don't merge two constants if we care about the address of both.

This fixes the original testcase in PR8927. It also causes a clang
binary built with a patched clang to increase in size by 0.21%.

We can probably get some of the size back by writing a pass that
detects that a global never has its pointer compared and adds
unnamed_addr to it (maybe extend global opt). It is also possible that
there are some other cases clang could add unnamed_addr to.

I will investigate extending globalopt next.

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

13 years agoSimplify the construction and destruction of Uses. Simplify
Jay Foad [Sun, 16 Jan 2011 15:30:52 +0000 (15:30 +0000)]
Simplify the construction and destruction of Uses. Simplify
User::dropHungOffUses().

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

13 years agoReduce and merge testcases.
Owen Anderson [Sun, 16 Jan 2011 09:13:31 +0000 (09:13 +0000)]
Reduce and merge testcases.

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

13 years agofix PR8514, a bug where the "heroic" transformation of shift/and
Chris Lattner [Sun, 16 Jan 2011 08:48:11 +0000 (08:48 +0000)]
fix PR8514, a bug where the "heroic" transformation of shift/and
into and/shift would cause nodes to move around and a dangling pointer
to happen.  The code tried to avoid this with a HandleSDNode, but
got the details wrong.

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

13 years agoRemove unnecessary specialization OperandTraits<User>.
Jay Foad [Sun, 16 Jan 2011 08:23:16 +0000 (08:23 +0000)]
Remove unnecessary specialization OperandTraits<User>.

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

13 years agoMove the implementation of the User class into a new source file,
Jay Foad [Sun, 16 Jan 2011 08:10:57 +0000 (08:10 +0000)]
Move the implementation of the User class into a new source file,
User.cpp.

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

13 years agofix PR8932, a case where arg promotion could infinitely promote.
Chris Lattner [Sun, 16 Jan 2011 08:09:24 +0000 (08:09 +0000)]
fix PR8932, a case where arg promotion could infinitely promote.

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

13 years agosimplify a little
Chris Lattner [Sun, 16 Jan 2011 07:11:21 +0000 (07:11 +0000)]
simplify a little

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

13 years agoadd some commentary
Chris Lattner [Sun, 16 Jan 2011 06:39:44 +0000 (06:39 +0000)]
add some commentary

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

13 years agoif an alloca is only ever accessed as a unit, and is accessed with load/store instruc...
Chris Lattner [Sun, 16 Jan 2011 06:18:28 +0000 (06:18 +0000)]
if an alloca is only ever accessed as a unit, and is accessed with load/store instructions,
then don't try to decimate it into its individual pieces.  This will just make a mess of the
IR and is pointless if none of the elements are individually accessed.  This was generating
really terrible code for std::bitset (PR8980) because it happens to be lowered by clang
as an {[8 x i8]} structure instead of {i64}.

The testcase now is optimized to:

define i64 @test2(i64 %X) {
  br label %L2

L2:                                               ; preds = %0
  ret i64 %X
}

before we generated:

define i64 @test2(i64 %X) {
  %sroa.store.elt = lshr i64 %X, 56
  %1 = trunc i64 %sroa.store.elt to i8
  %sroa.store.elt8 = lshr i64 %X, 48
  %2 = trunc i64 %sroa.store.elt8 to i8
  %sroa.store.elt9 = lshr i64 %X, 40
  %3 = trunc i64 %sroa.store.elt9 to i8
  %sroa.store.elt10 = lshr i64 %X, 32
  %4 = trunc i64 %sroa.store.elt10 to i8
  %sroa.store.elt11 = lshr i64 %X, 24
  %5 = trunc i64 %sroa.store.elt11 to i8
  %sroa.store.elt12 = lshr i64 %X, 16
  %6 = trunc i64 %sroa.store.elt12 to i8
  %sroa.store.elt13 = lshr i64 %X, 8
  %7 = trunc i64 %sroa.store.elt13 to i8
  %8 = trunc i64 %X to i8
  br label %L2

L2:                                               ; preds = %0
  %9 = zext i8 %1 to i64
  %10 = shl i64 %9, 56
  %11 = zext i8 %2 to i64
  %12 = shl i64 %11, 48
  %13 = or i64 %12, %10
  %14 = zext i8 %3 to i64
  %15 = shl i64 %14, 40
  %16 = or i64 %15, %13
  %17 = zext i8 %4 to i64
  %18 = shl i64 %17, 32
  %19 = or i64 %18, %16
  %20 = zext i8 %5 to i64
  %21 = shl i64 %20, 24
  %22 = or i64 %21, %19
  %23 = zext i8 %6 to i64
  %24 = shl i64 %23, 16
  %25 = or i64 %24, %22
  %26 = zext i8 %7 to i64
  %27 = shl i64 %26, 8
  %28 = or i64 %27, %25
  %29 = zext i8 %8 to i64
  %30 = or i64 %29, %28
  ret i64 %30
}

In this case, instcombine was able to eliminate the nonsense, but in PR8980 enough
PHIs are in play that instcombine backs off.  It's better to not generate this stuff
in the first place.

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

13 years agoUse an irbuilder to get some trivial constant folding when doing a store
Chris Lattner [Sun, 16 Jan 2011 05:58:24 +0000 (05:58 +0000)]
Use an irbuilder to get some trivial constant folding when doing a store
of a constant.

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

13 years agoremove a dead check, this was needed before we had an explicit veto on uses of phis.
Chris Lattner [Sun, 16 Jan 2011 05:37:55 +0000 (05:37 +0000)]
remove a dead check, this was needed before we had an explicit veto on uses of phis.

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

13 years agoenhance FoldOpIntoPhi in instcombine to try harder when a phi has
Chris Lattner [Sun, 16 Jan 2011 05:28:59 +0000 (05:28 +0000)]
enhance FoldOpIntoPhi in instcombine to try harder when a phi has
multiple uses.  In some cases, all the uses are the same operation,
so instcombine can go ahead and promote the phi.  In the testcase
this pushes an add out of the loop.

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

13 years agoSpill R4 if it's going to be used to restore SP from FP.
Evan Cheng [Sun, 16 Jan 2011 05:14:33 +0000 (05:14 +0000)]
Spill R4 if it's going to be used to restore SP from FP.

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

13 years agoremove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false in the
Chris Lattner [Sun, 16 Jan 2011 05:14:26 +0000 (05:14 +0000)]
remove the AllowAggressive argument to FoldOpIntoPhi.  It is forced to false in the
first line of the function because it isn't a good idea, even for compares.

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

13 years agomore cleanups: use the IR builder.
Chris Lattner [Sun, 16 Jan 2011 05:08:00 +0000 (05:08 +0000)]
more cleanups: use the IR builder.

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

13 years agotidy up code.
Chris Lattner [Sun, 16 Jan 2011 04:37:29 +0000 (04:37 +0000)]
tidy up code.

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

13 years agoImprove the safety of my globalopt enhancement by ensuring that the bitcast
Owen Anderson [Sun, 16 Jan 2011 04:33:33 +0000 (04:33 +0000)]
Improve the safety of my globalopt enhancement by ensuring that the bitcast
of the stored value to the new store type is always.  Also, add a testcase.

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

13 years agofix PR8983, a broken assertion.
Chris Lattner [Sun, 16 Jan 2011 03:43:53 +0000 (03:43 +0000)]
fix PR8983, a broken assertion.

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

13 years agoImplement AnalyzeBranch in Sparc Backend.
Venkatraman Govindaraju [Sun, 16 Jan 2011 03:15:11 +0000 (03:15 +0000)]
Implement AnalyzeBranch in Sparc Backend.

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

13 years agofix PR8981, a crash trying to form a conditional inc with a floating point compare.
Chris Lattner [Sun, 16 Jan 2011 02:56:53 +0000 (02:56 +0000)]
fix PR8981, a crash trying to form a conditional inc with a floating point compare.

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

13 years agoreapply my fix for PR8961 with a tweak to properly handle
Chris Lattner [Sun, 16 Jan 2011 02:27:38 +0000 (02:27 +0000)]
reapply my fix for PR8961 with a tweak to properly handle
multi-instruction sequences like calls.  Many thanks to Jakob for
finding a testcase.

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

13 years agosimplify this code, it is still broken but will follow up on llvm-commits.
Chris Lattner [Sun, 16 Jan 2011 02:05:10 +0000 (02:05 +0000)]
simplify this code, it is still broken but will follow up on llvm-commits.

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

13 years agoRevert "Archive: Replace all internal uses of PathV1 with PathV2. The external API...
Michael J. Spencer [Sun, 16 Jan 2011 01:43:22 +0000 (01:43 +0000)]
Revert "Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1."

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

13 years agoSimplify a README.txt entry significantly to expose the core issue.
Chandler Carruth [Sun, 16 Jan 2011 01:40:23 +0000 (01:40 +0000)]
Simplify a README.txt entry significantly to expose the core issue.

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

13 years agoone of michael's recent patches broke this, temporarily disable
Chris Lattner [Sun, 16 Jan 2011 01:04:49 +0000 (01:04 +0000)]
one of michael's recent patches broke this, temporarily disable
it so the bots go green

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

13 years agoremove the partial specialization pass. It is unmaintained and has bugs.
Chris Lattner [Sun, 16 Jan 2011 00:27:10 +0000 (00:27 +0000)]
remove the partial specialization pass.  It is unmaintained and has bugs.

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

13 years agoArchive: Fix spelling.
Michael J. Spencer [Sat, 15 Jan 2011 21:43:45 +0000 (21:43 +0000)]
Archive: Fix spelling.

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

13 years agoArchive: Replace all internal uses of PathV1 with PathV2. The external API still...
Michael J. Spencer [Sat, 15 Jan 2011 21:43:37 +0000 (21:43 +0000)]
Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.

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

13 years agoSupport/GraphWriter: Replace all internal uses of PathV1 with PathV2. The external...
Michael J. Spencer [Sat, 15 Jan 2011 21:43:25 +0000 (21:43 +0000)]
Support/GraphWriter: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.

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

13 years agoAdd an assert so we don't silently miscompile ctpop for bit widths > 128.
Benjamin Kramer [Sat, 15 Jan 2011 21:19:37 +0000 (21:19 +0000)]
Add an assert so we don't silently miscompile ctpop for bit widths > 128.

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

13 years agoSupport/PathV2: Add identify_magic.
Michael J. Spencer [Sat, 15 Jan 2011 20:39:36 +0000 (20:39 +0000)]
Support/PathV2: Add identify_magic.

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

13 years agoReimplement CTPOP legalization with the "best" algorithm from
Benjamin Kramer [Sat, 15 Jan 2011 20:30:30 +0000 (20:30 +0000)]
Reimplement CTPOP legalization with the "best" algorithm from
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel

In a silly microbenchmark on a 65 nm core2 this is 1.5x faster than the old
code in 32 bit mode and about 2x faster in 64 bit mode. It's also a lot shorter,
especially when counting 64 bit population on a 32 bit target.

I hope this is fast enough to replace Kernighan-style counting loops even when
the input is rather sparse.

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

13 years agoUnittests/Support/Path: Tweak test.
Michael J. Spencer [Sat, 15 Jan 2011 18:52:49 +0000 (18:52 +0000)]
Unittests/Support/Path: Tweak test.

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

13 years agoSupport/PathV2: Implement has_magic in terms of get_magic.
Michael J. Spencer [Sat, 15 Jan 2011 18:52:41 +0000 (18:52 +0000)]
Support/PathV2: Implement has_magic in terms of get_magic.

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

13 years agoSupport/PathV2: Implement get_magic.
Michael J. Spencer [Sat, 15 Jan 2011 18:52:33 +0000 (18:52 +0000)]
Support/PathV2: Implement get_magic.

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

13 years agoAdd missing whitespace.
Nick Lewycky [Sat, 15 Jan 2011 18:42:52 +0000 (18:42 +0000)]
Add missing whitespace.

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

13 years agoMake constmerge a two-pass algorithm so that it won't miss merging
Nick Lewycky [Sat, 15 Jan 2011 18:14:21 +0000 (18:14 +0000)]
Make constmerge a two-pass algorithm so that it won't miss merging
opporuntities. Fixes PR8978.

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

13 years agoMake config.h.cmake similar to config.h.in
Oscar Fuentes [Sat, 15 Jan 2011 13:35:37 +0000 (13:35 +0000)]
Make config.h.cmake similar to config.h.in

Patch by arrowdodger!

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

13 years agoTry to unbreak selfhost.
Benjamin Kramer [Sat, 15 Jan 2011 11:25:34 +0000 (11:25 +0000)]
Try to unbreak selfhost.

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

13 years agoAdd a cache that protects mergefunc's internals from more surprises in DenseSet.
Nick Lewycky [Sat, 15 Jan 2011 10:16:23 +0000 (10:16 +0000)]
Add a cache that protects mergefunc's internals from more surprises in DenseSet.

Also, replace tabs with spaces. Yes, it's 2011.

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

13 years agoTeach LazyValueInfo that allocas aren't NULL. Over all of llvm-test, this saves
Nick Lewycky [Sat, 15 Jan 2011 09:16:12 +0000 (09:16 +0000)]
Teach LazyValueInfo that allocas aren't NULL. Over all of llvm-test, this saves
half a million non-local queries, each of which would otherwise have triggered a
linear scan over a basic block.

Also fix a fixme for memory intrinsics which dereference pointers. With this,
we prove that a pointer is non-null because it was dereferenced by an intrinsic
112 times in llvm-test.

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

13 years agoAdd a clarification about merging constants with and without unnamed_addr.
Rafael Espindola [Sat, 15 Jan 2011 08:20:57 +0000 (08:20 +0000)]
Add a clarification about merging constants with and without unnamed_addr.

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

13 years agoAllow unnamed_addr on declarations.
Rafael Espindola [Sat, 15 Jan 2011 08:15:00 +0000 (08:15 +0000)]
Allow unnamed_addr on declarations.

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

13 years agotemporarily revert r123526. While working on a follow-on patch I
Chris Lattner [Sat, 15 Jan 2011 07:51:19 +0000 (07:51 +0000)]
temporarily revert r123526.  While working on a follow-on patch I
realize that ConstantFoldTerminator doesn't preserve dominfo.

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

13 years agofix rdar://8785296 - -fcatch-undefined-behavior generates inefficient code
Chris Lattner [Sat, 15 Jan 2011 07:36:13 +0000 (07:36 +0000)]
fix rdar://8785296 - -fcatch-undefined-behavior generates inefficient code

The basic issue is that isel (very reasonably!) expects conditional branches
to be folded, so CGP leaving around a bunch dead computation feeding
conditional branches isn't such a good idea.  Just fold branches on constants
into unconditional branches.

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

13 years agosimplify code, no functionality change.
Chris Lattner [Sat, 15 Jan 2011 07:29:01 +0000 (07:29 +0000)]
simplify code, no functionality change.

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

13 years agoNow that instruction optzns can update the iterator as they go, we can
Chris Lattner [Sat, 15 Jan 2011 07:25:29 +0000 (07:25 +0000)]
Now that instruction optzns can update the iterator as they go, we can
have objectsize folding recursively simplify away their result when it
folds.  It is important to catch this here, because otherwise we won't
eliminate the cross-block values at isel and other times.

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

13 years agomake the current instruction iterator an ivar, allowing xforms that
Chris Lattner [Sat, 15 Jan 2011 07:14:54 +0000 (07:14 +0000)]
make the current instruction iterator an ivar, allowing xforms that
potentially invalidate it (like inline asm lowering) to be sunk into
their proper place, cleaning up a ton of code.

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

13 years agoimplement an instcombine xform that canonicalizes casts outside of and-with-constant...
Chris Lattner [Sat, 15 Jan 2011 06:32:33 +0000 (06:32 +0000)]
implement an instcombine xform that canonicalizes casts outside of and-with-constant operations.
This fixes rdar://8808586 which observed that we used to compile:

union xy {
        struct x { _Bool b[15]; } x;
        __attribute__((packed))
        struct y {
                __attribute__((packed)) unsigned long b0to7;
                __attribute__((packed)) unsigned int b8to11;
                __attribute__((packed)) unsigned short b12to13;
                __attribute__((packed)) unsigned char b14;
        } y;
};

struct x
foo(union xy *xy)
{
        return xy->x;
}

into:

_foo:                                   ## @foo
movq (%rdi), %rax
movabsq $1095216660480, %rcx    ## imm = 0xFF00000000
andq %rax, %rcx
movabsq $-72057594037927936, %rdx ## imm = 0xFF00000000000000
andq %rax, %rdx
movzbl %al, %esi
orq %rdx, %rsi
movq %rax, %rdx
andq $65280, %rdx            ## imm = 0xFF00
orq %rsi, %rdx
movq %rax, %rsi
andq $16711680, %rsi         ## imm = 0xFF0000
orq %rdx, %rsi
movl %eax, %edx
andl $-16777216, %edx        ## imm = 0xFFFFFFFFFF000000
orq %rsi, %rdx
orq %rcx, %rdx
movabsq $280375465082880, %rcx  ## imm = 0xFF0000000000
movq %rax, %rsi
andq %rcx, %rsi
orq %rdx, %rsi
movabsq $71776119061217280, %r8 ## imm = 0xFF000000000000
andq %r8, %rax
orq %rsi, %rax
movzwl 12(%rdi), %edx
movzbl 14(%rdi), %esi
shlq $16, %rsi
orl %edx, %esi
movq %rsi, %r9
shlq $32, %r9
movl 8(%rdi), %edx
orq %r9, %rdx
andq %rdx, %rcx
movzbl %sil, %esi
shlq $32, %rsi
orq %rcx, %rsi
movl %edx, %ecx
andl $-16777216, %ecx        ## imm = 0xFFFFFFFFFF000000
orq %rsi, %rcx
movq %rdx, %rsi
andq $16711680, %rsi         ## imm = 0xFF0000
orq %rcx, %rsi
movq %rdx, %rcx
andq $65280, %rcx            ## imm = 0xFF00
orq %rsi, %rcx
movzbl %dl, %esi
orq %rcx, %rsi
andq %r8, %rdx
orq %rsi, %rdx
ret

We now compile this into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
movzwl 12(%rdi), %eax
movzbl 14(%rdi), %ecx
shlq $16, %rcx
orl %eax, %ecx
shlq $32, %rcx
movl 8(%rdi), %edx
orq %rcx, %rdx
movq (%rdi), %rax
ret

A small improvement :-)

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

13 years agofix typo
Chris Lattner [Sat, 15 Jan 2011 06:27:35 +0000 (06:27 +0000)]
fix typo

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