ScalarEvolution: do not set nuw when creating exprs of form <expr> + <all-ones>.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 20 Nov 2015 01:26:13 +0000 (01:26 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 20 Nov 2015 01:26:13 +0000 (01:26 +0000)
commit5178bc957ad560f51040d783cb02fe684773e6b8
treefa3a9c9609eac598d78028c2b9696fd2c7247efe
parent77072b3170a72d838112c726dc60b0f452cf5409
ScalarEvolution: do not set nuw when creating exprs of form <expr> + <all-ones>.

The nuw constraint will not be satisfied unless <expr> == 0.

This bug has been around since r102234 (in 2010!), but was uncovered by
r251052, which introduced more aggressive optimization of nuw scev expressions.

Differential Revision: http://reviews.llvm.org/D14850

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253627 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/zext-nuw.ll [new file with mode: 0644]