[all-commits] [llvm/llvm-project] f6bb15: [InstCombine] Fold icmp(X) ? f(X) : C

Alexander Shaposhnikov via All-commits all-commits at lists.llvm.org
Mon Apr 11 18:33:14 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6bb156fb10cd83953a34f75b78835cdf399ee8b
  Author: Alexander Shaposhnikov <ashaposhnikov at google.com>
  Date:   2022-04-12 (Tue, 12 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-binop-cmp.ll

  Log Message:
  [InstCombine] Fold icmp(X) ? f(X) : C

This diff extends foldSelectInstWithICmp to handle the case icmp(X) ? f(X) : C
when f(X) is guaranteed to be equal to C for all X in the exact range of the inverse predicate.
This addresses the issue https://github.com/llvm/llvm-project/issues/54089.

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

Test plan: make check-all

More information about the All-commits mailing list