[PATCH] D40168: [IRCE][NFC] Add no wrap flags to no-wrapping SCEV calculation
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 22 22:15:06 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318898: [IRCE][NFC] Add no wrap flags to no-wrapping SCEV calculation (authored by mkazantsev).
Changed prior to commit:
https://reviews.llvm.org/D40168?vs=123301&id=124037#toc
Repository:
rL LLVM
https://reviews.llvm.org/D40168
Files:
llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
Index: llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -1667,7 +1667,8 @@
// Rule 3: Y <s (X - SINT_MAX) ---> (X - SINT_MAX).
// It gives us smax(Y, X - SINT_MAX) to substract in all cases.
const SCEV *XMinusSIntMax = SE.getMinusSCEV(X, SIntMax);
- return SE.getMinusSCEV(X, SE.getSMaxExpr(Y, XMinusSIntMax));
+ return SE.getMinusSCEV(X, SE.getSMaxExpr(Y, XMinusSIntMax),
+ SCEV::FlagNSW);
} else
// X is a number from unsigned range, Y is interpreted as signed.
// Even if Y is SINT_MIN, (X - Y) does not reach UINT_MAX. So the only
@@ -1679,7 +1680,7 @@
// If 0 <= X < Y, we should stop at 0 and can only substract X.
// Rule 3: Y >s X ---> X.
// It gives us smin(X, Y) to substract in all cases.
- return SE.getMinusSCEV(X, SE.getSMinExpr(X, Y));
+ return SE.getMinusSCEV(X, SE.getSMinExpr(X, Y), SCEV::FlagNUW);
};
const SCEV *M = SE.getMinusSCEV(C, A);
const SCEV *Zero = SE.getZero(M->getType());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40168.124037.patch
Type: text/x-patch
Size: 1260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171123/6080a020/attachment.bin>
More information about the llvm-commits
mailing list