[all-commits] [llvm/llvm-project] aacff3: [InstCombine] Simplify `icmp pred (sdiv exact X, C...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Tue Dec 26 14:06:30 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aacff347af846e600d30eb1a8a38af75f8b33370
      https://github.com/llvm/llvm-project/commit/aacff347af846e600d30eb1a8a38af75f8b33370
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2023-12-27 (Wed, 27 Dec 2023)

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

  Log Message:
  -----------
  [InstCombine] Simplify `icmp pred (sdiv exact X, C), (sdiv exact Y, C)` into `icmp pred X, Y` when C is positive (#76409)

Alive2: https://alive2.llvm.org/ce/z/u49dQ9
It will improve the codegen of `std::_Vector_base<T>::~_Vector_base()` when `sizeof(T)` is not a power of 2.

NOTE: We can also fold `icmp signed-pred (sdiv exact X, C), (sdiv exact Y, C)` into `icmp signed-pred (sdiv exact Y, C), (sdiv exact X, C)` when C is negative. But I don't think it enables more optimizations for real-world applications.




More information about the All-commits mailing list