[IndVars] Drop "exact" flag from lshr and udiv when substituting their args
authorMax Kazantsev <max.kazantsev@azul.com>
Thu, 11 Oct 2018 07:22:26 +0000 (07:22 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Thu, 11 Oct 2018 07:22:26 +0000 (07:22 +0000)
commitb2e51090a427be5a804af53ac3615672ae356074
tree669d7ca7f776410d0a7128f5e310404cbad07ff0
parent523904133894888592a280ff7d0f0579418901f9
[IndVars] Drop "exact" flag from lshr and udiv when substituting their args

There is a transform that may replace `lshr (x+1), 1` with `lshr x, 1` in case
if it can prove that the result will be the same. However the initial instruction
might have an `exact` flag set, and it now should be dropped unless we prove
that it may hold. Incorrectly set `exact` attribute may then produce poison.

Differential Revision: https://reviews.llvm.org/D53061
Reviewed By: sanjoy

llvm-svn: 344223
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/test/Transforms/IndVarSimplify/drop-exact.ll [new file with mode: 0644]