[ConstantFolding] Fix bitcast vector of i1.

Differential Revision: http://reviews.llvm.org/D21735

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Igor Breger 2016-06-27 06:42:54 +00:00
parent 00fd9cb07c
commit baa0bfe5d8
2 changed files with 8 additions and 1 deletions

View File

@ -81,7 +81,7 @@ Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) {
// 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;

View File

@ -262,3 +262,10 @@ define <2 x i64> @test7(<2 x i8*>* %arg) nounwind {
; CHECK: bitcast
; CHECK: load
}
define i8 @test8() {
%res = bitcast <8 x i1> <i1 true, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true> to i8
ret i8 %res
; CHECK: @test8
; CHECK: ret i8 -85
}