Sanjay Patel
e6b6787d01
[InstCombine] fold abs(X)/X to cmp+select
...
The backend can convert the select-of-constants to
bit-hack shift+logic if desirable.
https://alive2.llvm.org/ce/z/pgJT6E
define i8 @src(i8 %x) {
%0:
%a = abs i8 %x, 1
%d = sdiv i8 %x, %a
ret i8 %d
}
=>
define i8 @tgt(i8 %x) {
%0:
%cond = icmp sgt i8 %x, 255
%r = select i1 %cond, i8 1, i8 255
ret i8 %r
}
Transformation seems to be correct!
2020-08-17 08:01:28 -04:00
Sanjay Patel
61512ddd2d
[InstCombine] add tests for sdiv-of-abs; NFC
2020-08-17 08:01:27 -04:00
Eric Christopher
cee313d288
Revert "Temporarily Revert "Add basic loop fusion pass.""
...
The reversion apparently deleted the test/Transforms directory.
Will be re-reverting again.
llvm-svn: 358552
2019-04-17 04:52:47 +00:00
Eric Christopher
a863435128
Temporarily Revert "Add basic loop fusion pass."
...
As it's causing some bot failures (and per request from kbarton).
This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.
llvm-svn: 358546
2019-04-17 02:12:23 +00:00
Chen Zheng
5e13ff1da2
[InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y).
...
Differential Revision: https://reviews.llvm.org/D60395
llvm-svn: 358050
2019-04-10 06:52:09 +00:00
Nikita Popov
2f5e9de8d1
Revert "[InstCombine] [InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y)."
...
This reverts commit 1383a91689
.
sdiv-canonicalize.ll fails after this revision. The fold needs to be
moved outside the branch handling constant operands. However when this
is done there are further test changes, so I'm reverting this in the
meantime.
llvm-svn: 358026
2019-04-09 18:32:38 +00:00
Chen Zheng
1383a91689
[InstCombine] [InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y).
...
Differential Revision: https://reviews.llvm.org/D60395
llvm-svn: 358017
2019-04-09 16:34:31 +00:00
Chen Zheng
11cf397292
[InstCombine] add more testcases for canonicalize (-X s/ Y) to -(X s/ Y).
...
llvm-svn: 358000
2019-04-09 12:47:29 +00:00
Chen Zheng
c84107612a
[InstCombine]add testcase for sdiv canonicalizetion - NFC
...
llvm-svn: 357883
2019-04-08 03:07:32 +00:00