[opaque pointer type] Track explicit GEP pointee type through in-memory IR
[oota-llvm.git] / lib / Transforms / InstCombine / InstructionCombining.cpp
index f62941fbf64268262cb4fad0966a6ffa91dd3fb3..53ab81dbef2dbed2a1a1ebaa47e8f2735dd6f47e 100644 (file)
@@ -1602,6 +1602,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
             // is a leading zero) we can fold the cast into this GEP.
             if (StrippedPtrTy->getAddressSpace() == GEP.getAddressSpace()) {
               GEP.setOperand(0, StrippedPtr);
+              GEP.setSourceElementType(XATy);
               return &GEP;
             }
             // Cannot replace the base pointer directly because StrippedPtr's