[PATCH] D81678: Introduce partialinit attribute at call sites for stricter poison analysis

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 13:13:57 PDT 2020


efriedma added a reviewer: aqjune.
efriedma added a comment.
Herald added a subscriber: wuzish.

I usually like to start reading this sort of patch with the proposed LangRef change, but I'm not seeing one.

There are a couple of related issues here in the existing representation of IR:

1. The way that call argument coercion works is unsound in the presence of poison.  An integer can't be partially poisoned: it's either poison, or not poison.  We probably need to come up with some safer way to pass structs/unions.
2. We don't currently have a way for frontends to indicate that a value is guaranteed not to be poison, so we have to conservatively assume arguments might be poison.  Whatever solution we come up with here should apply whether or not msan is enabled.  An attribute like this will probably be useful for "freeze" optimizations.

The partialinit attribute is, in some sense, backwards: the definition is essentially "an argument *not* marked partialinit must not contain any poison values".  We usually try to avoid negative reasoning like this; I'm afraid it'll make transforms harder to reason about.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678





More information about the cfe-commits mailing list