1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
Commit Graph

1748 Commits

Author SHA1 Message Date
Bill Wendling
3079e1ccda Add SplitLandingPadPredecessors().
SplitLandingPadPredecessors is similar to SplitBlockPredecessors in that it
splits the current block and attaches a set of predecessors to the new basic
block. However, it differs from SplitBlockPredecessors in that it's specifically
designed to handle landing pad blocks.

Two new basic blocks are created: one that is has the vector of predecessors as
its predecessors and one that has the remaining predecessors as its
predecessors. Those two new blocks then receive a cloned copy of the landingpad
instruction from the original block. The landingpad instructions are joined in a
PHI, etc. Like SplitBlockPredecessors, it updates the LLVM IR, AliasAnalysis,
DominatorTree, DominanceFrontier, LoopInfo, and LCCSA analyses.

llvm-svn: 138014
2011-08-19 00:05:40 +00:00
Bill Wendling
fef33f1d24 Revert r137871. The loop simplify pass should require all exits from a loop that
aren't from an indirect branch need to be dominated by the loop header.

llvm-svn: 137981
2011-08-18 21:10:01 +00:00
Bill Wendling
f3c0fabac7 Split out the updating of PHI nodes after splitting the BB into a separate
function.

llvm-svn: 137979
2011-08-18 20:51:04 +00:00
Bill Wendling
dec05a3784 Use this fantzy ArrayRef thing to pass in the list of predecessors.
llvm-svn: 137978
2011-08-18 20:39:32 +00:00
Bill Wendling
3fbc8471bb Use static instead of anonymous namespace.
llvm-svn: 137959
2011-08-18 17:57:57 +00:00
Bill Wendling
42b9a110e0 Split out the analysis updating code into a helper function. No intended
functionality change.

llvm-svn: 137926
2011-08-18 05:25:23 +00:00
Bill Wendling
e626358c3c Increment the insertion iterator to beyond the landingpad instruction.
llvm-svn: 137872
2011-08-17 21:21:31 +00:00
Bill Wendling
094d34f377 Don't optimize the landing pad exit block.
One way to exit the loop is through an unwind edge. However, that may involve
splitting the critical edge of the landing pad, which is non-trivial. Prevent
the transformation from rewriting the landing pad exit loop block.

llvm-svn: 137871
2011-08-17 21:20:43 +00:00
Bill Wendling
c8581928f3 Assert that we aren't trying to split the critical edge of a landing pad. Doing
so requires more care than this generic algorithm should handle.

llvm-svn: 137866
2011-08-17 21:04:05 +00:00
Bill Wendling
32612231af I think there was some confusion about what I meant. :-) Replacing the comment.
llvm-svn: 137743
2011-08-16 20:41:17 +00:00
Eli Friedman
f969dabf83 After talking with Bill, it seems like the LandingPad handling here is likely
to be wrong (or at least somewhat suspect).  Leave a FIXME for Bill.

llvm-svn: 137694
2011-08-16 00:41:37 +00:00
Eli Friedman
eb7e5209e5 Minor comment fixes.
llvm-svn: 137693
2011-08-16 00:20:11 +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
b25f5aeda5 Fix llvm::CloneModule to correctly clone globals. Patch per bug report by Simon Moll on llvmdev.
llvm-svn: 137654
2011-08-15 21:05:06 +00:00
Bill Wendling
0c8837a1f1 The "landingpad" instruction will never be "trivially" dead.
llvm-svn: 137642
2011-08-15 20:10:51 +00:00
Bill Wendling
e4ea267524 Add inlining for the new EH scheme.
This builds off of the current scheme, but instead of llvm.eh.exception and
llvm.eh.selector, it uses the landingpad instruction. And instead of
llvm.eh.resume, it uses the resume instruction.

Because of the invariants in the landing pad instruction, a lot of code that's
currently needed to find the appropriate intrinsic calls for an invoke
instruction won't be needed once we go to the new EH scheme. The "FIXME"s tell
us what to remove after we switch.

llvm-svn: 137576
2011-08-14 08:01:36 +00:00
Chris Lattner
ef56f8992d switch to use the new api for structtypes.
llvm-svn: 137480
2011-08-12 18:06:37 +00:00
Duncan Sands
10a9e984bc Silence a bunch (but not all) "variable written but not read" warnings
when building with assertions disabled.

llvm-svn: 137460
2011-08-12 14:54:45 +00:00
Devang Patel
1541972a13 Distinguish between two copies of one inlined variable. Take 2.
llvm-svn: 137253
2011-08-10 21:50:54 +00:00
Andrew Trick
c1871c7c97 Comments. Thanks for the spell check Nick!
Also, my apologies for spoiling the autocomplete on SimplifyInstructions.cpp. I couldn't think of a better filename.

llvm-svn: 137229
2011-08-10 18:07:05 +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
f598747450 Cleanup. Make ScalarEvolution an explicit argument of the
SimplifyIndVar utility since it is required.

llvm-svn: 137202
2011-08-10 04:22:26 +00:00
Andrew Trick
afa9344ce9 SimplifyIndVar: make foldIVUser iterative to fold a chain of operands.
llvm-svn: 137199
2011-08-10 04:01:31 +00:00
Benjamin Kramer
aa77183382 Update CMake build.
llvm-svn: 137198
2011-08-10 03:51:58 +00:00
Andrew Trick
b85da1c369 Added a SimplifyIndVar utility to simplify induction variable users
based on ScalarEvolution without changing the induction variable phis.

This utility is the main tool of IndVarSimplifyPass, but the pass also
restructures induction variables in strange ways that are sensitive to
pass ordering. This provides a way for other loop passes to simplify
new uses of induction variables created during transformation. The
utility may be used by any pass that preserves ScalarEvolution. Soon
LoopUnroll will use it.

The net effect in this checkin is to cleanup the IndVarSimplify pass
by factoring out the SimplifyIndVar algorithm into a standalone utility.

llvm-svn: 137197
2011-08-10 03:46:27 +00:00
Andrew Trick
d10d5f0609 Cleanup. Added LoopBlocksDFS::perform for simple clients.
llvm-svn: 137195
2011-08-10 01:59:05 +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
Andrew Trick
b9ef7f9e3e LoopUnroll looks like it has some stale code. Remove it to prove my sanity and avoid further confusion.
llvm-svn: 137106
2011-08-09 03:11:29 +00:00
Bill Wendling
e3f1ab16df There is only one instance of this placeholder being created. Just use that
instead of a vector.

llvm-svn: 137099
2011-08-09 01:17:10 +00:00
Bill Wendling
23cae0966d Remove an instance where the 'unwind' instruction was created.
The 'unwind' instruction was acting essentially as a placeholder, because it
would be replaced at the end of this function by a branch to the "unwind
handler". The 'unwind' instruction is going away, so use 'unreachable' instead,
which serves the same purpose as a placeholder.

llvm-svn: 137098
2011-08-09 01:09:21 +00:00
Chandler Carruth
e833bbd11e Temporarily revert r135528 which distinguishes between two copies of one
inlined variable, based on the discussion in PR10542.

This explodes the runtime of several passes down the pipeline due to
a large number of "copies" remaining live across a large function. This
only shows up with both debug and opt, but when it does it creates
a many-minute compile when self-hosting LLVM+Clang. There are several
other cases that show these types of regressions.

All of this is tracked in PR10542, and progress is being made on fixing
the issue. Once its addressed, the re-instated, but until then this
restores the performance for self-hosting and other opt+debug builds.

Devang, let me know if this causes any trouble, or impedes fixing it in
any way, and thanks for working on this!

llvm-svn: 136953
2011-08-05 00:51:31 +00:00
Devang Patel
e5379a1a5d We need to map DebugLoc. It leads to Fuction * (through subprogram entry node) which should be appropriately mapped.
llvm-svn: 136910
2011-08-04 20:02:18 +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
Andrew Trick
0ba77723bf whitespace
llvm-svn: 136795
2011-08-03 18:28:21 +00:00
Nick Lewycky
2f04a6b411 Lifetime intrinsics on undef are dead.
llvm-svn: 136722
2011-08-02 21:19:27 +00:00
Bill Wendling
57ddbb84ac Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444,
r136445, r136446, r136253 pending review.

llvm-svn: 136556
2011-07-30 05:42:50 +00:00
Chandler Carruth
f7890e34b9 Rewrite the CMake build to use explicit dependencies between libraries,
specified in the same file that the library itself is created. This is
more idiomatic for CMake builds, and also allows us to correctly specify
dependencies that are missed due to bugs in the GenLibDeps perl script,
or change from compiler to compiler. On Linux, this returns CMake to
a place where it can relably rebuild several targets of LLVM.

I have tried not to change the dependencies from the ones in the current
auto-generated file. The only places I've really diverged are in places
where I was seeing link failures, and added a dependency. The goal of
this patch is not to start changing the dependencies, merely to move
them into the correct location, and an explicit form that we can control
and change when necessary.

This also removes a serialization point in the build because we don't
have to scan all the libraries before we begin building various tools.
We no longer have a step of the build that regenerates a file inside the
source tree. A few other associated cleanups fall out of this.

This isn't really finished yet though. After talking to dgregor he urged
switching to a single CMake macro to construct libraries with both
sources and dependencies in the arguments. Migrating from the two macros
to that style will be a follow-up patch.

Also, llvm-config is still generated with GenLibDeps.pl, which means it
still has slightly buggy dependencies. The internal CMake
'llvm-config-like' macro uses the correct explicitly specified
dependencies however. A future patch will switch llvm-config generation
(when using CMake) to be based on these deps as well.

This may well break Windows. I'm getting a machine set up now to dig
into any failures there. If anyone can chime in with problems they see
or ideas of how to solve them for Windows, much appreciated.

llvm-svn: 136433
2011-07-29 00:14:25 +00:00
Bill Wendling
db288e16ed Some minor cleanups. No functionalitical change.
llvm-svn: 136341
2011-07-28 07:44:07 +00:00
Bill Wendling
55af961b37 Leverage some of the code that John wrote to manage the landing pads.
The new EH is more simple in many respects. Mainly, we don't have to worry about
the "llvm.eh.exception" and "llvm.eh.selector" calls being in weird places.

llvm-svn: 136339
2011-07-28 07:31:46 +00:00
Bill Wendling
8b4ec26e4f Automatically merge the landingpad clauses when we come across a callee's
landingpad.

llvm-svn: 136329
2011-07-28 02:40:13 +00:00
Bill Wendling
3af08d0231 Initial stab at getting inlining working with the EH rewrite.
This takes the new 'resume' instruction and turns it into a direct jump to the
caller's landing pad code. The caller's landingpad instruction is merged with
the landingpad instructions of the callee. This is a bit rough and makes some
assumptions in how the code works. But it passes a simple test.

llvm-svn: 136313
2011-07-28 00:38:23 +00:00
Bill Wendling
6f17cb3233 Refuse to inline two functions which use different personality functions.
llvm-svn: 136269
2011-07-27 21:44:28 +00:00
Andrew Trick
8e55bd70ba Add clarifying comments for the new arguments to UnrollLoop.
llvm-svn: 135988
2011-07-25 22:17:47 +00:00
Jay Foad
6513dac6e2 Convert GetElementPtrInst to use ArrayRef.
llvm-svn: 135904
2011-07-25 09:48:08 +00:00
Andrew Trick
53ed0491c0 Move trip count discovery outside of the generic LoopUnroll helper. This
removes its dependence on canonical induction variables.

llvm-svn: 135829
2011-07-23 00:33:05 +00:00
Andrew Trick
6dc31a31ed whitespace
llvm-svn: 135828
2011-07-23 00:29:16 +00:00
Eli Friedman
c18314afef Clean up includes of llvm/Analysis/ConstantFolding.h so it's included where it's used and not included where it isn't.
llvm-svn: 135628
2011-07-20 21:57:23 +00:00
Eli Friedman
f809f44cf5 PR10386: Don't try to split an edge from an indirectbr.
llvm-svn: 135534
2011-07-19 22:59:41 +00:00
Devang Patel
65afdd27d0 Distinguish between two copies of one inlined variable.
llvm-svn: 135528
2011-07-19 22:31:15 +00:00