[llvm] [SeparateConstOffsetFromGEP] Support GEP reordering for different types (PR #90802)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 12:55:37 PDT 2024


================
@@ -985,9 +985,10 @@ bool SeparateConstOffsetFromGEP::reorderGEP(GetElementPtrInst *GEP,
   if (PtrGEPType->isAggregateType() || PtrGEP->getNumIndices() != 1)
     return false;
 
-  // TODO: support reordering for non-trivial GEP chains
-  if (PtrGEPType != GEPType ||
-      PtrGEP->getSourceElementType() != GEP->getSourceElementType())
+  bool GEPIsPtr = GEPType->getScalarType()->isPointerTy();
+  bool PtrGEPIsPtr = PtrGEPType->getScalarType()->isPointerTy();
----------------
arsenm wrote:

isPtrOrPtrVectorTy 

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


More information about the llvm-commits mailing list