This is an archive of the discontinued LLVM Phabricator instance.

[Attr] Introduce the `nopoison` attribute
AbandonedPublic

Authored by bbn on Jun 22 2020, 8:10 AM.

Details

Summary

The nopoison IR attribute indicates that the value it associated with cannot be poison, so it will be safe for us to perform more optimizations to it.

For example, consider the following code[1]:

t = x + 1;
if (t == y) {
w = x + 1;
foo(w);
}

if we determine that y cannot be poison, then we can apply the GVN optimization to the code above.

[1] 2016 LLVM Developers’ Meeting: N. Lopes “Undefined Behavior: Long Live Poison!"

Diff Detail

Event Timeline

bbn created this revision.Jun 22 2020, 8:10 AM
nikic added a subscriber: nikic.

This overlaps with D82316. I believe the attribute defined there is more useful, because we generally need values to be non-poison *and* non-undef to make meaningful optimizations.

bbn abandoned this revision.Jun 22 2020, 7:52 PM

This overlaps with D82316. I believe the attribute defined there is more useful, because we generally need values to be non-poison *and* non-undef to make meaningful optimizations.

Oh sorry I didn't notice that, lets close this revision and move to that one.