forked from OSchip/llvm-project
[IR] Add the constructor of ShuffleVector for one-input-vector.
One of the two inputs of the Shufflevector is often a placeholder. Previously, there were cases where the placeholder was undef, and there were cases where it was poison. I added these constructors to create a placeholder consistently. Changing to use the newly added constructor will be written in a separate patch. Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D110146
This commit is contained in:
parent
e9ea03c62c
commit
043733d677
|
@ -2017,6 +2017,14 @@ protected:
|
|||
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<int> Mask, const Twine &NameStr = "",
|
||||
Instruction *InsertBefore = nullptr);
|
||||
ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr,
|
||||
BasicBlock *InsertAtEnd);
|
||||
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
||||
const Twine &NameStr = "",
|
||||
Instruction *InsertBefor = nullptr);
|
||||
|
|
|
@ -1907,6 +1907,32 @@ bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
|
|||
// 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<int> Mask,
|
||||
const Twine &Name,
|
||||
Instruction *InsertBefore)
|
||||
: ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
|
||||
InsertBefore) {}
|
||||
|
||||
ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef<int> 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)
|
||||
|
|
Loading…
Reference in New Issue