[PATCH] D63060: [InstCombine] usub.sat(a, b) + b => umax(a, b) (PR42178)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 9 07:50:01 PDT 2019
lebedev.ri added a comment.
This seems correct:
----------------------------------------
%sat = usub_sat i8 C1, C2
%res = add i8 %sat, C2
=>
%sat = usub_sat i8 C1, C2
%t0 = icmp ult i8 C1, C2
%res = select i1 %t0, i8 C2, i8 C1
Done: 1
Optimization is correct!
But it seems to un-`undef` things:
----------------------------------------
%sat = usub_sat i8 %a, %b
%res = add i8 %sat, %b
=>
%sat = usub_sat i8 %a, %b
%t0 = icmp ult i8 %a, %b
%res = select i1 %t0, i8 %b, i8 %a
ERROR: Value mismatch for i8 %res
Example:
i8 %a = undef
i8 %b = #x10 (16)
i8 %sat = undef
i1 %t0 = undef
Source value: undef
Target value: #x02 (2)
?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63060/new/
https://reviews.llvm.org/D63060
More information about the llvm-commits
mailing list