[PATCH] D122268: Add PointerType analysis for DirectX backend

Xiang Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 12:02:22 PDT 2022


python3kgae added inline comments.


================
Comment at: llvm/lib/Target/DirectX/PointerTypeAnalysis.cpp:28
+  }
+  for (auto &Use : V->uses()) {
+    Type *NewPointeeTy = nullptr;
----------------
Why not use V->users() when all the access of Use are Use.getUser()?


================
Comment at: llvm/lib/Target/DirectX/PointerTypeAnalysis.cpp:36
+      NewPointeeTy = Inst->getSourceElementType();
+    } else if (auto *Inst = dyn_cast<AllocaInst>(Use.getUser())) {
+      NewPointeeTy = Inst->getAllocatedType();
----------------
Could a ptr used by AllocaInst?


================
Comment at: llvm/lib/Target/DirectX/PointerTypeAnalysis.cpp:40
+    if (NewPointeeTy) {
+      if (NewPointeeTy->isOpaquePointerTy())
+        return PointerType::get(classifyPointerType(Use.getUser()),
----------------
In what case NewPointeeTy will be opaque?


================
Comment at: llvm/lib/Target/DirectX/PointerTypeAnalysis.cpp:50
+  // If we were unable to determine the pointee type, set to i8
+  if (!PointeeTy)
+    PointeeTy = Type::getInt8Ty(V->getContext());
----------------
In what case the pointee type cannot be determined?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122268



More information about the llvm-commits mailing list