[llvm-branch-commits] [llvm-branch] r223636 - Merging rr221501:

David Majnemer david.majnemer at gmail.com
Mon Dec 8 00:49:20 PST 2014


Author: majnemer
Date: Mon Dec  8 02:49:20 2014
New Revision: 223636

URL: http://llvm.org/viewvc/llvm-project?rev=223636&view=rev
Log:
Merging rr221501:
------------------------------------------------------------------------
r221501 | majnemer | 2014-11-06 16:31:14 -0800 (Thu, 06 Nov 2014) | 7 lines

LoopVectorize: Don't assume pointees are sized

A pointer's pointee might not be sized: the pointee could be a function.

Report this as IK_NoInduction when calculating isInductionVariable.

This fixes PR21508.
------------------------------------------------------------------------

Added:
    llvm/branches/release_35/test/Transforms/LoopVectorize/unsized-pointee-crash.ll
      - copied unchanged from r221501, llvm/trunk/test/Transforms/LoopVectorize/unsized-pointee-crash.ll
Modified:
    llvm/branches/release_35/   (props changed)
    llvm/branches/release_35/lib/Transforms/Vectorize/LoopVectorize.cpp

Propchange: llvm/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec  8 02:49:20 2014
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,213653,213665,213726,213749,213773,213793,213798-213799,213815,213847,213880,213883-213884,213894-213896,213899,213915,213966,213999,214060,214129,214180,214287,214331,214423,214429,214519,214670,214674,214679,215685,215711,215806,216064,216262,216531,216920,217257,218745,221009,221408,221453,222338,222376,223163,223170-223171
+/llvm/trunk:155241,213653,213665,213726,213749,213773,213793,213798-213799,213815,213847,213880,213883-213884,213894-213896,213899,213915,213966,213999,214060,214129,214180,214287,214331,214423,214429,214519,214670,214674,214679,215685,215711,215806,216064,216262,216531,216920,217257,218745,221009,221408,221453,221501,222338,222376,223163,223170-223171

Modified: llvm/branches/release_35/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=223636&r1=223635&r2=223636&view=diff
==============================================================================
--- llvm/branches/release_35/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/branches/release_35/lib/Transforms/Vectorize/LoopVectorize.cpp Mon Dec  8 02:49:20 2014
@@ -5201,7 +5201,13 @@ LoopVectorizationLegality::isInductionVa
     return IK_NoInduction;
 
   assert(PhiTy->isPointerTy() && "The PHI must be a pointer");
-  uint64_t Size = DL->getTypeAllocSize(PhiTy->getPointerElementType());
+  Type *PointerElementType = PhiTy->getPointerElementType();
+  // The pointer stride cannot be determined if the pointer element type is not
+  // sized.
+  if (!PointerElementType->isSized())
+    return IK_NoInduction;
+
+  uint64_t Size = DL->getTypeAllocSize(PointerElementType);
   if (C->getValue()->equalsInt(Size))
     return IK_PtrInduction;
   else if (C->getValue()->equalsInt(0 - Size))





More information about the llvm-branch-commits mailing list