diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -2499,7 +2499,11 @@ "trying to erase instruction with users."); Pair.getFirst()->eraseFromParent(); } - LLVM_DEBUG(verifyFunction(*F)); +#ifdef EXPENSIVE_CHECKS + // If we could guarantee that this call is not extremely slow, we could + // remove the ifdef limitation (see PR47712). + assert(!verifyFunction(*F, %dbgs())); +#endif } void BoUpSLP::eraseInstructions(ArrayRef AV) {