This resolves an issue posted on Bugzilla. https://bugs.llvm.org/show_bug.cgi?id=48764
This issue took place because loops which did not have an exit block were allowed to unrolled and jam.
This patch ensures that loops which only have an exit block will be allowed to be unrolled and jammed.
Update:
The loop had multiple exit blocks, which resulted in the function getExitBlock to return a nullptr.
This patch ensures that loops which only have one exit block as allowed to be unrolled and jammed.
So shouldn't one of latch successor be an exit block?