Analysis: Make isSafeToSpeculativelyExecute fire less for divides
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 4 Nov 2014 23:49:08 +0000 (23:49 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 4 Nov 2014 23:49:08 +0000 (23:49 +0000)
commit3839fd16a1a90de302e847109522379472108c30
treeee744e2f0786e92bf5b2a1e8142937c226f24d7b
parent11e6e005b7498b37d890f7c54ad1f13e06cb4e74
Analysis: Make isSafeToSpeculativelyExecute fire less for divides

Divides and remainder operations do not behave like other operations
when they are given poison: they turn into undefined behavior.

It's really hard to know if the operands going into a div are or are not
poison.  Because of this, we should only choose to speculate if there
are constant operands which we can easily reason about.

This fixes PR21412.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221318 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/LICM/speculate.ll