[all-commits] [llvm/llvm-project] 979a03: [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp ...

Veera via All-commits all-commits at lists.llvm.org
Mon Dec 2 00:34:06 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 979a0356d4c90ec855be4f2d2f6687132cf10298
      https://github.com/llvm/llvm-project/commit/979a0356d4c90ec855be4f2d2f6687132cf10298
  Author: Veera <32646674+veera-sivarajan at users.noreply.github.com>
  Date:   2024-12-02 (Mon, 02 Dec 2024)

  Changed paths:
    M clang/test/CodeGen/attr-counted-by.c
    M llvm/include/llvm/Analysis/ValueTracking.h
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    A llvm/test/Transforms/InstCombine/canonicalize-const-to-bop.ll
    M llvm/test/Transforms/InstCombine/minmax-fold.ll
    M llvm/test/Transforms/InstCombine/saturating-add-sub.ll
    M llvm/test/Transforms/InstCombine/select.ll
    M llvm/test/Transforms/InstCombine/unsigned_saturated_sub.ll

  Log Message:
  -----------
  [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (#116888)

Fixes #82414.

General Proof: https://alive2.llvm.org/ce/z/ERjNs4 
Proof for Tests: https://alive2.llvm.org/ce/z/K-934G

This PR transforms `select` instructions of the form `select (Cmp X C1)
(BOp X C2) C3` to `BOp (min/max X C1) C2` iff `C3 == BOp C1 C2`.

This helps in eliminating a noop loop in
https://github.com/rust-lang/rust/issues/123845 but does not improve
optimizations.



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