[CGP] add special-cases to form unsigned add with overflow (PR40486)
authorSanjay Patel <spatel@rotateright.com>
Sun, 24 Feb 2019 15:31:27 +0000 (15:31 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 24 Feb 2019 15:31:27 +0000 (15:31 +0000)
commitcb04ba032f573fe75fce0e813ba11b0d47f1159e
tree4719accf69c48c7cd3df700168b0d34f5329e80a
parent9b49f36a036a53d2cc600527a8b403cd48f7e411
[CGP] add special-cases to form unsigned add with overflow (PR40486)

There's likely a missed IR canonicalization for at least 1 of these
patterns. Otherwise, we wouldn't have needed the pattern-matching
enhancement in D57516.

Note that -- unlike usubo added with D57789 -- the TLI hook for
this transform defaults to 'on'. So if there's any perf fallout
from this, targets should look at how they're lowering the uaddo
node in SDAG and/or override that hook.

The x86 diffs suggest that there's some missing pattern-matching
for forming inc/dec.

This should fix the remaining known problems in:
https://bugs.llvm.org/show_bug.cgi?id=40486
https://bugs.llvm.org/show_bug.cgi?id=31754

llvm-svn: 354746
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/CodeGen/AArch64/uaddo.ll
llvm/test/CodeGen/X86/codegen-prepare-uaddo.ll
llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll