Commit Graph

3 Commits

Author SHA1 Message Date
Michael Gottesman
fa54b111b2 [siloptimizer] Add support for replaceAllInstUsesPairwiseWith to InstModCallbacks.
NOTE: Just like with RAUW, if setUseValueFunc is nullptr, we call
SILInstruction::replaceALlInstUsesPairwiseWith to ensure good performance.
2021-07-22 16:06:49 -07:00
Andrew Trick
0407a4e34a Add UpdatingInstructionIterator.
Track in-use iterators and update them both when instructions are
deleted and when they are added.

Safe iteration in the presence of arbitrary changes now looks like
this:

    for (SILInstruction *inst : deleter.updatingRange(&bb)) {
      modify(inst);
    }
2021-06-02 07:38:27 -07:00
Andrew Trick
4a8cb7a42b Move InstModCallbacks into its own header.
Required to break circular dependence when introducing
UpdatingInstructionIterator.

Also, this is a lot of detail that doesn't belong in the general
InstOptUtils APIs. It's not something people should ever reach for.
2021-06-02 07:38:27 -07:00