[PATCH] D12559: Fix IRBuilder CreateBitOrPointerCast for vector types

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 09:33:23 PDT 2015


sbaranga created this revision.
sbaranga added a subscriber: llvm-commits.
Herald added a subscriber: aemerson.

This function was not taking into account that the
input type could be a vector, and wasn't properly
working for vector types.

This caused an assert when building spec2k6 perlbmk for armv8.

http://reviews.llvm.org/D12559

Files:
  include/llvm/IR/IRBuilder.h

Index: include/llvm/IR/IRBuilder.h
===================================================================
--- include/llvm/IR/IRBuilder.h
+++ include/llvm/IR/IRBuilder.h
@@ -1352,11 +1352,13 @@
 
   Value *CreateBitOrPointerCast(Value *V, Type *DestTy,
                                 const Twine &Name = "") {
-    if (V->getType() == DestTy)
+    if (V->getType()->getScalarType() == DestTy->getScalarType())
       return V;
-    if (V->getType()->isPointerTy() && DestTy->isIntegerTy())
+    if (V->getType()->getScalarType()->isPointerTy() &&
+        DestTy->getScalarType()->isIntegerTy())
       return CreatePtrToInt(V, DestTy, Name);
-    if (V->getType()->isIntegerTy() && DestTy->isPointerTy())
+    if (V->getType()->getScalarType()->isIntegerTy() &&
+        DestTy->getScalarType()->isPointerTy())
       return CreateIntToPtr(V, DestTy, Name);
 
     return CreateBitCast(V, DestTy, Name);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12559.33818.patch
Type: text/x-patch
Size: 904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150902/522484a9/attachment.bin>


More information about the llvm-commits mailing list