[llvm] [CodeExtractor] Allow to use 0 addr space for aggregate arg (PR #66998)

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 14:43:56 PDT 2023


================
@@ -1186,8 +1188,15 @@ CallInst *CodeExtractor::emitCallAndSwitchStatement(Function *newFunction,
         StructArgTy, DL.getAllocaAddrSpace(), nullptr, "structArg",
         AllocationBlock ? &*AllocationBlock->getFirstInsertionPt()
                         : &codeReplacer->getParent()->front().front());
-    params.push_back(Struct);
 
+    if (ArgsInZeroAddressSpace && DL.getAllocaAddrSpace() != 0) {
+      AddrSpaceCastInst *StructSpaceCast = new AddrSpaceCastInst(
+          Struct, Struct->getType()->getPointerTo(), "structArg.ascast");
----------------
jdoerfert wrote:

auto, and just PointerTy, let's embrace opaque ptrs.

https://github.com/llvm/llvm-project/pull/66998


More information about the llvm-commits mailing list