Commit Graph

237 Commits

Author SHA1 Message Date
Dan Gohman 4dbb301f17 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 277e767578 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 5e8ba5d514 Extract the code for releasing a pass into a separate function, and
tidy it up a little.

llvm-svn: 82944
2009-09-27 23:38:27 +00:00
Chris Lattner d4d966f500 make -debug-pass=Executions show information about what call graph nodes
are in the SCC for each execution of a CGSCC pass.

llvm-svn: 81838
2009-09-15 05:03:04 +00:00
Chris Lattner f82f27be3f add some missing quotes in debug output
llvm-svn: 81836
2009-09-15 04:45:26 +00:00
Benjamin Kramer 1a25d733f9 Kill off more cerr/cout uses and prune includes a bit.
llvm-svn: 79852
2009-08-23 11:37:21 +00:00
Dan Gohman a6d0afcb74 Fix a bunch of namespace pollution.
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Daniel Dunbar 9813b0b025 Eliminate some uses of DOUT, cerr, and getNameStart().
llvm-svn: 77145
2009-07-26 07:49:05 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin 56d0659726 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Torok Edwin 6dd2730024 Start converting to new error handling API.
cerr+abort -> llvm_report_error
assert(0)+abort -> LLVM_UNREACHABLE (assert(0)+llvm_unreachable-> abort() included)

llvm-svn: 75018
2009-07-08 18:01:40 +00:00
Owen Anderson 5c96ef7c4e Have scoped mutexes take referenes instead of pointers.
llvm-svn: 74931
2009-07-07 18:33:04 +00:00
Dan Gohman 83ff184206 Use find instead of operator[] to test whether an element is in a std::map.
This fixes a bug that caused -debug-pass=Details to abort.

llvm-svn: 74654
2009-07-01 23:12:33 +00:00
Torok Edwin 896556eec7 Set wasRun to false here on Dan's suggestion.
llvm-svn: 74455
2009-06-29 21:05:10 +00:00
Torok Edwin 24c7835d19 Call doInitialization(), releaseMemory(), and doFinalization() for on-the-fly passes as well.
Also don't call finalizers for LoopPass if initialization was not called.
Add a unittest that tests that these methods are called, in the proper
order, and the correct number of times.

llvm-svn: 74438
2009-06-29 18:49:09 +00:00
Owen Anderson 5a6960fcc3 Add a SmartScopedLock, and use it to simplify code.
llvm-svn: 73722
2009-06-18 20:51:00 +00:00
Owen Anderson 7d42b95b6c Move Threading.[h|cpp] from Support to System.
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson 0dd39fdf96 Guard mutation of the timing info global.
llvm-svn: 73639
2009-06-17 21:28:54 +00:00
Duncan Sands e5e9f09c6d Always verify dominfo if expensive checking is enabled.
llvm-svn: 72253
2009-05-22 08:52:53 +00:00
Devang Patel ec9c58f7e5 Clean up pass manager cache after each run.
llvm-svn: 68254
2009-04-01 22:34:41 +00:00
Dan Gohman 79fc0e9250 Use WriteAsOperand instead of manually decorating the name for this
debug output. This improves the printing of anonymous values.

llvm-svn: 66561
2009-03-10 18:47:59 +00:00
Chris Lattner 4c1e9541d3 Sprinkle some PrettyStackEntry magic into the passmanager. With this, we now
get nice and happy stack traces when we crash in an optimizer or codegen.  For
example, an abort put in UnswitchLoops now looks like this:

Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'pr3399.c'.
4.	Running pass 'Loop Pass Manager' on function '@foo'
5.	Running pass 'Unswitch loops' on basic block '%for.inc'
Abort

llvm-svn: 66260
2009-03-06 06:45:05 +00:00
Chris Lattner 609873608e various cosmetic cleanups.
llvm-svn: 66254
2009-03-06 05:53:14 +00:00
Duncan Sands 51495609df Reapply r64301. These uses of "inline" can cause strange
link-time failures when building with optimization.  Just
get rid of them.

llvm-svn: 64449
2009-02-13 09:42:34 +00:00
Bill Wendling 5f14a01340 Revert r64300 and r64301. These were causing the following errors respectively:
During llvm-gcc bootstrap:

Undefined symbols:
  "llvm::FPPassManager::doFinalization(llvm::Module&)", referenced from:
      (anonymous namespace)::CGPassManager::doFinalization(llvm::CallGraph&, llvm::Module&)
        in libLLVMipa.a(CallGraphSCCPass.o)
  "llvm::FPPassManager::doInitialization(llvm::Module&)", referenced from:
      (anonymous namespace)::CGPassManager::doInitialization(llvm::CallGraph&, llvm::Module&)
        in libLLVMipa.a(CallGraphSCCPass.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/obj-llvm/Release/bin/opt] Error 1

During an LLVM release build:

/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-register-desc -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenRegisterInfo.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td instruction names with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-instr-enums -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenInstrNames.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td instruction information with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-instr-desc -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenInstrInfo.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td assembly writer with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-asm-writer -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenAsmWriter.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Compiling InstructionCombining.cpp for Release build 
if /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~dst/Developer/usr/bin/llvm-g++-4.2 -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Transforms/Scalar  -D_DEBUG  -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3  -fno-exceptions  -Woverloaded-virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter  -fstrict-aliasing -Wstrict-aliasing -c -MMD -MP -MF "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d.tmp" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.lo" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.o" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d" /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Transforms/Scalar/InstructionCombining.cpp -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.o ; \
           then /bin/mv -f "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d.tmp" "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Trans

llvm-svn: 64311
2009-02-11 18:19:24 +00:00
Duncan Sands 5b3349064d These uses of "inline" can cause strange link-time
failures when building with optimization.  Just get
rid of them.

llvm-svn: 64301
2009-02-11 12:25:15 +00:00
Duncan Sands 5a913d61e3 Rename getAnalysisToUpdate to getAnalysisIfAvailable.
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Dan Gohman 193e4c025e Fix a use of an invalid iterator when -debug-pass=Details is used.
llvm-svn: 58816
2008-11-06 21:57:17 +00:00
Nuno Lopes 0460bb27e0 fix memory leak in pass manager when adding an analysis pass that already existed. as pass manager takes ownership of the added passes, it has to delete the pass if it isnt added to the pass list
tweak the opt tool so that it doesnt access a Pass after the ownership was taken by the pass manager

llvm-svn: 58730
2008-11-04 23:03:58 +00:00
Duncan Sands 26ff6f9c54 Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.

llvm-svn: 57291
2008-10-08 07:23:46 +00:00
Devang Patel c3e3ca9a45 Remove interfaces implemented by dead pass from the list of available passes.
Patch By Matthijs Kooijman.

llvm-svn: 57202
2008-10-06 20:36:36 +00:00
Devang Patel 18ff6367f7 Add assertion check.
llvm-svn: 56016
2008-09-09 21:38:40 +00:00
Devang Patel a328690ed3 Simplify.
Fix outdated comment.

llvm-svn: 55993
2008-09-09 17:56:50 +00:00
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Devang Patel fdee7034b3 The pass manager is not able to schedule -loop-deletion -loop-index-split.
The loop-deletion pass does not preserve dom frontier, which is required by
loop-index-split. When the PM checks dom frontier for loop-index-split, it has
already verified that lcssa is availalble. However, new dom frontier forces new
loop pass manager, which does not  have lcssa yet.

The PM should recheck availability of required analysis passes in such cases.

llvm-svn: 54805
2008-08-14 23:07:48 +00:00
Devang Patel 0d29ae085b Use SmallVector instead of std::vector
llvm-svn: 54685
2008-08-12 15:44:31 +00:00
Devang Patel c68a0b6244 Use DenseMap to keep track of last users.
Use inversed map for faster queries.

llvm-svn: 54662
2008-08-12 00:26:16 +00:00
Devang Patel ec9e1a60ad Keep track of analysis usage information for passes. Avoid invoking
getAnalysisUsage() repeatedly.

llvm-svn: 54650
2008-08-11 21:13:39 +00:00
Chris Lattner 4c493d9a58 Don't call getAnalysisUsage unless -debug-pass is enabled. This speeds
up the passmgr by avoiding useless work.

llvm-svn: 54528
2008-08-08 15:14:09 +00:00
Chris Lattner cbd160f447 Speed up the passmgr by avoiding heap thrashing on vectors.
llvm-svn: 54515
2008-08-08 05:33:04 +00:00
Chris Lattner 02eb94c2d7 Don't verify passes when assertions are disabled.
llvm-svn: 54446
2008-08-07 07:34:50 +00:00
Dan Gohman 1526985bac Consistently put quotes around pass names in debugging output.
llvm-svn: 53268
2008-07-09 00:50:40 +00:00
Devang Patel 99ad4ba227 Disable dom info verifier by default.
llvm-svn: 52983
2008-07-01 21:36:11 +00:00
Devang Patel 67c79a4992 Fix typos in comments.
Thanks for the feedback!

llvm-svn: 52978
2008-07-01 19:50:56 +00:00
Devang Patel 9dbe4d15ec Add dom info verifier.
llvm-svn: 52967
2008-07-01 17:44:24 +00:00
Devang Patel 656a917ad9 Print debug message only if there are dead passes.
llvm-svn: 52052
2008-06-06 17:50:36 +00:00
Evan Cheng 93af6ce129 More pass manager debugging outputs.
llvm-svn: 51930
2008-06-04 09:13:31 +00:00
Devang Patel ab85d6b6af "Unable to schedule <A> required by <B>" is more helpful then
"Unable to handle Pass that requires lower level Analysis pass"

llvm-svn: 51892
2008-06-03 01:20:02 +00:00
Devang Patel bb4720c43f Add debugging aid.
llvm-svn: 51891
2008-06-03 01:02:16 +00:00
Dan Gohman d78c400b5b Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00