[PATCH] D104272: [OpaquePtr] Mangle intrinsics with opaque pointers arguments

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 14 15:05:54 PDT 2021


zequanwu created this revision.
zequanwu added a reviewer: aeubanks.
Herald added subscribers: dexonsmith, hiraditya.
zequanwu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104272

Files:
  llvm/lib/IR/Function.cpp


Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ 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<PointerType>(Ty)) {
-    Result += "p" + utostr(PTyp->getAddressSpace()) +
-              getMangledTypeStr(PTyp->getElementType(), HasUnnamedType);
-  } else if (ArrayType* ATyp = dyn_cast<ArrayType>(Ty)) {
+  if (PointerType *PTyp = dyn_cast<PointerType>(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<ArrayType>(Ty)) {
     Result += "a" + utostr(ATyp->getNumElements()) +
               getMangledTypeStr(ATyp->getElementType(), HasUnnamedType);
   } else if (StructType *STyp = dyn_cast<StructType>(Ty)) {
@@ -809,7 +813,7 @@
       Result += "vararg";
     // Ensure nested function types are distinguishable.
     Result += "f";
-  } else if (VectorType* VTy = dyn_cast<VectorType>(Ty)) {
+  } else if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
     ElementCount EC = VTy->getElementCount();
     if (EC.isScalable())
       Result += "nx";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104272.352005.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210614/8ee815e9/attachment.bin>


More information about the llvm-commits mailing list