diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -2017,6 +2017,14 @@ ShuffleVectorInst *cloneImpl() const; public: + ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr = "", + Instruction *InsertBefore = nullptr); + ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr, + BasicBlock *InsertAtEnd); + ShuffleVectorInst(Value *V1, ArrayRef Mask, const Twine &NameStr = "", + Instruction *InsertBefore = nullptr); + ShuffleVectorInst(Value *V1, ArrayRef Mask, const Twine &NameStr, + BasicBlock *InsertAtEnd); ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr = "", Instruction *InsertBefor = nullptr); diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -1907,6 +1907,32 @@ // ShuffleVectorInst Implementation //===----------------------------------------------------------------------===// +static Value *createPlaceholderForShuffleVector(Value *V) { + assert(V && "Cannot create placeholder of nullptr V"); + return PoisonValue::get(V->getType()); +} + +ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *Mask, const Twine &Name, + Instruction *InsertBefore) + : ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name, + InsertBefore) {} + +ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *Mask, const Twine &Name, + BasicBlock *InsertAtEnd) + : ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name, + InsertAtEnd) {} + +ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef Mask, + const Twine &Name, + Instruction *InsertBefore) + : ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name, + InsertBefore) {} + +ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef Mask, + const Twine &Name, BasicBlock *InsertAtEnd) + : ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name, + InsertAtEnd) {} + ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &Name, Instruction *InsertBefore)