diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -781,10 +781,14 @@ /// indicating that extra care must be taken to ensure a unique name. static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType) { std::string Result; - if (PointerType* PTyp = dyn_cast(Ty)) { - Result += "p" + utostr(PTyp->getAddressSpace()) + - getMangledTypeStr(PTyp->getElementType(), HasUnnamedType); - } else if (ArrayType* ATyp = dyn_cast(Ty)) { + if (PointerType *PTyp = dyn_cast(Ty)) { + if (PTyp->isOpaque()) { + Result += "op" + utostr(PTyp->getAddressSpace()); + } else { + Result += "p" + utostr(PTyp->getAddressSpace()) + + getMangledTypeStr(PTyp->getElementType(), HasUnnamedType); + } + } else if (ArrayType *ATyp = dyn_cast(Ty)) { Result += "a" + utostr(ATyp->getNumElements()) + getMangledTypeStr(ATyp->getElementType(), HasUnnamedType); } else if (StructType *STyp = dyn_cast(Ty)) { @@ -809,7 +813,7 @@ Result += "vararg"; // Ensure nested function types are distinguishable. Result += "f"; - } else if (VectorType* VTy = dyn_cast(Ty)) { + } else if (VectorType *VTy = dyn_cast(Ty)) { ElementCount EC = VTy->getElementCount(); if (EC.isScalable()) Result += "nx";