mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
SROA: Generate selects instead of shuffles when blending values because this is the cannonical form.
Shuffles are more difficult to lower and we usually don't touch them, while we do optimize selects more often. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180875 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2322,17 +2322,15 @@ static Value *insertVector(IRBuilderTy &IRB, Value *Old, Value *V,
|
||||
V = IRB.CreateShuffleVector(V, UndefValue::get(V->getType()),
|
||||
ConstantVector::get(Mask),
|
||||
Name + ".expand");
|
||||
DEBUG(dbgs() << " shuffle1: " << *V << "\n");
|
||||
DEBUG(dbgs() << " shuffle: " << *V << "\n");
|
||||
|
||||
Mask.clear();
|
||||
for (unsigned i = 0; i != VecTy->getNumElements(); ++i)
|
||||
if (i >= BeginIndex && i < EndIndex)
|
||||
Mask.push_back(IRB.getInt32(i));
|
||||
else
|
||||
Mask.push_back(IRB.getInt32(i + VecTy->getNumElements()));
|
||||
V = IRB.CreateShuffleVector(V, Old, ConstantVector::get(Mask),
|
||||
Name + "insert");
|
||||
DEBUG(dbgs() << " shuffle2: " << *V << "\n");
|
||||
Mask.push_back(IRB.getInt1(i >= BeginIndex && i < EndIndex));
|
||||
|
||||
V = IRB.CreateSelect(ConstantVector::get(Mask), V, Old, Name + "blend");
|
||||
|
||||
DEBUG(dbgs() << " blend: " << *V << "\n");
|
||||
return V;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user