[all-commits] [llvm/llvm-project] 6cf10b: [InstCombine] Fold srem(X, PowerOf2) == C into (X ...

Alexander Shaposhnikov via All-commits all-commits at lists.llvm.org
Sat Apr 2 20:57:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6cf10b7e6e839fea1843ba365a6a26e77b52e251
      https://github.com/llvm/llvm-project/commit/6cf10b7e6e839fea1843ba365a6a26e77b52e251
  Author: Alexander Shaposhnikov <ashaposhnikov at google.com>
  Date:   2022-04-03 (Sun, 03 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/rem.ll

  Log Message:
  -----------
  [InstCombine] Fold srem(X, PowerOf2) == C into (X & Mask) == C for positive C

This diff extends InstCombinerImpl::foldICmpSRemConstant to handle the cases
srem(X, PowerOf2) == C and
srem(X, PowerOf2) != C
for positive C.
This addresses the issue https://github.com/llvm/llvm-project/issues/54650

Differential revision: https://reviews.llvm.org/D122942

Test plan: make check-all




More information about the All-commits mailing list