Commit Graph

8625 Commits

Author SHA1 Message Date
Sebastian Pop
1230ad6e8c fix indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149857 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-06 05:29:32 +00:00
Nick Lewycky
fad4d40f37 Teach GlobalOpt to handle atomic accesses to globals.
* Most of the transforms come through intact by having each transformed load or
store copy the ordering and synchronization scope of the original.
 * The transform that turns a global only accessed in main() into an alloca
(since main is non-recursive) with a store of the initial value uses an
unordered store, since it's guaranteed to be the first thing to happen in main.
(Threads may have started before main (!) but they can't have the address of a
function local before the point in the entry block we insert our code.)
 * The heap-SRoA transforms are disabled in the face of atomic operations. This
can probably be improved; it seems odd to have atomic accesses to an alloca
that doesn't have its address taken.

AnalyzeGlobal keeps track of the strongest ordering found in any use of the
global. This is more information than we need right now, but it's cheap to
compute and likely to be useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 19:56:38 +00:00
Nick Lewycky
bc384a1feb Clean up some whitespace and comments. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149845 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 19:48:37 +00:00
Duncan Sands
c4fd448712 Neaten up this method. Check that if there is only one
predecessor then it's Src.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149843 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 19:43:37 +00:00
Duncan Sands
87ba3f122b Fix a thinko pointed out by Eli and the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149839 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 18:56:50 +00:00
Duncan Sands
33756f96d7 Reduce the number of dom queries made by GVN's conditional propagation
logic by half: isOnlyReachableViaThisEdge was trying to be clever and
handle the case of a branch to a basic block which is contained in a
loop.  This costs a domtree lookup and is completely useless due to
GVN's position in the pass pipeline: all loops have preheaders at this
point, which means it is enough for isOnlyReachableViaThisEdge to check
that Dst has only one predecessor.  (I checked this theoretical argument
by running over the entire nightly testsuite, and indeed it is so!).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149838 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 18:25:50 +00:00
Duncan Sands
68e20223a7 Reduce the number of non-trivial domtree queries by about 1% when
compiling sqlite3, by only doing dom queries after the cheap check
rather than interleaved with it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149836 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 15:50:43 +00:00
David Blaikie
0b2500c504 Simplify contains tests using 'count'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149813 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 06:35:36 +00:00
NAKAMURA Takumi
5c05f2b99e BBVectorize.cpp: Get rid of comparision to bool to fix a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149810 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 05:47:51 +00:00
Chris Lattner
18c7f80b3e reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies
from strings into immediate stores: the previous code was stopping reading
string data at the first nul.  Address this by adding a new argument to
llvm::getConstantStringInfo, preserving the behavior before the patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149800 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 02:29:43 +00:00
Hal Finkel
edc8db87dc Boost the effective chain depth of loads and stores.
By default, boost the chain depth contribution of loads and stores. This will allow a load/store pair to vectorize even when it would not otherwise be long enough to satisfy the chain depth requirement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149761 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-04 04:14:04 +00:00
Jim Grosbach
871a2051f7 Narrow test further. Make bot and test happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 00:26:07 +00:00
Jim Grosbach
00e403abe3 Tidy up. Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 00:07:04 +00:00
Jim Grosbach
f374486659 Restrict InstCombine from converting varargs to or from fixed args.
More targetted fix replacing d0e277d272.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 00:00:55 +00:00
Jim Grosbach
d5917f0b4d Revert "Disable InstCombine unsafe folding bitcasts of calls w/ varargs."
This reverts commit d0e277d272.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149647 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 00:00:50 +00:00
Benjamin Kramer
ded681d272 BBVectorize: Simplify code, no functionality change.
Also silences warnings about bodyless for loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149612 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 18:52:15 +00:00
Hal Finkel
35564dc3ae Minor changes from review.
As suggested by Nick Lewycky, the tree traversal queues have been changed to SmallVectors and the associated loops have been rotated. Also, an 80-col violation was fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 17:29:39 +00:00
Hal Finkel
5d4e18bc39 Vectorize long blocks in groups.
Long basic blocks with many candidate pairs (such as in the SHA implementation in Perl 5.14; thanks to Roman Divacky for the example) used to take an unacceptably-long time to compile. Instead, break long blocks into groups so that no group has too many candidate pairs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149595 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 06:14:56 +00:00
Stepan Dyatkovskiy
24473120a2 SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 07:49:51 +00:00
NAKAMURA Takumi
478eed85f9 BBVectorize.cpp: Try to fix MSVC build. map::iterator and multimap::iterator are incompatible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149475 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 06:11:58 +00:00
Hal Finkel
7e004d177f A few of the changes suggested in code review (by Nick Lewycky)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149472 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 05:51:45 +00:00
Argyrios Kyrtzidis
91766fe066 Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
These are:

r149348
r149351
r149352
r149354
r149356
r149357
r149361
r149362
r149364
r149365

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149470 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 04:51:17 +00:00
Hal Finkel
de5e5ec304 Add a basic-block autovectorization pass.
This is the initial checkin of the basic-block autovectorization pass along with some supporting vectorization infrastructure.
Special thanks to everyone who helped review this code over the last several months (especially Tobias Grosser).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149468 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 03:51:43 +00:00
Jim Grosbach
d0e277d272 Disable InstCombine unsafe folding bitcasts of calls w/ varargs.
Changing arguments from being passed as fixed to varargs is unsafe, as
the ABI may require they be handled differently (stack vs. register, for
example).

Remove two tests which rely on the bitcast being folded into the direct
call, which is exactly the transformation that's unsafe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149457 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 00:08:17 +00:00
Lenny Maiorani
e0c7cfa723 bz11794 : EarlyCSE stack overflow on long functions.
Make the EarlyCSE optimizer not use recursion to do a depth first iteration.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149445 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 23:14:41 +00:00
Bill Wendling
b319f12727 Increase the initial vector size to be equivalent to the size of the Deps
vector. This potentially saves a resizing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 07:04:52 +00:00
Bill Wendling
5d8ab0f02b Cache the size of the vector instead of calling .size() all over the place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149368 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 06:57:53 +00:00
Chris Lattner
6a89228fac eliminate the "string" form of ConstantArray::get, using
ConstantDataArray::getString instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149365 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 06:18:43 +00:00
Chris Lattner
2cf07eccff eliminate the last uses of GetConstantStringInfo from this file, I didn't realize I was that close...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 04:54:27 +00:00
Chris Lattner
90f1d8a5da start moving SimplifyLibcalls over to getConstantStringInfo, which is
dramatically more efficient than GetConstantStringInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149352 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 04:43:11 +00:00
Chris Lattner
c8d75c78ec enhance logic to support ConstantDataArray.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 02:55:06 +00:00
Bill Wendling
13b1c31412 s/getInnerUnwindDest/getInnerResumeDest/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149328 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:48:40 +00:00
Bill Wendling
08d01462d1 Remove ivar which is identical to another ivar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149323 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:25:54 +00:00
Bill Wendling
4dbd9b8ebf Remove unused ivars and s/getOuterUnwindDest/getOuterResumeDest/g.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149322 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:22:03 +00:00
Bill Wendling
6e69442416 Remove more dead functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149318 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:18:21 +00:00
Bill Wendling
fd3adbb31a s/getInnerUnwindDestNewEH/getInnerUnwindDest/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149317 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:15:59 +00:00
Bill Wendling
9e9a34c568 Remove some unused, old-EH methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149316 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:14:49 +00:00
Bill Wendling
675f638869 Get rid of references to dead intrinsics.
The eh.selector and eh.resume intrinsics aren't used anymore. Get rid of some
calls to them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149314 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:05:20 +00:00
Bill Wendling
06881e8734 Formatting cleanups. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149312 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 01:01:16 +00:00
Bill Wendling
27b5658aff Remove no-longer-useful dyn_casts and pals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149307 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 00:56:53 +00:00
Kostya Serebryany
a1a8a323f4 [asan] fix the ObjC support (asan Issue #33)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149300 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30 23:50:10 +00:00
Chad Rosier
0cf6b99b96 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30 22:44:13 +00:00
Chad Rosier
431985a421 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149275 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30 21:13:22 +00:00
Alexander Potapenko
8375bc9236 Fix compilation of ASan tests on OS X Lion (see http://code.google.com/p/address-sanitizer/issues/detail?id=32)
The redzones emitted by AddressSanitizer for CFString instances confuse the linker and are of little use, so we shouldn't add them. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149243 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30 10:40:22 +00:00
Nick Lewycky
5fef01db01 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149185 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-28 23:33:44 +00:00
Kostya Serebryany
f1639abf1a [asan] correctly use ConstantExpr::getGetElementPtr. Catch by NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149172 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-28 04:27:16 +00:00
Chris Lattner
a78fa8cc2d continue making the world safe for ConstantDataVector. At this point,
we should (theoretically optimize and codegen ConstantDataVector as well
as ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149116 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-27 03:08:05 +00:00
Chris Lattner
d59ae907ee Continue improving support for ConstantDataAggregate, and use the
new methods recently added to (sometimes greatly!) simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149024 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-26 02:32:04 +00:00
Chris Lattner
230cdab220 some general cleanup, using new methods and tidying up old code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149006 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-26 00:42:34 +00:00
Nick Lewycky
6c00c6a181 Gracefully degrade precision in branch probability numbers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148946 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-25 09:43:14 +00:00