[clang] beee096 - [CGBlocks] Don't assume presence of bitcast

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 07:39:53 PDT 2022


Author: Nikita Popov
Date: 2022-03-23T15:39:39+01:00
New Revision: beee09687f4602dba82a378bad94ed9657c97339

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

LOG: [CGBlocks] Don't assume presence of bitcast

With opaque pointers, the bitcast constexpr will not be present.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGBlocks.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 50f5435ddbcdf..ff6ca0914e0d1 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -216,8 +216,9 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
     llvm::Constant *disposeHelper = buildDisposeHelper(CGM, blockInfo);
     elements.add(disposeHelper);
 
-    if (cast<llvm::Function>(copyHelper->getOperand(0))->hasInternalLinkage() ||
-        cast<llvm::Function>(disposeHelper->getOperand(0))
+    if (cast<llvm::Function>(copyHelper->stripPointerCasts())
+            ->hasInternalLinkage() ||
+        cast<llvm::Function>(disposeHelper->stripPointerCasts())
             ->hasInternalLinkage())
       hasInternalHelper = true;
   }


        


More information about the cfe-commits mailing list