llvm-project/llvm/lib/Transforms
Roman Lebedev 8360c42e25 [InstCombine] foldICmpBinOp(): consider inverted check in 'unsigned sub overflow' check
A follow-up for r329011.
This may be changed to produce @llvm.sub.with.overflow in a later patch,
but for now just make things more consistent overall.

A few observations stem from this:
* There does not seem to be a similar one-instruction fold for uadd-overflow
* I'm not sure we'll want to canonicalize `B u> A` as `usub.with.overflow`,
  so since the `icmp` here no longer refers to `sub`,
  reconstructing `usub.with.overflow` will be problematic,
  and will likely require standalone pass (similar to DivRemPairs).

https://rise4fun.com/Alive/Zqs

Name: (A - B) u> A --> B u> A
  %t0 = sub i8 %A, %B
  %r = icmp ugt i8 %t0, %A
=>
  %r = icmp ugt i8 %B, %A

Name: (A - B) u<= A --> B u<= A
  %t0 = sub i8 %A, %B
  %r = icmp ule i8 %t0, %A
=>
  %r = icmp ule i8 %B, %A

Name: C u< (C - D) --> C u< D
  %t0 = sub i8 %C, %D
  %r = icmp ult i8 %C, %t0
=>
  %r = icmp ult i8 %C, %D

Name: C u>= (C - D) --> C u>= D
  %t0 = sub i8 %C, %D
  %r = icmp uge i8 %C, %t0
=>
  %r = icmp uge i8 %C, %D

llvm-svn: 371101
2019-09-05 17:41:02 +00:00
..
AggressiveInstCombine Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Coroutines [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Hello Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IPO [Attributor][Stats] Use the right statistics macro 2019-09-04 20:34:57 +00:00
InstCombine [InstCombine] foldICmpBinOp(): consider inverted check in 'unsigned sub overflow' check 2019-09-05 17:41:02 +00:00
Instrumentation [PGO][CHR] Speed up following long, interlinked use-def chains. 2019-09-05 16:56:55 +00:00
ObjCARC [ObjC][ARC] Delete ObjC runtime calls on global variables annotated 2019-06-14 22:06:32 +00:00
Scalar [MergedLoadStoreMotion] Sink stores to BB with more than 2 predecessors 2019-09-05 17:00:32 +00:00
Utils [MemorySSA] Verify MSSAUpdater exists. 2019-09-05 16:58:15 +00:00
Vectorize [LLVM][Alignment] Convert isLegalNTStore/isLegalNTLoad to llvm::Align 2019-09-05 13:09:42 +00:00
CMakeLists.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00