diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-02-18 00:43:19 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-02-18 00:43:19 +0000 |
commit | 102061a4947c9a07db3b874ffe26724d6fd43683 (patch) | |
tree | c3b2650bf690a42f4372dbb3f7b3805e69f41df6 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | e5c0c14213b984c8b27c593a28b29136f626ad96 (diff) | |
download | bcm5719-llvm-102061a4947c9a07db3b874ffe26724d6fd43683.tar.gz bcm5719-llvm-102061a4947c9a07db3b874ffe26724d6fd43683.zip |
Bugfix: SCEV incorrectly marks certain expressions as nsw
I could not come up with a test case for this one; but I don't think
`getPreStartForSignExtend` can assume `AR` is `nsw` -- there is one
place in scalar evolution that calls `getSignExtendAddRecStart(AR,
...)` without proving that `AR` is `nsw`
(line 1564)
OperandExtendedAdd =
getAddExpr(WideStart,
getMulExpr(WideMaxBECount,
getZeroExtendExpr(Step, WideTy)));
if (SAdd == OperandExtendedAdd) {
// If AR wraps around then
//
// abs(Step) * MaxBECount > unsigned-max(AR->getType())
// => SAdd != OperandExtendedAdd
//
// Thus (AR is not NW => SAdd != OperandExtendedAdd) <=>
// (SAdd == OperandExtendedAdd => AR is NW)
const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNW);
// Return the expression with the addrec on the outside.
return getAddRecExpr(getSignExtendAddRecStart(AR, Ty, this),
getZeroExtendExpr(Step, Ty),
L, AR->getNoWrapFlags());
}
Differential Revision: http://reviews.llvm.org/D7640
llvm-svn: 229594
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions