[PATCH] D74228: [PatternMatch] Match XOR variant of unsigned-add overflow check.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 7 09:13:20 PST 2020
fhahn created this revision.
fhahn added reviewers: nikic, RKSimon, lebedev.ri, spatel.
Herald added a subscriber: kristof.beyls.
Herald added a project: LLVM.
Instcombine folds (a + b <u a) to (a ^ -1 <u b) and that does not match
the expected pattern in CodeGenPerpare via UAddWithOverflow.
This causes a regression over Clang 7 on both X86 and AArch64:
https://gcc.godbolt.org/z/juhXYV
This patch extends UAddWithOverflow to also catch the XOR case, if the
XOR is only used in the ICMP. This covers just a single case, but I'd
like to make sure I am not missing anything before tackling the other
cases.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74228
Files:
llvm/include/llvm/IR/PatternMatch.h
llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74228.243190.patch
Type: text/x-patch
Size: 18392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200207/1111dc71/attachment.bin>
More information about the llvm-commits
mailing list