diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/BBVectorize.cpp | 12 |
2 files changed, 23 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 54c76887234..a70d6d769b7 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/ValueMapper.h" +#include "llvm/IR/CallSite.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/InlineAsm.h" @@ -384,6 +385,16 @@ void llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap, } // If the instruction's type is being remapped, do so now. - if (TypeMapper) + if (auto CS = CallSite(I)) { + SmallVector<Type *, 3> Tys; + FunctionType *Old = CS.getFunctionType(); + unsigned NumOld = Old->getNumParams(); + assert(NumOld <= CS.arg_size()); + for (unsigned i = 0; i != NumOld; ++i) + Tys.push_back(CS.getArgument(i)->getType()); + CS.mutateFunctionType(FunctionType::get( + TypeMapper ? TypeMapper->remapType(I->getType()) : I->getType(), Tys, + Old->isVarArg())); + } else if (TypeMapper) I->mutateType(TypeMapper->remapType(I->getType())); } diff --git a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp index 29fb01f1b2e..6f0180e7db0 100644 --- a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp @@ -3103,7 +3103,17 @@ namespace { else if (H->hasName()) K->takeName(H); - if (!isa<StoreInst>(K)) + if (auto CS = CallSite(K)) { + SmallVector<Type *, 3> Tys; + FunctionType *Old = CS.getFunctionType(); + unsigned NumOld = Old->getNumParams(); + assert(NumOld <= ReplacedOperands.size()); + for (unsigned i = 0; i != NumOld; ++i) + Tys.push_back(ReplacedOperands[i]->getType()); + CS.mutateFunctionType( + FunctionType::get(getVecTypeForPair(L->getType(), H->getType()), + Tys, Old->isVarArg())); + } else if (!isa<StoreInst>(K)) K->mutateType(getVecTypeForPair(L->getType(), H->getType())); unsigned KnownIDs[] = { |

