ABCOpts: Bail out if we don't know how-to hoist an array operation

Instead of assuming we see only certain forms IR.

rdar://28204253
This commit is contained in:
Arnold Schwaighofer
2016-09-19 10:15:14 -07:00
parent 6132819f59
commit 3c755e36aa
2 changed files with 51 additions and 0 deletions

View File

@@ -1010,6 +1010,10 @@ static bool hoistChecksInLoop(DominanceInfo *DT, DominanceInfoNode *DTNode,
if (!ArrayIndex)
continue;
// Make sure we know how-to hoist the array call.
if (!ArrayCall.canHoist(Preheader->getTerminator(), DT))
continue;
// Invariant check.
if (blockAlwaysExecutes && dominates(DT, ArrayIndex, Preheader)) {
assert(ArrayCall.canHoist(Preheader->getTerminator(), DT) &&