[PATCH] D133283: [DirectX backend] Support global ctor for DXILBitcodeWriter.

Xiang Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 14:43:23 PDT 2022


python3kgae marked 4 inline comments as done.
python3kgae added inline comments.


================
Comment at: llvm/lib/Target/DirectX/PointerTypeAnalysis.cpp:83
+      Type *NewRetTy = classifyPointerType(RetInst->getReturnValue());
+      if (!RetTy && !NewRetTy)
+        RetTy = NewRetTy;
----------------
beanz wrote:
> This confuses me. `RetTy` starts as `nullptr`, if `NewRetTy` is also `nullptr` we set `RetTy` to `nullptr`? Unless I'm missing something this does nothing.
> 
> This changes the logic in the loop body, but not in a way that is clear to follow.
> 
> If I'm reading this logic correctly, I don't see how this function ever returns anything other than `i8*`. You enter the loop `RetTy` is `nullptr`. If `NewRetTy` is anything, you have a mismatch, and get `i8*`.
Reverted.


================
Comment at: llvm/lib/Target/DirectX/PointerTypeAnalysis.cpp:107
 
+static void classifyGlobalCtorPointerType(const GlobalVariable &GV,
+                                          PointerTypeMap &Map) {
----------------
beanz wrote:
> Is there a more generic way to do this? I feel like this more or less hard codes the type.
Not sure how to support Constant with typed pointer type { i32, void ()*, i8* } and {
 i32, float (float)*, i8* } map to same Constant with opaque pointer type
 {i32, ptr, ptr} yet.
Mark as FIXME for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133283



More information about the llvm-commits mailing list