[llvm] [DirectX] Support ConstExpr GEPs (PR #148986)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 11:33:25 PDT 2025


================
@@ -305,6 +305,33 @@ bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
   Type *OrigGEPType = GEPI.getSourceElementType();
   Type *NewGEPType = OrigGEPType;
   bool NeedsTransform = false;
+  // Check if the pointer operand is a ConstantExpr GEP
+  if (auto *PtrOpGEPCE = dyn_cast<ConstantExpr>(PtrOperand);
+      PtrOpGEPCE && PtrOpGEPCE->getOpcode() == Instruction::GetElementPtr) {
+    if (GlobalVariable *NewGlobal =
----------------
farzonl wrote:

This PR supercedes this one and will fix the multilple nesting case: https://github.com/llvm/llvm-project/pull/150082

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


More information about the llvm-commits mailing list