aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-14 19:30:32 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-14 19:30:32 +0000
commit59be1d653ae63bcb0146151a70513ca39e241647 (patch)
tree7a7fd90a51b578dc054cdea4b8563b9daef897bc /llvm/lib/IR/ConstantFold.cpp
parent45ea8fa1f423a9d44be1152263eec986ca5773ee (diff)
downloadllvm-59be1d653ae63bcb0146151a70513ca39e241647.zip
llvm-59be1d653ae63bcb0146151a70513ca39e241647.tar.gz
llvm-59be1d653ae63bcb0146151a70513ca39e241647.tar.bz2
[ConstantFold] Fix bitcast to gep constant folding transform.
Make sure to check that the destination type is sized. A check was present but was incorrectly checking the source type instead. Patch by Amaury SECHET! Differential Revision: http://reviews.llvm.org/D15264 llvm-svn: 255536
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 68ddf09..979bbbd 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -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()));