[llvm] 479d684 - [Coroutines] Support opaque pointers in solveTypeName()

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 00:34:02 PST 2022


Author: Nikita Popov
Date: 2022-03-10T09:33:55+01:00
New Revision: 479d684ba53e70fe39d002482a00ae007a3d64cd

URL: https://github.com/llvm/llvm-project/commit/479d684ba53e70fe39d002482a00ae007a3d64cd
DIFF: https://github.com/llvm/llvm-project/commit/479d684ba53e70fe39d002482a00ae007a3d64cd.diff

LOG: [Coroutines] Support opaque pointers in solveTypeName()

As far as I can tell, these names are only intended to be
informative, so just use a generic "PointerType" for opaque pointers.

The code in solveDIType() also treats pointers as basic types (and
does not try to encode the pointed-to type further), so I believe
this should be fine.

Differential Revision: https://reviews.llvm.org/D121280

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index ee88e95924b90..c2f4fe071dd6a 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -808,9 +808,10 @@ static StringRef solveTypeName(Type *Ty) {
     return "__floating_type_";
   }
 
-  if (Ty->isPointerTy()) {
-    auto *PtrTy = cast<PointerType>(Ty);
-    Type *PointeeTy = PtrTy->getPointerElementType();
+  if (auto *PtrTy = dyn_cast<PointerType>(Ty)) {
+    if (PtrTy->isOpaque())
+      return "PointerType";
+    Type *PointeeTy = PtrTy->getNonOpaquePointerElementType();
     auto Name = solveTypeName(PointeeTy);
     if (Name == "UnknownType")
       return "PointerType";


        


More information about the llvm-commits mailing list