[llvm] Decompose gep of complex type struct to its element type (PR #107848)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 18:53:25 PDT 2024


================
@@ -1555,6 +1555,17 @@ bool GetElementPtrInst::hasAllConstantIndices() const {
   return true;
 }
 
+/// hasAllZeroIndicesExceptLast - Return true if all of the indices of this GEP
+/// are zero except the last indice.
+bool GetElementPtrInst::hasAllZeroIndicesExceptLast() const {
+  for (unsigned i = 1, e = getNumOperands() - 1; i != e; ++i) {
+    ConstantInt *Val = dyn_cast<ConstantInt>(getOperand(i));
----------------
vfdff wrote:

ok, also add a vector case

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


More information about the llvm-commits mailing list