OSDN Git Service

[CorrelatedValuePropagation] Mark subs that we know not to wrap with nuw/nsw.
authorLuqman Aden <me@luqman.ca>
Sat, 20 Apr 2019 13:14:18 +0000 (13:14 +0000)
committerLuqman Aden <me@luqman.ca>
Sat, 20 Apr 2019 13:14:18 +0000 (13:14 +0000)
commit6e5b564f917786b9967b2a0e5a8cb2c898dac03e
tree6b26b4085d8900bdf81130ce44dfd8a335ecfd65
parenta1443772d6c1a4b3892e311e7d2ab48b4ad658b3
[CorrelatedValuePropagation] Mark subs that we know not to wrap with nuw/nsw.

Summary:
Teach CorrelatedValuePropagation to also handle sub instructions in addition to add. Relatively simple since makeGuaranteedNoWrapRegion already understood sub instructions. Only subtle change is which range is passed as "Other" to that function, since sub isn't commutative.

Note that CorrelatedValuePropagation::processAddSub is still hidden behind a default-off flag as IndVarSimplify hasn't yet been fixed to strip the added nsw/nuw flags and causes a miscompile. (PR31181)

Reviewers: sanjoy, apilipenko, nikic

Reviewed By: nikic

Subscribers: hiraditya, jfb, jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60036

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358816 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/add.ll
test/Transforms/CorrelatedValuePropagation/sub.ll