Teach InstCombineLoadCast about address spaces.

This is another one that doesn't matter much,
but uses the right GEP index types in the first
place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2013-09-03 21:05:48 +00:00
parent aa31d35dc7
commit 330943afb7
2 changed files with 24 additions and 3 deletions

View File

@@ -304,8 +304,8 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
if (Constant *CSrc = dyn_cast<Constant>(CastOp))
if (ASrcTy->getNumElements() != 0) {
Type *IdxTy = TD
? TD->getIntPtrType(LI.getContext())
: Type::getInt64Ty(LI.getContext());
? TD->getIntPtrType(SrcTy)
: Type::getInt64Ty(SrcTy->getContext());
Value *Idx = Constant::getNullValue(IdxTy);
Value *Idxs[2] = { Idx, Idx };
CastOp = ConstantExpr::getGetElementPtr(CSrc, Idxs);