[PATCH] D21735: [ConstantFolding] Fix bitcast vector of i1
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 26 23:49:53 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273845: [ConstantFolding] Fix bitcast vector of i1. (authored by ibreger).
Changed prior to commit:
http://reviews.llvm.org/D21735?vs=61911&id=61933#toc
Repository:
rL LLVM
http://reviews.llvm.org/D21735
Files:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/test/Transforms/InstCombine/bitcast.ll
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> <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
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21735.61933.patch
Type: text/x-patch
Size: 1073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160627/6f3be6d8/attachment.bin>
More information about the llvm-commits
mailing list