Can't add Merge Duplicate Global Constants pass


I have a program similar to kaleidoscope with same optimization passes.
It works fine. But when I tried to add Constant Merge Pass with a line:


the program died with segmentation fault.
Then I tried to add the same line to native kaleidoscope from and I've got
the same segmentation fault.

The backtrace log from gdb is:
#0 0x085609e7 in llvm::ModulePass::assignPassManager ()
#1 0x0856672b in llvm::FunctionPassManagerImpl::addTopLevelPass ()
#2 0x0855f651 in llvm::PMTopLevelManager::schedulePass ()
#3 0x0855f73e in llvm::FunctionPassManager::add ()
#4 0x0804ff19 in main () at toy.cpp:587

So what's wrong with createConstantMergePass?
My OS is FreeBSD, llvm version is 2.3 release.

Also I have two notices about LLVM documentation:
1. Kaleidoscope language tutorial is really cool and very inspiring!
    But the only way I could find to get kaleidoscope source is to
copy it with a mouse
    from browser window and it's inconvenient and a bit tricky. So it
would be nice to put
    kaleidoscope source files (toy.cpp) for direct downloading.
2. There is a nice description of optimizations and analyses implemented in LLVM
    at page. But there are no names
of functions
    which create the passes. It was difficult to find those names in
sources because
    name of the function which creates pass is not always similar to
the name of the pass
    itself: Merge Duplicate Global Constants and
createConstantMergePass for example.
    So it would be nice to put those names in the Passes.html page.

Thanks anyway! LLVM is a great project!
Best regards

OurFPM is a FunctionPassManager, right? You can't stuff a
module-level pass into a FunctionPassManager. Try using a