This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] don't delete assumes of side-effectful instructions
Needs ReviewPublic

Authored by arielb1 on Aug 10 2017, 12:49 PM.

Details

Reviewers
hfinkel
nagisa
Summary

SUPERSEDED BY D36590 - THIS WAS NOT ADDED TO LLVM-COMMITS

ValueTracking has to strike a balance when attempting to propagate information backwards from assumes, because if the information is trivially propagated backwards, it can appear to LLVM that the assumption is known to be true, and therefore can be removed.

This is sound (because an assumption has no semantic effect except for causing UB), but prevents the assume from allowing further optimizations.

The isEphemeralValueOf check exists to try and prevent this issue by not removing the source of an assumption. This tries to make it a little bit more general to handle the case of side-effectful instructions, such as in

%0 = call i1 @get_val()
%1 = xor i1 %0, true
call void @llvm.assume(i1 %1)

FIX: try to make llvm-commits see this

Diff Detail

Event Timeline

arielb1 created this revision.Aug 10 2017, 12:49 PM
arielb1 added a reviewer: nagisa.
arielb1 added a subscriber: llvm-commits.
arielb1 edited the summary of this revision. (Show Details)Aug 10 2017, 12:52 PM
arielb1 edited the summary of this revision. (Show Details)Aug 10 2017, 12:54 PM
nagisa resigned from this revision.Aug 29 2020, 8:07 AM