From c2a537bd08d9deedefe184c9fb887c6d30ae9fd2 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Fri, 21 Dec 2012 01:24:36 +0000 Subject: [PATCH] BB-Vectorizer: Check the cost of the store pointer type and not the return type, which is void. A number of test cases fail after adding the assertion in TTImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170828 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/TargetTransformImpl.cpp | 1 + lib/Transforms/Vectorize/BBVectorize.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Target/TargetTransformImpl.cpp b/lib/Target/TargetTransformImpl.cpp index 7f9fdfc938f..43204370202 100644 --- a/lib/Target/TargetTransformImpl.cpp +++ b/lib/Target/TargetTransformImpl.cpp @@ -340,6 +340,7 @@ unsigned VectorTargetTransformImpl::getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace) const { + assert(!Src->isVoidTy() && "Invalid type"); std::pair LT = getTypeLegalizationCost(Src); // Assume that all loads of legal types cost 1. diff --git a/lib/Transforms/Vectorize/BBVectorize.cpp b/lib/Transforms/Vectorize/BBVectorize.cpp index a48229132b6..ee3202a3624 100644 --- a/lib/Transforms/Vectorize/BBVectorize.cpp +++ b/lib/Transforms/Vectorize/BBVectorize.cpp @@ -968,9 +968,9 @@ namespace { } if (VTTI) { - unsigned ICost = VTTI->getMemoryOpCost(I->getOpcode(), I->getType(), + unsigned ICost = VTTI->getMemoryOpCost(I->getOpcode(), aTypeI, IAlignment, IAddressSpace); - unsigned JCost = VTTI->getMemoryOpCost(J->getOpcode(), J->getType(), + unsigned JCost = VTTI->getMemoryOpCost(J->getOpcode(), aTypeJ, JAlignment, JAddressSpace); unsigned VCost = VTTI->getMemoryOpCost(I->getOpcode(), VType, BottomAlignment, -- 2.34.1