Index: llvm/trunk/lib/Analysis/ConstantFolding.cpp =================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp @@ -81,7 +81,7 @@ // Now that we know that the input value is a vector of integers, just shift // and insert them into our result. - unsigned BitShift = DL.getTypeAllocSizeInBits(SrcEltTy); + unsigned BitShift = DL.getTypeSizeInBits(SrcEltTy); APInt Result(IT->getBitWidth(), 0); for (unsigned i = 0; i != NumSrcElts; ++i) { Constant *Element; Index: llvm/trunk/test/Transforms/InstCombine/bitcast.ll =================================================================== --- llvm/trunk/test/Transforms/InstCombine/bitcast.ll +++ llvm/trunk/test/Transforms/InstCombine/bitcast.ll @@ -262,3 +262,10 @@ ; CHECK: bitcast ; CHECK: load } + +define i8 @test8() { + %res = bitcast <8 x i1> to i8 + ret i8 %res +; CHECK: @test8 +; CHECK: ret i8 -85 +}