diff --git a/llvm/include/llvm/Analysis/LoopInfoImpl.h b/llvm/include/llvm/Analysis/LoopInfoImpl.h index 0730225c342fe6..426b349c6b8a9f 100644 --- a/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -673,7 +673,8 @@ static void compareLoops(const LoopT *L, const LoopT *OtherL, "Mismatched basic blocks in the loops!"); const SmallPtrSetImpl &BlocksSet = L->getBlocksSet(); - const SmallPtrSetImpl &OtherBlocksSet = L->getBlocksSet(); + const SmallPtrSetImpl &OtherBlocksSet = + OtherL->getBlocksSet(); assert(BlocksSet.size() == OtherBlocksSet.size() && llvm::all_of(BlocksSet, [&OtherBlocksSet](const BlockT *BB) {