[LICM] Array Semantics: only hoist kGetCount and kGetCapacity

We can’t hoist everything that is hoist-able

The canHoist method does not do all the required analysis

Some of the work is done at COW Array Opt

TODO: Refactor COW Array Opt + canHoist - radar 41601468
This commit is contained in:
Joe Shajrawi
2018-06-28 14:42:09 -07:00
parent a5e0533c89
commit 437b0d8e13
2 changed files with 12 additions and 1 deletions

View File

@@ -472,8 +472,18 @@ static bool canHoistUpDefault(SILInstruction *inst, SILLoop *Loop,
return false;
}
// We cant hoist everything that is hoist-able
// The canHoist method does not do all the required analysis
// Some of the work is done at COW Array Opt
// TODO: Refactor COW Array Opt + canHoist - radar 41601468
ArraySemanticsCall semCall(inst);
return semCall.canHoist(Preheader->getTerminator(), DT);
switch (semCall.getKind()) {
case ArrayCallKind::kGetCount:
case ArrayCallKind::kGetCapacity:
return semCall.canHoist(Preheader->getTerminator(), DT);
default:
return false;
}
}
// Check If all the end accesses of the given begin do not prevent hoisting