[PATCH] D104950: [OpaquePtr] Support forward references in textual IR

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 09:49:29 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:1463
+  // RAUW it later with a global/function of the correct type.
+  Type *ElemTy = PTy->isOpaque() ? Type::getInt8Ty(M->getContext())
+                                 : PTy->getElementType();
----------------
aeubanks wrote:
> aeubanks wrote:
> > With --force-opaque-pointers, we never get to `Function::Create()`. Can we always create a GlobalVariable (or always create a Function) and RAUW with the proper GlobalVariable/Function later?
> now we could always use a GlobalVariable even without opaque pointers right?
> probably doesn't really matter
It's not possible to create a GlobalVariable of function type, so we do need to distinguish the cases. For non-opaque pointers matching the type is important, because using a different type would requite a pointer bitcast. For opaque pointers, this doesn't matter.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104950/new/

https://reviews.llvm.org/D104950



More information about the llvm-commits mailing list