[llvm] [DirectX] Resources and simple GEP traversal in DXILMemIntrinsics (PR #173054)
Damyan Pepper via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 22 09:02:22 PST 2025
================
@@ -60,6 +62,53 @@ void expandMemSet(MemSetInst *MemSet) {
MemSet->eraseFromParent();
}
+static Type *getPointeeType(Value *Ptr, const DataLayout &DL) {
+ if (auto *GV = dyn_cast<GlobalVariable>(Ptr))
+ return GV->getValueType();
+ if (auto *AI = dyn_cast<AllocaInst>(Ptr))
+ return AI->getAllocatedType();
+
+ if (auto *II = dyn_cast<IntrinsicInst>(Ptr)) {
+ if (II->getIntrinsicID() == Intrinsic::dx_resource_getpointer) {
+ Type *Ty = cast<dxil::AnyResourceExtType>(II->getArgOperand(0)->getType())
+ ->getResourceType();
+ assert(Ty && "getpointer used on untyped resource");
+ return Ty;
+ }
+ }
+
+ if (auto *GEP = dyn_cast<GEPOperator>(Ptr)) {
+ Type *Ty = GEP->getResultElementType();
+ if (!Ty->isIntegerTy(8))
+ return Ty;
----------------
damyanp wrote:
Is it obvious why 8-bit ints are different?
https://github.com/llvm/llvm-project/pull/173054
More information about the llvm-commits
mailing list