Owen Anderson
d3a9f00a58
Speculatively revert r138809 in an attempt to fix DragonEgg.
...
llvm-svn: 138829
2011-08-30 21:11:06 +00:00
Owen Anderson
3ec8beb8c8
When walking backwards to eliminate final stores to allocas at the end of a function, encountering an unrelated store should not cause us to give up like encountering a load does.
...
llvm-svn: 138809
2011-08-30 18:51:55 +00:00
Bill Wendling
87d029bc27
Update tests to new EH model. Add landingpad instructions to landing pads.
...
llvm-svn: 138759
2011-08-29 20:39:23 +00:00
Nadav Rotem
43912ff374
Fixes following the CR by Chris and Duncan:
...
Optimize chained bitcasts of the form A->B->A.
Undo r138722 and change isEliminableCastPair to allow this case.
llvm-svn: 138756
2011-08-29 19:58:36 +00:00
Nadav Rotem
6280c8eecc
Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.
...
llvm-svn: 138722
2011-08-28 11:51:08 +00:00
Bill Wendling
b0412973be
Auto upgrade the old EH scheme to use the new one. This is on a trial basis. If
...
things to disasterously over night, this can be reverted.
llvm-svn: 138702
2011-08-27 06:11:03 +00:00
Bill Wendling
400ec8bd8f
Don't sink landingpad instructions during ind-var simplification.
...
llvm-svn: 138651
2011-08-26 20:40:15 +00:00
Andrew Trick
f20e2ff394
Use %% for literals in RUN lines.
...
llvm-svn: 138647
2011-08-26 20:09:48 +00:00
Benjamin Kramer
dc1c57af91
SimplifyCFG: If we have a PHI node that can evaluate to NULL and do a load or store to the address returned by the PHI node then we can consider this incoming value as dead and remove the edge pointing there, unless there are instructions that can affect control flow executed in between.
...
In theory this could be extended to other instructions, eg. division by zero, but it's likely that it will "miscompile" some code because people depend on div by zero not trapping. NULL pointer dereference usually leads to a crash so we should be on the safe side.
This shrinks the size of a Release clang by 16k on x86_64.
llvm-svn: 138618
2011-08-26 01:22:29 +00:00
Nadav Rotem
43673d6d0b
Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api.
...
llvm-svn: 138469
2011-08-24 20:18:38 +00:00
Eric Christopher
aa4993b9aa
Revert "Address Duncan's CR request:"
...
This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340)
Conflicts:
test/Transforms/InstCombine/bitcast.ll
llvm-svn: 138366
2011-08-23 20:11:10 +00:00
Nadav Rotem
442df41879
Fix a typo in the test from the previous commit.
...
llvm-svn: 138342
2011-08-23 17:56:54 +00:00
Nadav Rotem
d449bc9bff
Address Duncan's CR request:
...
1. Cleanup the tests in ConstantFolding.cpp
2. Implement isAllOnes for Constant, ConstantFP, ConstantVector
llvm-svn: 138340
2011-08-23 17:48:43 +00:00
Dan Gohman
9619488506
Constant pointers to objects don't need reference counting.
...
llvm-svn: 138242
2011-08-22 17:29:11 +00:00
Dan Gohman
48e3f904c3
Make a few tests slightly more strict.
...
llvm-svn: 138241
2011-08-22 17:27:02 +00:00
Nadav Rotem
1dc1eb1ae0
Add constant folding support for bitcasts of splat vectors to integers.
...
llvm-svn: 138206
2011-08-20 14:02:29 +00:00
Eric Christopher
28fddb0c70
Add file.
...
llvm-svn: 138083
2011-08-19 21:21:20 +00:00
Dan Gohman
c5d64c76e0
Track a retain+release nesting level independently of the
...
known-incremented level, because the two concepts can be used
to prove the saftey of a retain+release removal in different
ways.
llvm-svn: 138016
2011-08-19 00:26:36 +00:00
Eli Friedman
775a316a06
Atomic load/store handling for the passes using memdep (GVN, DSE, memcpyopt).
...
llvm-svn: 137888
2011-08-17 22:22:24 +00:00
Eli Friedman
e1655eebc3
Silly mistake from r137777; restore significant isStructTy() checks. While here, be a bit more defensive
...
with unknown instructions.
Fixes PR10687.
llvm-svn: 137836
2011-08-17 18:10:43 +00:00
Eli Friedman
32bc68c480
An additional atomic test; related to r137662.
...
llvm-svn: 137786
2011-08-16 23:29:17 +00:00
Eli Friedman
b4733f623f
A bunch of misc fixes to SCCPSolver::ResolvedUndefsIn, including a fix to stop
...
making random bad assumptions about instructions which are not explicitly listed.
Includes fix for rdar://9956541, a version of "undef ^ undef should return
0 because it's easier than arguing with users".
llvm-svn: 137777
2011-08-16 22:06:31 +00:00
Eli Friedman
e0095e4339
Minor bug in SCCP found by inspection. (I don't think it's possible to hit this with a normal pass pipeline, but fixing for completeness.)
...
llvm-svn: 137755
2011-08-16 21:12:35 +00:00
Eli Friedman
6e402678c8
Fix test.
...
llvm-svn: 137703
2011-08-16 01:42:56 +00:00
Eli Friedman
66e399697a
Revert a bit of r137667; the logic in question can safely handle atomic load/store.
...
llvm-svn: 137702
2011-08-16 01:28:22 +00:00
Eric Christopher
a1ecf16bfd
Migrate this test from llvm/test/FrontendC++/ptr-to-method-devirt.cpp and
...
FileCheckize. It is more properly an optimizer test.
llvm-svn: 137700
2011-08-16 01:17:17 +00:00
Eli Friedman
6a475e691d
Update SimplifyCFG for atomic operations.
...
This commit includes a mention of the landingpad instruction, but it's not
changing the behavior around it. I think the current behavior is correct,
though. Bill, can you double-check that?
llvm-svn: 137691
2011-08-15 23:59:28 +00:00
Eli Friedman
f0e7c084ea
Add comments and test for atomic load/store and mem2reg.
...
llvm-svn: 137690
2011-08-15 23:55:52 +00:00
Eli Friedman
36ef5fd140
Update instcombine for atomic load/store.
...
llvm-svn: 137664
2011-08-15 22:09:40 +00:00
Eli Friedman
e18709e5b2
Atomic load/store support in LICM.
...
llvm-svn: 137648
2011-08-15 20:52:09 +00:00
Eric Christopher
92ee29dfc7
Add an ipsccp test. Migrated from test/FrontendC++.
...
llvm-svn: 137646
2011-08-15 20:50:36 +00:00
Nick Lewycky
e020632f7e
This transform is not safe. Thanks to Eli for pointing that out!
...
llvm-svn: 137575
2011-08-14 04:51:49 +00:00
Nick Lewycky
0326303a7a
Don't attempt to add 'nsw' when intermediate instructions had no such guarantee.
...
llvm-svn: 137572
2011-08-14 03:41:33 +00:00
Nick Lewycky
b6a9488190
Teach instcombine to preserve the nsw bit by doing an after-the-fact analysis
...
when combining add and sub instructions. Patch by Pranav Bhandarkar!
llvm-svn: 137570
2011-08-14 01:45:19 +00:00
Eli Friedman
baf0f69f9a
Move "atomic" and "volatile" designations on instructions after the opcode
...
of the instruction.
Note that this change affects the existing non-atomic load and store
instructions; the parser now accepts both forms, and the change is noted
in the release notes.
llvm-svn: 137527
2011-08-12 22:50:01 +00:00
Dan Gohman
c188a47b62
Don't convert objc_autoreleaseReturnValue to objc_autorelease if the result
...
is returned through a bitcast.
llvm-svn: 137402
2011-08-12 00:36:31 +00:00
Dan Gohman
783fdc6375
Don't let arbitrary calls disrupt nested retain+release pairs if
...
the retains and releases all use the same SSA pointer value.
Also, don't let CFG hazards disrupt nested retain+release pair
optimizations.
llvm-svn: 137399
2011-08-12 00:26:31 +00:00
Andrew Trick
d251d23191
A slew of unit tests for the recent LoopInfo::updateUnloop feature
...
checked in at r137276 and r137341.
llvm-svn: 137385
2011-08-11 23:38:09 +00:00
Andrew Trick
5a5a5ebe68
Allow loop unrolling to get known trip counts from ScalarEvolution.
...
SCEV unrolling can unroll loops with arbitrary induction variables. It
is a prerequisite for -disable-iv-rewrite performance. It is also
easily handles loops of arbitrary structure including multiple exits
and is generally more robust.
This is under a temporary option to avoid affecting default
behavior for the next couple of weeks. It is needed so that I can
checkin unit tests for updateUnloop.
llvm-svn: 137384
2011-08-11 23:36:16 +00:00
Andrew Trick
4a938add93
Invoke SimplifyIndVar when we partially unroll a loop. Fixes PR10534.
...
llvm-svn: 137203
2011-08-10 04:29:49 +00:00
Andrew Trick
3ed0cd3cb6
Fix the LoopUnroller to handle nontrivial loops and partial unrolling.
...
These are not individual bug fixes. I had to rewrite a good chunk of
the unroller to make it sane. I think it was getting lucky on trivial
completely unrolled loops with no early exits. I included some fairly
simple unit tests for partial unrolling. I didn't do much stress
testing, so it may not be perfect, but should be usable now.
llvm-svn: 137190
2011-08-10 00:28:10 +00:00
Dan Gohman
a716e5c67e
Tidy up these testcases to look more like real code does.
...
llvm-svn: 137085
2011-08-09 00:33:11 +00:00
Andrew Trick
a7fc7983d4
Made SCEV's UDiv expressions more canonical. When dividing a
...
recurrence, the initial values low bits can sometimes be ignored.
To take advantage of this, added FoldIVUser to IndVarSimplify to fold
an IV operand into a udiv/lshr if the operator doesn't affect the
result.
-indvars -disable-iv-rewrite now transforms
i = phi i4
i1 = i0 + 1
idx = i1 >> (2 or more)
i4 = i + 4
into
i = phi i4
idx = i0 >> ...
i4 = i + 4
llvm-svn: 137013
2011-08-06 07:00:37 +00:00
Bill Wendling
fdea9930ac
Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets.
...
This is some of my original LLVM code. *wipes tear*
llvm-svn: 136821
2011-08-03 22:18:20 +00:00
Andrew Trick
bbb5c7b0aa
SCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget
...
to notify SCEV of a change. Add forgetLoop in a couple of those places.
llvm-svn: 136797
2011-08-03 18:32:11 +00:00
Chris Lattner
d4b0ee77a9
fix PR10286, a problem with the .ll printer handling block addresses that are out-of-scope.
...
llvm-svn: 136768
2011-08-03 06:15:41 +00:00
Nick Lewycky
82418c24b8
Fix logical error when detecting lifetime intrinsics.
...
Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)"
which in turn means "unreachable". What we wanted was a no-op. Instead, analyze
the whole tree and look for all the instructions we need to delete first, then
delete them second, not relying on the use_list to stay consistent.
llvm-svn: 136752
2011-08-03 00:43:35 +00:00
Nick Lewycky
05fed81aa9
Teach InstCombine that lifetime intrincs aren't a real user on the result of a
...
malloc call.
llvm-svn: 136732
2011-08-02 22:08:01 +00:00
Nick Lewycky
2f04a6b411
Lifetime intrinsics on undef are dead.
...
llvm-svn: 136722
2011-08-02 21:19:27 +00:00
Benjamin Kramer
5aff5a9498
Remove empty test.
...
llvm-svn: 136675
2011-08-02 02:47:45 +00:00