Hey!

With my last patch, we only have 3 instances of dominator tree walks
left in the tree, all in the TM ipa pass.

I believe we can leave those as they are, since the TM ipa pass runs
early enough that nothing has altered control flow such that
code outside of a transaction ends up inside a transaction.

For instance, the original problem that brought about this surgery
involved the following flow graph:

  #1 __transaction // transaction header
      |
      |
      V
      #3  ----------->  #4
      |              trxn_commit()
      |                 |
      |                 |
      V                 |
    #6                  |
    trxn_commit()       |
    func()              |
      |                 |
      |                 |
      V                 |
    #5<-----------------+
    notrxn = 99
    return


Basic block #5 was inserted into the transaction by a combination of
inlining and jump threading.  This cannot happen before the IPA pass
because it runs much earlier, and AFAICT nothing that alters control
flow detrimentally runs before IPA.

Consequently, if we have:

          __transaction // transaction header    --+
           |                                       |
           V                                       |
        INSIDE_TRANSACTION                         | trxn over edge
           |                                       |
           V                                       |
        OUTSIDE_TRANSACTION                     <--+

When iterating through INSIDE_TRANSACTION, we are assured that nothing
in OUTSIDE_TRANSACTION is *immediately* dominated by anything inside the
transaction, because #1 (the transaction header), has an "over" edge
into OUTSIDE_TRANSACTION.  So by definition, the transaction header will
be the immediate dominator of the first block of OUTSIDE_TRANSACTION.

Since INSIDE_TRANSACTION hasn't been engrafted anything from outside,
and nothing inside immediately dominates anything outside (unless it
passes through TransactionCommit), then we can just use immediate
dominance as we're currently doing.

If you agree, then nothing needs to be done with the rest of the
immediate dominator mess.

Waddaya think?
Aldy

Reply via email to