[all-commits] [llvm/llvm-project] 4bfbfb: [InstSimplify] Add tests for x*C1/C2<=x (NFC)

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Jan 17 07:03:33 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4bfbfb9bcb790931b97da972ff02865810f43ce8
      https://github.com/llvm/llvm-project/commit/4bfbfb9bcb790931b97da972ff02865810f43ce8
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-01-17 (Sun, 17 Jan 2021)

  Changed paths:
    M llvm/test/Transforms/InstSimplify/icmp.ll

  Log Message:
  -----------
  [InstSimplify] Add tests for x*C1/C2<=x (NFC)

Tests for PR48744.


  Commit: a13c0f62c38131ef2656b06de02d82110abaf272
      https://github.com/llvm/llvm-project/commit/a13c0f62c38131ef2656b06de02d82110abaf272
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-01-17 (Sun, 17 Jan 2021)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/InstSimplify/icmp.ll

  Log Message:
  -----------
  [InstSimplify] Fold x*C1/C2 <= x (PR48744)

We can fold x*C1/C2 <= x to true if C1 <= C2. This is valid even
if the multiplication is not nuw: https://alive2.llvm.org/ce/z/vULors

The multiplication or division can be replaced by shifts. We don't
handle the case where both are shifts, as that should get folded
away by InstCombine.


Compare: https://github.com/llvm/llvm-project/compare/9abbc050974f...a13c0f62c381


More information about the All-commits mailing list