1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

91 Commits

Author SHA1 Message Date
Chandler Carruth
c47432114d [PM] Split the LoopInfo object apart from the legacy pass, creating
a LoopInfoWrapperPass to wire the object up to the legacy pass manager.

This switches all the clients of LoopInfo over and paves the way to port
LoopInfo to the new pass manager. No functionality change is intended
with this iteration.

llvm-svn: 226373
2015-01-17 14:16:18 +00:00
David Peixotto
1c44b9f4ef Fix assertion in LICM doFinalization()
The doFinalization method checks that the LoopToAliasSetMap is
empty. LICM populates that map as it runs through the loop nest,
deleting the entries for child loops as it goes. However, if a child
loop is deleted by another pass (e.g. unrolling) then the loop will
never be deleted from the map because LICM walks the loop nest to
find entries it can delete.

The fix is to delete the loop from the map and free the alias set
when the loop is deleted from the loop nest.

Differential Revision: http://reviews.llvm.org/D5305

llvm-svn: 218387
2014-09-24 16:48:31 +00:00
Richard Trieu
b7d5af56cb Add back functionality removed in r210497.
Instead of asserting, output a message stating that a null pointer was found.

llvm-svn: 211430
2014-06-21 02:43:02 +00:00
Richard Trieu
8c7b353cd7 Removing an "if (!this)" check from two print methods. The condition will
never be true in a well-defined context.  The checking for null pointers
has been moved into the caller logic so it does not rely on undefined behavior.

llvm-svn: 210497
2014-06-09 22:53:16 +00:00
Juergen Ributzka
271cad0970 Add C API for thread yielding callback.
Sometimes a LLVM compilation may take more time then a client would like to
wait for. The problem is that it is not possible to safely suspend the LLVM
thread from the outside. When the timing is bad it might be possible that the
LLVM thread holds a global mutex and this would block any progress in any other
thread.

This commit adds a new yield callback function that can be registered with a
context. LLVM will try to yield by calling this callback function, but there is
no guaranteed frequency. LLVM will only do so if it can guarantee that
suspending the thread won't block any forward progress in other LLVM contexts
in the same process.

Once the client receives the call back it can suspend the thread safely and
resume it at another time.

Related to <rdar://problem/16728690>

llvm-svn: 208945
2014-05-16 02:33:15 +00:00
Chandler Carruth
15c7b91ac2 [Modules] Make Support/Debug.h modular. This requires it to not change
behavior based on other files defining DEBUG_TYPE, which means it cannot
define DEBUG_TYPE at all. This is actually better IMO as it forces folks
to define relevant DEBUG_TYPEs for their files. However, it requires all
files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't
already. I've updated all such files in LLVM and will do the same for
other upstream projects.

This still leaves one important change in how LLVM uses the DEBUG_TYPE
macro going forward: we need to only define the macro *after* header
files have been #include-ed. Previously, this wasn't possible because
Debug.h required the macro to be pre-defined. This commit removes that.
By defining DEBUG_TYPE after the includes two things are fixed:

- Header files that need to provide a DEBUG_TYPE for some inline code
  can do so by defining the macro before their inline code and undef-ing
  it afterward so the macro does not escape.

- We no longer have rampant ODR violations due to including headers with
  different DEBUG_TYPE definitions. This may be mostly an academic
  violation today, but with modules these types of violations are easy
  to check for and potentially very relevant.

Where necessary to suppor headers with DEBUG_TYPE, I have moved the
definitions below the includes in this commit. I plan to move the rest
of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big
enough.

The comments in Debug.h, which were hilariously out of date already,
have been updated to reflect the recommended practice going forward.

llvm-svn: 206822
2014-04-21 22:55:11 +00:00
Craig Topper
8cd194d4c1 [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206243
2014-04-15 04:59:12 +00:00
Craig Topper
4c58d1a8e2 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 202945
2014-03-05 07:30:04 +00:00
Paul Robinson
ea4fd2b99b Constify the Optnone checks in IR passes.
llvm-svn: 202213
2014-02-26 01:23:26 +00:00
Paul Robinson
189e175394 Disable most IR-level transform passes on functions marked 'optnone'.
Ideally only those transform passes that run at -O0 remain enabled,
in reality we get as close as we reasonably can.
Passes are responsible for disabling themselves, it's not the job of
the pass manager to do it for them.

llvm-svn: 200892
2014-02-06 00:07:05 +00:00
Chandler Carruth
076d51813d [PM] Rename the IR printing pass header to a more generic and correct
name to match the source file which I got earlier. Update the include
sites. Also modernize the comments in the header to use the more
recommended doxygen style.

llvm-svn: 199041
2014-01-12 11:10:32 +00:00
Chandler Carruth
7aa902a488 Move the LLVM IR asm writer header files into the IR directory, as they
are part of the core IR library in order to support dumping and other
basic functionality.

Rename the 'Assembly' include directory to 'AsmParser' to match the
library name and the only functionality left their -- printing has been
in the core IR library for quite some time.

Update all of the #includes to match.

All of this started because I wanted to have the layering in good shape
before I started adding support for printing LLVM IR using the new pass
infrastructure, and commandline support for the new pass infrastructure.

llvm-svn: 198688
2014-01-07 12:34:26 +00:00
Andrew Trick
3a27f5b69d Comment: try to clarify loop iteration order.
llvm-svn: 186774
2013-07-20 23:10:31 +00:00
Andrew Trick
c5e08120a4 Enable the new LoopInfo algorithm by default.
The primary advantage is that loop optimizations will be applied in a
stable order. This helps debugging and unit test creation. It is also
a better overall implementation without pathologically bad performance
on deep functions.

On large functions (llvm-stress --size=200000 | opt -loops)
Before: 0.1263s
After:  0.0225s

On deep functions (after tweaking llvm-stress, thanks Nadav):
Before: 0.2281s
After:  0.0227s

See r158790 for more comments.

The loop tree is now consistently generated in forward order, but loop
passes are applied in reverse order over the program. If we have a
loop optimization that prefers forward order, that can easily be
achieved by adding a different type of LoopPassManager.

llvm-svn: 159183
2012-06-26 04:11:38 +00:00
Eric Christopher
11cd3dd9fc Take out the debug info probe stuff. It's making some changes to
the PassManager annoying and should be reimplemented as a decorator
on top of existing passes (as should the timing data).

llvm-svn: 153305
2012-03-23 03:54:05 +00:00
Andrew Trick
026fa4da72 Reapply r138695. Fix PassManager stack depths.
Patch by Xiaoyi Guo!

llvm-svn: 138737
2011-08-29 17:07:00 +00:00
Andrew Trick
65754eb3f7 Reverting r138695 to see if it fixes clang self host.
llvm-svn: 138701
2011-08-27 06:10:16 +00:00
Andrew Trick
e38568bc07 Fix PassManager stack depths.
Patch by Xiaoyi Guo!

llvm-svn: 138695
2011-08-27 02:11:03 +00:00
Andrew Trick
306e3d0508 Reapplying r136844.
An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.

llvm-svn: 137276
2011-08-10 23:22:57 +00:00
Andrew Trick
aebed187b7 Reverting r136884 updateUnloop, which crashed a linux builder.
llvm-svn: 136857
2011-08-04 01:04:37 +00:00
Andrew Trick
cfb48e5133 An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.

llvm-svn: 136844
2011-08-03 23:50:25 +00:00
Andrew Trick
a700dedcd1 whitespace
llvm-svn: 136843
2011-08-03 23:45:50 +00:00
Devang Patel
73d68195ce Introduce DebugInfoProbe. This is used to monitor how llvm optimizer is treating debugging information.
It generates output that lools like

8 times line number info lost by Scalar Replacement of Aggregates (SSAUp) 
1 times line number info lost by Simplify well-known library calls 
12 times variable info lost by Jump Threading

llvm-svn: 127381
2011-03-10 00:21:25 +00:00
Chris Lattner
8df3ffd7ac zap dead code.
llvm-svn: 113073
2010-09-04 18:12:00 +00:00
Dan Gohman
bb27588b3f Revert r111199; it breaks -debug-pass=Structure output.
llvm-svn: 111500
2010-08-19 01:29:07 +00:00
Dan Gohman
b09e2e1be4 Make dumpPassStructure be a PMDataManager abstraction, rather than
a Pass abstraction, since that's the level it's actually used at.
Rename Pass' dumpPassStructure to dumpPass.

This eliminates an awkward use of getAsPass() to convert a PMDataManager*
into a Pass* just to permit a dumpPassStructure call.

llvm-svn: 111199
2010-08-16 22:45:12 +00:00
Dan Gohman
2d7bf8c073 Make LoopPass::getContainedPass return a LoopPass* instead of a Pass*
and remove casts from all its callers.

llvm-svn: 110848
2010-08-11 20:34:43 +00:00
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
David Greene
7c81589636 Ok, third time's the charm. No changes from last time except the CMake
source addition.  Apparently the buildbots were wrong about failures.

---

Add some switches helpful for debugging:

-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.

llvm-svn: 100249
2010-04-02 23:17:14 +00:00
Evan Cheng
499918dabf Revert 100204. It broke a bunch of tests and apparently changed what passes are run during codegen.
llvm-svn: 100207
2010-04-02 19:29:15 +00:00
David Greene
554373897c Let's try this again. Re-apply 100143 including an apparent missing
<string> include.  For some reason the buildbot choked on this while my
builds did not.  It's probably due to a difference in system headers.

---

Add some switches helpful for debugging:

-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.

llvm-svn: 100204
2010-04-02 18:46:26 +00:00
Eric Christopher
77e4cc4bbd Revert r100143.
llvm-svn: 100146
2010-04-01 22:54:42 +00:00
David Greene
a358be0ef7 Add some switches helpful for debugging:
-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.

llvm-svn: 100143
2010-04-01 22:43:57 +00:00
Benjamin Kramer
192e50f7b1 s/getNameStr/getName/
llvm-svn: 100011
2010-03-31 16:06:22 +00:00
Chris Lattner
4424043996 reapply my timer rewrite with a change for PassManager to store
timers by pointer instead of by-value.

llvm-svn: 99871
2010-03-30 04:03:22 +00:00
Chris Lattner
bbb637bacc revert r99862 which is causing FNT failures.
llvm-svn: 99870
2010-03-30 03:57:00 +00:00
Chris Lattner
65efe21d42 fairly major rewrite of various timing related stuff.
llvm-svn: 99862
2010-03-30 02:38:19 +00:00
Chris Lattner
f683d7d909 eliminate a bunch more unneeded dynamic_cast's.
llvm-svn: 94156
2010-01-22 05:37:10 +00:00
Dan Gohman
7a5cb984e6 Fix this debug output to handle the case where the loop has been deleted.
llvm-svn: 82994
2009-09-28 15:40:01 +00:00
Dan Gohman
aade5fefdb Include the name of the loop header in debug messages.
llvm-svn: 82993
2009-09-28 15:07:18 +00:00
Dan Gohman
bd50ec69e4 Move the dominator verification code out of special code embedded within
the PassManager code into a regular verifyAnalysis method.

Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.

llvm-svn: 82952
2009-09-28 00:27:48 +00:00
Dan Gohman
195c5bdf41 Move this assert to check the condition as soon as it is known.
llvm-svn: 82951
2009-09-28 00:10:28 +00:00
Dan Gohman
09f5f7f190 Extend the StartPassTimer and StopPassTimer functions so that the
code that stops the timer doesn't have to search to find the timer
object before it stops the timer. This avoids a lock acquisition
and a few other things done with the timer running.

llvm-svn: 82949
2009-09-28 00:07:05 +00:00
Dan Gohman
000a17774e Fix an old copy+pasto.
llvm-svn: 82947
2009-09-27 23:52:07 +00:00
Dan Gohman
db89691ec4 Extract the code for inserting a loop into the loop queue into
a separate function.

llvm-svn: 82946
2009-09-27 23:49:43 +00:00
Dan Gohman
0ea6efde4e When a loop is deleted, immediately release all of the active
LoopPasses for that loop. This avoids trouble with the PassManager
trying to call verifyAnalysis on them, and frees up some memory
sooner rather than later.

llvm-svn: 82945
2009-09-27 23:43:07 +00:00
Dan Gohman
2d607af763 Delete a bogus comment.
llvm-svn: 82908
2009-09-27 17:50:44 +00:00
Dan Gohman
addca8bad6 Don't try to verify a LoopPass analysis if the loop has been deleted.
llvm-svn: 80919
2009-09-03 15:09:24 +00:00