[all-commits] [llvm/llvm-project] 77eb05: [InstCombine] Simplify select using KnownBits of c...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jul 1 00:26:22 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77eb05683082dd3751ccfab963f5160f1852058d
      https://github.com/llvm/llvm-project/commit/77eb05683082dd3751ccfab963f5160f1852058d
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

  Changed paths:
    M llvm/include/llvm/Analysis/SimplifyQuery.h
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-binop-cmp.ll
    M llvm/test/Transforms/InstCombine/select-of-bittest.ll
    M llvm/test/Transforms/InstCombine/select.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses-pred-stores.ll

  Log Message:
  -----------
  [InstCombine] Simplify select using KnownBits of condition (#95923)

Simplify the arms of a select based on the KnownBits implied by its condition.
For now this only handles the case where the select arm folds to a constant,
but this can be generalized to handle other patterns by using
SimplifyDemandedBits instead (in that case we would also have to limit to
non-undef conditions).

This is implemented by adding a new member to SimplifyQuery that can be used
to inject an additional condition. The affected values are pre-computed and
we don't call computeKnownBits() if the select arms don't contain affected
values. This reduces the cost in some pathological cases.



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