Commit Graph

9043 Commits

Author SHA1 Message Date
Rafael Espindola
f433e800a7 Constify some basic blocks, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161668 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 15:55:25 +00:00
Pete Cooper
3eeba88631 Fix crash when when do lto on Bullet. Dynamic GEPs in SROA were incorrectly being applied to all accesses to an alloca, not just the ones which read from the GEP. Thanks to Evan for reducing the test. rdar://11861001
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161654 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 03:26:36 +00:00
Eli Friedman
1b88fc0122 isAllocLikeFn is allowed to return true for functions which read memory; make
sure we account for that correctly in DeadStoreElimination.  Fixes a regression
from r158919.  PR13547.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161468 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 02:17:32 +00:00
Dan Gohman
9d1747c3cd Avoid recomputing the unique exit blocks and their insert points when doing
multiple scalar promotions on a single loop. This also has the effect of
preserving the order of stores sunk out of loops, which is aesthetically
pleasing, and it happens to fix the testcase in PR13542, though it doesn't
fix the underlying problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161459 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 00:00:26 +00:00
Bob Wilson
f12c95a8af Fix a serious typo in InstCombine's optimization of comparisons.
An unsigned value converted to floating-point will always be greater than
a negative constant.  Unfortunately InstCombine reversed the check so that
unsigned values were being optimized to always be greater than all positive
floating-point constants.  <rdar://problem/12029145>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 22:35:16 +00:00
Bill Wendling
573e973267 Move the "findUsedStructTypes" functionality outside of the Module class.
The "findUsedStructTypes" method is very expensive to run. It needs to be
optimized so that LTO can run faster. Splitting this method out of the Module
class will help this occur. For instance, it can keep a list of seen objects so
that it doesn't process them over and over again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161228 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03 00:30:35 +00:00
Nuno Lopes
918067d52b remove tabs from my previous commit.
Sorry, not used to this editor anymore.. XCode please come back; you're forgiven :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161120 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 17:13:28 +00:00
Nuno Lopes
28ad863f6c (hopefuly) fix the remaining cases where null wasnt expected (PR13497).
I'll commit a test to the clang tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161118 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 16:58:51 +00:00
Evan Cheng
9c777a4844 Teach CodeGenPrep to look past bitcast when it's duplicating return instruction
into predecessor blocks to enable tail call optimization.

rdar://11958338


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160894 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 21:21:26 +00:00
Nuno Lopes
75564e3514 fix infinite loop in instcombine in the presence of a (malformed) self-referencing select inst.
This can happen as long as the instruction is not reachable. Instcombine does generate these unreachable malformed selects when doing RAUW

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160874 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 18:03:57 +00:00
Pete Cooper
7971de4178 Simplify demanded bits of select sources where the condition is a constant vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160835 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 23:10:24 +00:00
Pete Cooper
1121c786fc Teach SimplifyDemandedBits how to look through fpext and fptrunc to simplify their operand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160823 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 22:37:04 +00:00
Nuno Lopes
cd31fc7986 do null checks for a few more Emit*() functions.
Thanks Eli for noticing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160787 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 17:10:46 +00:00
Duncan Sands
20b2d21509 Stop reassociate from looking through expressions of arbitrary complexity. This
is a temporary measure until my fix for PR13021 is ready.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160778 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 09:26:40 +00:00
Nick Lewycky
b8cd66b5d7 It's not safe to blindly remove invoke instructions. This happens when we
encounter an invoke of an allocation function. This should fix the dragonegg
bootstrap. Testcase to follow, later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160757 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 21:19:40 +00:00
Nuno Lopes
6e699bf38d revert r160742: it's breaking CMake build
original commit msg:
MemoryBuiltins: add support to determine the size of strdup'ed non-constant strings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160751 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 18:49:28 +00:00
Nuno Lopes
e3094283e3 MemoryBuiltins: add support to determine the size of strdup'ed non-constant strings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160742 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 17:29:22 +00:00
Nuno Lopes
a536835230 add EmitStrNLen()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160741 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 17:18:59 +00:00
Nuno Lopes
51004dff92 make all Emit*() functions consult the TargetLibraryInfo information before creating a call to a library function.
Update all clients to pass the TLI information around.
Previous draft reviewed by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160733 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 16:46:31 +00:00
Nick Lewycky
952f5d562c Don't delete one more instruction than we're allowed to. This should fix the
Darwin bootstrap. Testcase exists but isn't fully reduced, I expect to commit
the testcase this evening.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160693 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 21:33:00 +00:00
Nadav Rotem
a94d6e87c4 Clean whitespaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160668 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 10:51:42 +00:00
Nick Lewycky
8899d5c6fb Teach globalopt to not nuke all stores to globals. Keep them around of they
might be deliberate "one time" leaks, so that leak checkers can find them.
This is a reapply of r160602 with the fix that this time I'm committing the
code I thought I was committing last time; the I->eraseFromParent() goes
*after* the break out of the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 07:21:08 +00:00
Dan Gohman
c72d3be389 An objc_retain can serve as a may-use for a different pointer.
rdar://11931823.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160637 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 19:27:31 +00:00
Nadav Rotem
c1deb67d78 Suppress a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160629 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 13:44:15 +00:00
Sylvestre Ledru
c8e41c5917 Fix a typo (the the => the)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160621 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 08:51:15 +00:00
Chandler Carruth
9b4df49d39 Move the initialization of the bounds checking pass. The pass itself
moved earlier. This fixes some layering issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160611 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-22 05:19:32 +00:00
Nick Lewycky
c7088c9a9c Revert r160602.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160603 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 09:03:15 +00:00
Nick Lewycky
61e2ff8f82 Teach globalopt to play nice with leak checkers. This is a reapplication of
r160529 that was subsequently reverted. The fix was to not call
GV->eraseFromParent() right before the caller does the same. The existing
testcases already caught this bug if run under valgrind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160602 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 08:29:45 +00:00
Nuno Lopes
78435f6bb7 move the bounds checking pass to the instrumentation folder, where it belongs. I dunno why in the world I dropped it in the Scalar folder in the first place.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160587 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 22:39:33 +00:00
Richard Osborne
dd2fb6c10b Fix assertion in jump threading (PR13405).
GetBestDestForJumpOnUndef() assumes there is at least 1 successor, which isn't
true if the block ends in an indirect branch with no successors. Fix this by
bailing out earlier in this case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 10:36:17 +00:00
Kostya Serebryany
f7b08226eb [asan] make sure that the crash callbacks do not get merged (Chandler's idea: insert an empty InlineAsm). Change the order in which the new BBs are inserted: the slow path BB is insert between old BBs, the crash BB is inserted at the end. Don't create an empty BB (introduced by recent commits). Update the test. The experimental code that does manual crash callback merge will most likely be deleted later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160544 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 09:54:50 +00:00
Nick Lewycky
4a96d0e44b Revert r160529 due to crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160532 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 23:59:21 +00:00
Nick Lewycky
39e357fafe Don't wipe out global variables that are probably storing pointers to heap
memory. This makes clang play nice with leak checkers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160529 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 22:35:28 +00:00
Benjamin Kramer
b26e2916c9 Replace some explicit compare loops with std::equal.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 10:46:05 +00:00
Bill Wendling
56cb229866 Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160477 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 00:11:40 +00:00
Andrew Trick
7f496a628e indvars: drive by heuristics fix.
Minor oversight noticed by inspection. Sorry no unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-18 04:35:13 +00:00
Andrew Trick
4781d8ee1c indvars: Linear function test replace should avoid reusing undef.
Fixes PR13371: indvars pass incorrectly substitutes 'undef' values.

I do not like this fix. It's needed until/unless the meaning of undef
changes. It attempts to be complete according to the IR spec, but I
don't have much confidence in the implementation given the difficulty
testing undefined behavior. Worse, this invalidates some of my
hard-fought work on indvars and LSR to optimize pointer induction
variables. It results benchmark regressions, which I'll track
internally. On x86_64 no LTO I see:

-3% huffbench
-3% 400.perlbench
-8% fhourstones

My only suggestion for recovering is to change the meaning of
undef. If we could trust an arbitrary instruction to produce a some
real value that can be manipulated (e.g. incremented) according to
non-undef rules, then this case could be easily handled with SCEV.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160421 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-18 04:35:10 +00:00
Evan Cheng
a9e13ba3c8 Back out r160101 and instead implement a dag combine to recover from instcombine transformation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160387 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 18:54:11 +00:00
Kostya Serebryany
4f0c69623c [asan] more code to merge crash callbacks. Doesn't fully work yet, but allows to hold performance experiments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160361 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 11:04:12 +00:00
Andrew Trick
06a27cc1aa Reapply r160340. LSR: Limit CollectSubexprs.
Speculatively fix crashes by code inspection. Can't reproduce them yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160344 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 05:30:37 +00:00
Andrew Trick
81ba5060ea Revert "LSR: try not to blow up solving combinatorial problems brute force."
Some units tests crashed on a different platform.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160341 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 05:05:21 +00:00
Andrew Trick
6a51a7aea5 LSR: try not to blow up solving combinatorial problems brute force.
This places limits on CollectSubexprs to constrains the number of
reassociation possibilities. It limits the recursion depth and skips
over chains of nested recurrences outside the current loop.

Fixes PR13361. Although underlying SCEV behavior is still potentially bad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 05:00:56 +00:00
Nuno Lopes
d49981a9bb fix PR13339 (remove the predecessor from the unwind BB when removing an invoke)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 22:49:40 +00:00
Kostya Serebryany
2735cf4aa5 [asan] a bit more refactoring, addressed some of the style comments from chandlerc, partially implemented crash callback merging (under flag)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160290 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 17:12:07 +00:00
Kostya Serebryany
c0ed3e548c [asan] refactor instrumentation to allow merging the crash callbacks (not fully implemented yet, no functionality change except the BB order)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160284 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 16:15:40 +00:00
Kostya Serebryany
9db5b5ffa9 [asan] initialize asan error callbacks in runOnModule instead of doing that on-demand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 14:09:42 +00:00
Chandler Carruth
349f14c72c Revert r160254 temporarily.
It turns out that ASan relied on the at-the-end block insertion order to
(purely by happenstance) disable some LLVM optimizations, which in turn
start firing when the ordering is made more "normal". These
optimizations in turn merge many of the instrumentation reporting calls
which breaks the return address based error reporting in ASan.

We're looking at several different options for fixing this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160256 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 10:01:02 +00:00
Chandler Carruth
c3c8db9d25 Teach AddressSanitizer to create basic blocks in a more natural order.
This is particularly useful to the backend code generators which try to
process things in the incoming function order.

Also, cleanup some uses of IRBuilder to be a bit simpler and more clear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160254 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 08:58:53 +00:00
Chandler Carruth
38f488e462 Move llvm/Support/TypeBuilder.h -> llvm/TypeBuilder.h. This completes
the move of *Builder classes into the Core library.

No uses of this builder in Clang or DragonEgg I could find.

If there is a desire to have an IR-building-support library that
contains all of these builders, that can be easily added, but currently
it seems likely that these add no real overhead to VMCore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160243 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-15 23:45:24 +00:00
Chandler Carruth
0baa4809a8 Move llvm/Support/MDBuilder.h to llvm/MDBuilder.h, to live with
IRBuilder, DIBuilder, etc.

This is the proper layering as MDBuilder can't be used (or implemented)
without the Core Metadata representation.

Patches to Clang and Dragonegg coming up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-15 23:26:50 +00:00