[ValueTracking] Improve reverse assumption inference
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 13 Aug 2019 17:15:42 +0000 (17:15 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 13 Aug 2019 17:15:42 +0000 (17:15 +0000)
commit2a4f26b4c28aaf9307e690b2f743ffcde5183b9e
treecf7dbc2bff0e1476b84db56aa51b188c82324dad
parentdde10cd7a968e57598726347b323348eceffeb05
[ValueTracking] Improve reverse assumption inference

Use isGuaranteedToTransferExecutionToSuccessor() instead of
isSafeToSpeculativelyExecute() when seeing whether we can propagate
the information in an assume backwards in isValidAssumeForContext().
The latter is more general - it also allows arbitrary loads/stores -
and is also the condition we want: if our assume is guaranteed to
execute, its condition not holding would be UB.

Original patch by arielb1.

Differential Revision: https://reviews.llvm.org/D37215

llvm-svn: 368723
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/assume_inevitable.ll