[ConstantFold] Fix bitcast to gep constant folding transform.
[oota-llvm.git] / lib / IR / ConstantFold.cpp
index 68ddf096754733cd6d308cc1807471c086731609..979bbbd0ab7ddfad3818e49555a441f38a6f12f0 100644 (file)
@@ -109,7 +109,7 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
   if (PointerType *PTy = dyn_cast<PointerType>(V->getType()))
     if (PointerType *DPTy = dyn_cast<PointerType>(DestTy))
       if (PTy->getAddressSpace() == DPTy->getAddressSpace()
-          && DPTy->getElementType()->isSized()) {
+          && PTy->getElementType()->isSized()) {
         SmallVector<Value*, 8> IdxList;
         Value *Zero =
           Constant::getNullValue(Type::getInt32Ty(DPTy->getContext()));