[PATCH] D51929: [DAGCombiner] use UADDO to optimize saturated unsigned add
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 21 01:16:00 PDT 2018
lebedev.ri added a comment.
Do we somehow enforce that in `%r = select i1 %c, i32 -1, i32 %a`, `-1` is in the middle?
If not, we miss at least one case i think:
$ ~/src/alive/alive.py /tmp/test.txt
----------------------------------------
Optimization: 1
Precondition: true
%a = add i32 %x, 42
%c = icmp ugt i32 %x, -43
%r = select i1 %c, i32 -1, i32 %a
=>
%c2 = icmp ult i32 %x, -43
%r = select i1 %c2, i32 %a, i32 -1
Done: 1
Optimization is correct!
I thought there was some more case with inverted/negated `42` / `-43` but i can't find it right now.
https://reviews.llvm.org/D51929
More information about the llvm-commits
mailing list