diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -677,6 +677,10 @@ } } + // Avoid unnecessary work if there are no matrix intrinsics in the function. + if (WorkList.empty()) + return false; + // Propagate shapes until nothing changes any longer. while (!WorkList.empty()) { WorkList = propagateShapeForward(WorkList);