mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Migrate to use new projection for SILmem2reg. This should be a NFC.
This is part of rdar://24520269
This commit is contained in:
@@ -319,19 +319,18 @@ static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads)
|
||||
|
||||
|
||||
static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {
|
||||
ProjectionPath projections;
|
||||
NewProjectionPath projections(val->getType());
|
||||
SILValue op = LI->getOperand();
|
||||
while (op != ASI) {
|
||||
assert(isa<StructElementAddrInst>(op) || isa<TupleElementAddrInst>(op));
|
||||
SILInstruction *Inst = cast<SILInstruction>(op);
|
||||
auto projection = Projection::addressProjectionForInstruction(Inst);
|
||||
projections.push_back(projection.getValue());
|
||||
projections.push_back(NewProjection(Inst));
|
||||
op = Inst->getOperand(0);
|
||||
}
|
||||
SILBuilder builder(LI);
|
||||
for (auto iter = projections.rbegin(); iter != projections.rend(); ++iter) {
|
||||
const Projection &projection = *iter;
|
||||
val = projection.createValueProjection(builder, LI->getLoc(), val).get();
|
||||
const NewProjection &projection = *iter;
|
||||
val = projection.createObjectProjection(builder, LI->getLoc(), val).get();
|
||||
}
|
||||
op = LI->getOperand();
|
||||
LI->replaceAllUsesWith(val);
|
||||
|
||||
Reference in New Issue
Block a user