diff options
Diffstat (limited to 'llvm/lib/VMCore/iMemory.cpp')
| -rw-r--r-- | llvm/lib/VMCore/iMemory.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/iMemory.cpp b/llvm/lib/VMCore/iMemory.cpp index 1fc1df8c95b..32fe71a0862 100644 --- a/llvm/lib/VMCore/iMemory.cpp +++ b/llvm/lib/VMCore/iMemory.cpp @@ -156,6 +156,14 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr, return 0; // Can only index into pointer types at the first index! if (!CT->indexValid(Index)) return 0; Ptr = CT->getTypeAtIndex(Index); + + // If the new type forwards to another type, then it is in the middle + // of being refined to another type (and hence, may have dropped all + // references to what it was using before). So, use the new forwarded + // type. + if (Ptr->getForwardedType()) { + Ptr = Ptr->getForwardedType(); + } } return CurIdx == Idx.size() ? Ptr : 0; } |

