[llvm] Decompose gep of complex type struct to its element type (PR #107848)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 21:12:24 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));
----------------
arsenm wrote:
Your vector test is not a vector test. This code will not work for a vector of pointers typed getelementptr
https://github.com/llvm/llvm-project/pull/107848
More information about the llvm-commits
mailing list