Generate vector constructions more efficiently when sizes match
When two vectors are the same size, there is no need to extract the components and construct a new vector.
This commit is contained in:
parent
2d8b71fc63
commit
33d517470e
13 changed files with 1777 additions and 1867 deletions
|
|
@ -3424,6 +3424,12 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
|
|||
if (sources.size() == 1 && isScalar(sources[0]) && numTargetComponents > 1)
|
||||
return smearScalar(precision, sources[0], resultTypeId);
|
||||
|
||||
// Special case: 2 vectors of equal size
|
||||
if (sources.size() == 1 && isVector(sources[0]) && numTargetComponents == getNumComponents(sources[0])) {
|
||||
assert(resultTypeId == getTypeId(sources[0]));
|
||||
return sources[0];
|
||||
}
|
||||
|
||||
// accumulate the arguments for OpCompositeConstruct
|
||||
std::vector<Id> constituents;
|
||||
Id scalarTypeId = getScalarTypeId(resultTypeId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue