[all-commits] [llvm/llvm-project] 8320b9: [InstCombine] Fold an unsigned comparison of `add ...

Volodymyr Vasylkun via All-commits all-commits at lists.llvm.org
Wed Aug 14 07:31:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8320b97ab9f25d726379832342f3d5d48962368d
      https://github.com/llvm/llvm-project/commit/8320b97ab9f25d726379832342f3d5d48962368d
  Author: Volodymyr Vasylkun <vvmposeydon at gmail.com>
  Date:   2024-08-14 (Wed, 14 Aug 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-add.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll

  Log Message:
  -----------
  [InstCombine] Fold an unsigned comparison of `add nsw X, C` with a constant into a signed comparison (#103480)

Given an unsigned integer comparison of `add nsw X, C1` with some
constant `C2` we can fold it into a signed comparison of `X` and `C2 -
C1` under the following conditions:
  * There's a `nsw` flag on the addition
  * `C2` is non-negative
  * `X + C1` is non-negative
  * `C2 - C1` is non-negative



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list