diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 98bc9425f45..ede89563717 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -990,6 +990,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, } assert(LoadedTy->isFirstClassType()); + if (Indices.size() == 1) + Indices.clear(); // Do not generate load X, 0 + Res = new LoadInst(NewVal, Indices, Name); assert(Res->getType()->isFirstClassType() && "Load of structure or array!"); break;