diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 375be2a22042..93a29fde9963 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -428,7 +428,7 @@ std::string GCOVProfiler::mangleName(const DICompileUnit *CU, bool ThreeElement = N->getNumOperands() == 3; if (!ThreeElement && N->getNumOperands() != 2) continue; - if (N->getOperand(ThreeElement ? 2 : 1) != CU) + if (dyn_cast(N->getOperand(ThreeElement ? 2 : 1)) != CU) continue; if (ThreeElement) {