[PATCH] D69465: [WIP] An alternate approach to widening exit conditions using widenable conditions

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 10:09:59 PDT 2019


reames added a comment.

Recording some thoughts.

There's a potential serious problem here with both approaches.  We're hoisting logic (mostly arithmetic) out of the loop and adding a new use outside the loop.  As such, there's a potentially serious problem with undef and poison as the existing flags may no longer be correct for the new user.

This is exactly the same problem which unswitch has.  Interestingly, this proposed transform basically implements unswitch, but without the duplication.  As such, any solution (say, the proposed freeze intrinsic) which works for unswitch, should work here as well.

While waiting for freeze, some practical notes:

- propagatesFullPoison does not include and.  And unswitch appears to essentially rely on this.  As such, from a poison perspective, anding in a new condition to the widenable branch is probably okay in practice.  (Caveat: unless poison is exploited by some transform above the loop following use simplification?  But unswitch would have this problem too.)
- Undef is harder.  I haven't found a chain of logic to convince myself it's harmless in practice just yet.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69465/new/

https://reviews.llvm.org/D69465





More information about the llvm-commits mailing list