diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2020-09-22 10:37:15 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2020-09-22 21:37:28 +0300 |
commit | 4eeeb356fc41babf46797b062f74f978b818622b (patch) | |
tree | afcdfe4daa3f676c8316896808b5fe7f78939f98 /llvm/lib/Transforms/Utils/LoopVersioning.cpp | |
parent | 36ea18b06430e0a1094f9b0994e4abb5cc2175c9 (diff) | |
download | llvm-4eeeb356fc41babf46797b062f74f978b818622b.zip llvm-4eeeb356fc41babf46797b062f74f978b818622b.tar.gz llvm-4eeeb356fc41babf46797b062f74f978b818622b.tar.bz2 |
[CVP] Enhance SRem -> URem fold to work not just on non-negative operands
This is a continuation of 8d487668d09fb0e4e54f36207f07c1480ffabbfd,
the logic is pretty much identical for SRem:
Name: pos pos
Pre: C0 >= 0 && C1 >= 0
%r = srem i8 C0, C1
=>
%r = urem i8 C0, C1
Name: pos neg
Pre: C0 >= 0 && C1 <= 0
%r = srem i8 C0, C1
=>
%r = urem i8 C0, -C1
Name: neg pos
Pre: C0 <= 0 && C1 >= 0
%r = srem i8 C0, C1
=>
%t0 = urem i8 -C0, C1
%r = sub i8 0, %t0
Name: neg neg
Pre: C0 <= 0 && C1 <= 0
%r = srem i8 C0, C1
=>
%t0 = urem i8 -C0, -C1
%r = sub i8 0, %t0
https://rise4fun.com/Alive/Vd6
Now, this new logic does not result in any new catches
as of vanilla llvm test-suite + RawSpeed.
but it should be virtually compile-time free,
and it may be important to be consistent in their handling,
because if we had a pair of sdiv-srem, and only converted one of them,
-divrempairs will no longer see them as a pair,
and thus not "merge" them.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
0 files changed, 0 insertions, 0 deletions