[PATCH] D134172: [InstCombine] Fold ult(add(x, -1), c) -> ule(x, c) iff x != 0 (PR57635)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 03:09:55 PDT 2022


RKSimon created this revision.
RKSimon added reviewers: spatel, nikic, nlopes.
Herald added subscribers: dmgreen, zzheng, hiraditya.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a subscriber: pcwang-thead.
Herald added a project: LLVM.

Alive2: https://alive2.llvm.org/ce/z/sZ6wwS

As detailed on Issue #57635 and #37628 - for unsigned comparisons, we can compare prior to a loop counter decrement iff the counter is known never to be zero.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134172

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/LoopUnroll/AArch64/runtime-unroll-generic.ll
  llvm/test/Transforms/LoopUnroll/runtime-unroll-remainder.ll
  llvm/test/Transforms/LoopVectorize/AArch64/intrinsiccost.ll
  llvm/test/Transforms/LoopVectorize/ARM/mve-reductions.ll
  llvm/test/Transforms/LoopVectorize/X86/float-induction-x86.ll
  llvm/test/Transforms/LoopVectorize/X86/intrinsiccost.ll
  llvm/test/Transforms/LoopVectorize/float-induction.ll
  llvm/test/Transforms/LoopVectorize/if-conversion-nest.ll
  llvm/test/Transforms/LoopVectorize/induction.ll
  llvm/test/Transforms/LoopVectorize/runtime-check.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134172.461170.patch
Type: text/x-patch
Size: 41037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/39887e22/attachment.bin>


More information about the llvm-commits mailing list