Assertion failure on region analysis

Hi all,

I ran across an assertion failure while using region analysis in my passes.
I get the same thing when doing: opt -regions -analyze

[...]
[1] entry => if.end
End region tree
Printing analysis 'Detect single entry single exit regions' for function 'njDecodeSOF':
Region tree:
[0] entry => <Function Return>
[1] entry => return
[2] if.end => return
[3] if.end6 => return
[4] sw.epilog => return
[5] for.cond => return
[6] if.end62 => if.end69
[6] if.end69 => if.end75
[6] for.end => if.end81
[6] for.cond88 => return
[7] for.end143 => return
End region tree
opt: /home/towelie/Tools/LLVM/llvm/lib/Analysis/RegionInfo.cpp:86: bool llvm::Region::contains(const llvm::BasicBlock *) const: Assertion `DT->getNode(BB) && "BB not part of the dominance tree"' failed.
0 opt 0x0000000000bc715e
1 opt 0x0000000000bc765a
2 libpthread.so.0 0x00007fe7ed96d420
3 libc.so.6 0x00007fe7ed17cb45 gsignal + 53
4 libc.so.6 0x00007fe7ed17dfc6 abort + 390
5 libc.so.6 0x00007fe7ed1758ce
6 libc.so.6 0x00007fe7ed175990 __assert_perror_fail + 0
7 opt 0x0000000000921a70 llvm::Region::contains(llvm::BasicBlock const*) const + 96
8 opt 0x0000000000921f2e llvm::Region::getExitingBlock() const + 142
9 opt 0x0000000000921fd9 llvm::Region::isSimple() const + 73
10 opt 0x00000000009244dc llvm::RegionInfo::updateStatistics(llvm::Region*) + 44
11 opt 0x0000000000924657 llvm::RegionInfo::createRegion(llvm::BasicBlock*, llvm::BasicBlock*) + 327
12 opt 0x0000000000924766 llvm::RegionInfo::findRegionsWithEntry(llvm::BasicBlock*, llvm::DenseMap<llvm::BasicBlock*, llvm::BasicBlock*, llvm::DenseMapInfo<llvm::BasicBlock*> >*) + 246
13 opt 0x00000000009248c0 llvm::RegionInfo::scanForRegions(llvm::Function&, llvm::DenseMap<llvm::BasicBlock*, llvm::BasicBlock*, llvm::DenseMapInfo<llvm::BasicBlock*> >*) + 208
14 opt 0x0000000000924d6c llvm::RegionInfo::Calculate(llvm::Function&) + 60
15 opt 0x0000000000924e7c llvm::RegionInfo::runOnFunction(llvm::Function&) + 204
16 opt 0x0000000000b4548a llvm::FPPassManager::runOnFunction(llvm::Function&) + 442
17 opt 0x0000000000b4578d llvm::FPPassManager::runOnModule(llvm::Module&) + 125
18 opt 0x0000000000b459dd llvm::MPPassManager::runOnModule(llvm::Module&) + 493
19 opt 0x0000000000b46097 llvm::PassManagerImpl::run(llvm::Module&) + 167
20 opt 0x0000000000b46281 llvm::PassManager::run(llvm::Module&) + 33
21 opt 0x00000000005502cb main + 6491
22 libc.so.6 0x00007fe7ed1692ad __libc_start_main + 253
23 opt 0x000000000053fa85
Stack dump:
0. Program arguments: opt -regions -analyze nj.o
1. Running pass 'Function Pass Manager' on module 'nj.o'.
2. Running pass 'Detect single entry single exit regions' on function '@njDecodeDHT'
Aborted

However it seems to work fine on version 3.1.

Hi ,
It will be good ,If you get us the sample that assert.

Thanks
~Umesh

Hi,

You can get the reduced bc file by bugpoint.

best regards
ether