[PATCH] D50972: [InstCombine] Fold icmp ugt/ult (add nuw X, C2), C --> icmp ugt/ult X, (C - C2)
Nicola Zaghen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 07:41:37 PDT 2018
Nicola created this revision.
Nicola added reviewers: nlopes, spatel.
Herald added a subscriber: llvm-commits.
Support for sgt/slt was added in https://reviews.llvm.org/D29774, this adds the same cases also for unsigned compares.
Alive proof is at: https://rise4fun.com/Alive/nyY
Name: ult
Pre: WillNotOverflowUnsignedSub(C2, C1)
%a = add nuw i8 %x, C1
%b = icmp ult %a, C2
=>
%b = icmp ult %x, C2-C1
Name: ugt
Pre: WillNotOverflowUnsignedSub(C2, C1)
%a = add nuw i8 %x, C1
%b = icmp ugt %a, C2
=>
%b = icmp ugt %x, C2-C1
I updated the tests that changed and added new tests for the new combines.
Repository:
rL LLVM
https://reviews.llvm.org/D50972
Files:
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Analysis/ValueTracking/non-negative-phi-bits.ll
test/Transforms/InstCombine/icmp-add.ll
test/Transforms/LoopVectorize/X86/masked_load_store.ll
test/Transforms/LoopVectorize/if-conversion-nest.ll
test/Transforms/LoopVectorize/runtime-check.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50972.161479.patch
Type: text/x-patch
Size: 6499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180820/867846d1/attachment-0001.bin>
More information about the llvm-commits
mailing list