[llvm] [DirectX] Limit GEP transformations to Arrays (PR #145758)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 12:35:37 PDT 2025


================
@@ -308,9 +308,8 @@ bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
     NeedsTransform = true;
   } else if (AllocaInst *Alloca = dyn_cast<AllocaInst>(PtrOperand)) {
     Type *AllocatedType = Alloca->getAllocatedType();
-    // OrigGEPType might just be a pointer lets make sure
-    // to add the allocated type so we have a size
-    if (AllocatedType != OrigGEPType) {
+    // Only transform if the allocated type is an array
+    if (AllocatedType != OrigGEPType && isa<ArrayType>(AllocatedType)) {
----------------
farzonl wrote:

We can’t be see the description. The type has already changed by the time we see the gep.

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


More information about the llvm-commits mailing list