[llvm-dev] [cfe-dev] RFC: Supported Optimizations attribute

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 4 12:36:07 PST 2018


On Tue, Dec 4, 2018 at 12:04 PM Arthur O'Dwyer
<arthur.j.odwyer at gmail.com> wrote:
> Peanut gallery says: I don't fully understand the use-case or the domain, but this description sounds unworkable to me.
>
> AIUI, there are two players here: the "brittle optimization" (which relies on some invariant), and the "transform" (which has the power to break that invariant).
>
> The only two mathematically workable scenarios are:
> (A) The brittle optimization's invariant is "impossible to [break] for standard semantic/structural reasons." Therefore no transform ever needs to know anything about it. The result is a "robust" optimization, and no need for the supported-optimizations flagset.
> (B) The brittle optimization's invariant is, in fact, brittle. Any transform that doesn't explicitly preserve the invariant can and will break the invariant. Therefore, every transform must have its own whitelist of "invariants I know I don't break." Any flag in the supported-optimizations flagset which is not whitelisted by a given transform must be cleared when that transform is applied to the code. (Because, by definition, a transform that doesn't explicitly preserve the brittle invariant must be assumed to break it.)

I think the overarching idea here is that good faith opts will only
rely on invariants that can only be broken by inter-procedural
optimizations.  So intra-procedural opts should not need any changes.

In a sense this proposal makes function call edges semantically
special; functions calls are no longer yet another kind of control
flow, but they can act as bridges between LLVM IR with different
semantics.  Collapsing a function call edge is now a semantically
interesting operation.

-- Sanjoy

>
> my $.02,
> –Arthur


More information about the llvm-dev mailing list