Index: llvm/trunk/lib/Analysis/ConstantFolding.cpp =================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp @@ -515,7 +515,7 @@ MapTy = Type::getInt64Ty(C->getContext()); else if (LoadTy->isVectorTy()) { MapTy = PointerType::getIntNTy(C->getContext(), - DL.getTypeAllocSizeInBits(LoadTy)); + DL.getTypeSizeInBits(LoadTy)); } else return nullptr; Index: llvm/trunk/test/Transforms/InstSimplify/load.ll =================================================================== --- llvm/trunk/test/Transforms/InstSimplify/load.ll +++ llvm/trunk/test/Transforms/InstSimplify/load.ll @@ -28,3 +28,13 @@ %load = load <8 x i32>, <8 x i32>* bitcast (i32* getelementptr ([8 x i32], [8 x i32]* @GV, i64 0, i64 -1) to <8 x i32>*) ret <8 x i32> %load } + +@constvec = internal constant <3 x float> + +; This does an out of bounds load from the global constant +define <3 x float> @load_vec3() { +; CHECK-LABEL: @load_vec3( +; CHECK-NEXT: ret <3 x float> undef + %1 = load <3 x float>, <3 x float>* getelementptr inbounds (<3 x float>, <3 x float>* @constvec, i64 1) + ret <3 x float> %1 +}