[all-commits] [llvm/llvm-project] 095f7b: [InstCombine] add tests for binop with select oper...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Fri Nov 11 12:37:46 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 095f7bd512c7f649964858640a38f3209cfa3e81
      https://github.com/llvm/llvm-project/commit/095f7bd512c7f649964858640a38f3209cfa3e81
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-11-11 (Fri, 11 Nov 2022)

  Changed paths:
    M llvm/test/Transforms/InstCombine/binop-select.ll

  Log Message:
  -----------
  [InstCombine] add tests for binop with select operand; NFC


  Commit: 681a6a3990226c667fb648952731d2753df2716d
      https://github.com/llvm/llvm-project/commit/681a6a3990226c667fb648952731d2753df2716d
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-11-11 (Fri, 11 Nov 2022)

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

  Log Message:
  -----------
  [InstCombine] allow more folds more multi-use selects

The 'and' case showed up in a recent bug report and prevented
more follow-on transforms from happening.

We could handle more patterns (for example, the select arms
simplified, but not to constant values), but this seems
like a safe, conservative enhancement. The backend can
convert select-of-constants to math/logic in many cases
if it is profitable.

There is a lot of overlapping logic for these kinds of patterns
(see SimplifySelectsFeedingBinaryOp() and FoldOpIntoSelect()),
so there may be some opportunity to improve efficiency.

There are also optimization gaps/inconsistency because we do
not call this code for all bin-opcodes (see TODO for ashr test).


Compare: https://github.com/llvm/llvm-project/compare/7e835ae57c36...681a6a399022


More information about the All-commits mailing list