Sanjay Patel
7d56a780c0
[InstSimplify] fix some test names; NFC
...
Too much division...the quotient is the answer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11 20:38:31 +00:00
Sanjay Patel
44e68c6bb8
[InstSimplify] refactor udiv/urem code and add tests; NFCI
...
This removes some duplicated code and makes it easier to support signed div/rem
in a similar way if we want to do that. Note that the existing comments were not
accurate - we don't need a constant divisor to simplify; icmp simplification does
more than that. But as the added tests show, it could go even further.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-10 17:55:08 +00:00
Sanjay Patel
2e1f925ba9
[InstSimplify] allow folds for bool vector div/rem
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297411 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 21:56:03 +00:00
Sanjay Patel
5cf1d925cc
[ConstantFold] vector div/rem with any zero element in divisor is undef
...
Follow-up for:
https://reviews.llvm.org/D30665
https://reviews.llvm.org/rL297390
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297409 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 20:42:30 +00:00
Sanjay Patel
ddb500fb8d
[InstSimplify] add tests for vector constant folding div/rem-by-0; NFC
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 20:31:20 +00:00
Sanjay Patel
dccf5a1320
[InstSimplify] vector div/rem with any zero element in divisor is undef
...
This was suggested as a DAG simplification in the review for rL297026 :
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170306/435253.html
...but let's start with IR since we have actual docs for IR (LangRef).
Differential Revision:
https://reviews.llvm.org/D30665
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 16:20:52 +00:00
Sanjay Patel
f0a0c2348e
[InstSimplify] add tests for vector div/rem with UB potential; NFC
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06 18:45:39 +00:00
Sanjay Patel
f4758b9100
[InstSimplify] regenerate checks; NFC
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06 18:13:01 +00:00
David Majnemer
dae3654635
[InstSimplify] Optimize away udivs in the presence of range metadata
...
We know that udiv %V, C can be optimized away to 0 if %V is ult C.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291296 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 22:58:02 +00:00