[PATCH] D15264: Fix bitcast to gep constant folding transform.

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 5 21:56:38 PST 2015


deadalnix created this revision.
deadalnix added reviewers: sunfish, craig.topper, spatel, nlewycky, majnemer, meadori.
deadalnix added a subscriber: llvm-commits.

It is checking is the destination type is sized, when the source type is the one that shoul dbe checked. It cause assertion failure down the road is the source type is unsized but destination type is.

http://reviews.llvm.org/D15264

Files:
  lib/IR/ConstantFold.cpp

Index: lib/IR/ConstantFold.cpp
===================================================================
--- lib/IR/ConstantFold.cpp
+++ lib/IR/ConstantFold.cpp
@@ -109,7 +109,7 @@
   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()));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15264.42003.patch
Type: text/x-patch
Size: 597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151206/69c12c08/attachment.bin>


More information about the llvm-commits mailing list