summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify/rem.ll
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-171-0/+327
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-171-327/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* [InstSimplify] fold srem with sext bool divisorSanjay Patel2018-06-261-6/+2
| | | | llvm-svn: 335616
* [InstSimplify] add tests for srem with sext bool divisor; NFCSanjay Patel2018-06-261-0/+23
| | | | llvm-svn: 335609
* [InstSimplify] fold div/rem of zexted boolSanjay Patel2018-06-251-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was looking at an unrelated fold and noticed that we don't have this simplification (because the other fold would break existing tests). Name: zext udiv %z = zext i1 %x to i32 %r = udiv i32 %y, %z => %r = %y Name: zext urem %z = zext i1 %x to i32 %r = urem i32 %y, %z => %r = 0 Name: zext sdiv %z = zext i1 %x to i32 %r = sdiv i32 %y, %z => %r = %y Name: zext srem %z = zext i1 %x to i32 %r = srem i32 %y, %z => %r = 0 https://rise4fun.com/Alive/LZ9 llvm-svn: 335512
* [InstSimplify] add tests for div/rem with bool divisor; NFCSanjay Patel2018-06-251-0/+22
| | | | llvm-svn: 335509
* [PatternMatch] allow undef elements when matching a vector zeroSanjay Patel2018-04-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This is the last step in getting constant pattern matchers to allow undef elements in constant vectors. I'm adding a dedicated m_ZeroInt() function and building m_Zero() from that. In most cases, calling code can be updated to use m_ZeroInt() directly when there's no need to match pointers, but I'm leaving that efficiency optimization as a follow-up step because it's not always clear when that's ok. There are just enough icmp folds in InstSimplify that can be used for integer or pointer types, that we probably still want a generic m_Zero() for those cases. Otherwise, we could eliminate it (and possibly add a m_NullPtr() as an alias for isa<ConstantPointerNull>()). We're conservatively returning a full zero vector (zeroinitializer) in InstSimplify/InstCombine on some of these folds (see diffs in InstSimplify), but I'm not sure if that's actually necessary in all cases. We may be able to propagate an undef lane instead. One test where this happens is marked with 'TODO'. llvm-svn: 330550
* [InstSimplify] move/add/regenerate checks for tests; NFCSanjay Patel2018-04-211-0/+25
| | | | llvm-svn: 330515
* InstSimplify: If divisor element is undef simplify to undefZvi Rackover2018-01-241-0/+16
| | | | | | | | | | | | | | | | Summary: If any vector divisor element is undef, we can arbitrarily choose it be zero which would make the div/rem an undef value by definition. Reviewers: spatel, reames Reviewed By: spatel Subscribers: magabari, llvm-commits Differential Revision: https://reviews.llvm.org/D42485 llvm-svn: 323343
* [InstSimplify] (X << Y) % X -> 0Anton Bikineev2018-01-231-12/+4
| | | | llvm-svn: 323182
* [InstSimplify] add baseline tests for (X << Y) % X -> 0; NFCSanjay Patel2018-01-211-12/+82
| | | | | | | | | | | This is the 'rem' counterpart to D42032 and would be folded by D42341. Patch by Anton Bikineev. Differential Revision: https://reviews.llvm.org/D42342 llvm-svn: 323067
* [InstSimplify] fix some test names; NFCSanjay Patel2017-09-111-12/+12
| | | | | | Too much division...the quotient is the answer. llvm-svn: 312943
* [InstSimplify] refactor udiv/urem code and add tests; NFCISanjay Patel2017-09-101-0/+69
| | | | | | | | | 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. llvm-svn: 312885
* [InstSimplify] allow folds for bool vector div/remSanjay Patel2017-03-091-5/+3
| | | | llvm-svn: 297411
* [ConstantFold] vector div/rem with any zero element in divisor is undefSanjay Patel2017-03-091-2/+2
| | | | | | | | Follow-up for: https://reviews.llvm.org/D30665 https://reviews.llvm.org/rL297390 llvm-svn: 297409
* [InstSimplify] add tests for vector constant folding div/rem-by-0; NFCSanjay Patel2017-03-091-0/+16
| | | | llvm-svn: 297407
* [InstSimplify] vector div/rem with any zero element in divisor is undefSanjay Patel2017-03-091-5/+3
| | | | | | | | | | | 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 llvm-svn: 297390
* [InstSimplify] add tests for vector div/rem with UB potential; NFCSanjay Patel2017-03-061-0/+42
| | | | llvm-svn: 297048
* [InstSimplify] regenerate checks; NFCSanjay Patel2017-03-061-15/+15
| | | | llvm-svn: 297040
* [InstSimplify] Optimize away urems in the presence of range metadataDavid Majnemer2017-01-061-0/+14
| | | | | | We know that urem %V, C can be optimized away to %V if %V is ult C. llvm-svn: 291282
* [InstSimplify] regenerate checks using a scriptSanjay Patel2016-03-251-9/+15
| | | | | | | | | | | | | | I didn't notice any significant changes in the actual checks here; all of these tests already used FileCheck, so a script can batch update them in one shot. This commit is just to show the value of automating this process: We have uniform formatting as opposed to a mish-mash of check structure that changes based on individual prefs and the current fashion. This makes it simpler to update when we find a bug or make an enhancement. llvm-svn: 264457
* InstSimplify: Don't allow (x srem y) urem y -> x srem yDavid Majnemer2014-09-171-2/+21
| | | | | | | | | | | Let's consider the case where: %x i16 = 32768 %y i16 = 384 %x srem %y = 65408 (%x srem %y) urem %y = 128 llvm-svn: 217939
* InstSimplify: ((X % Y) % Y) -> (X % Y)David Majnemer2014-09-171-0/+9
| | | | | | | | Patch by Sonam Kumari! Differential Revision: http://reviews.llvm.org/D5350 llvm-svn: 217937
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | functionality change. This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done llvm-svn: 186268
* Move some rem transforms out of instcombine and into instsimplify.Duncan Sands2011-05-021-0/+17
This automagically provides a transform noticed by my super-optimizer as occurring quite often: "rem x, (select cond, x, 1)" -> 0. llvm-svn: 130694
OpenPOWER on IntegriCloud