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

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 18:24:39 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) {
+    if (!isa<ConstantInt>(getOperand(i)) ||
+        !cast<ConstantInt>(getOperand(i))->isZero())
----------------
vfdff wrote:

Apply your comment, thanks

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


More information about the llvm-commits mailing list