[all-commits] [llvm/llvm-project] 10ea01: [VectorCombine] make cost calc consistent for bino...

RotateRight via All-commits all-commits at lists.llvm.org
Tue Feb 25 05:42:24 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 10ea01d80d6fb81d01856271dbcd6205911d451d
      https://github.com/llvm/llvm-project/commit/10ea01d80d6fb81d01856271dbcd6205911d451d
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-02-25 (Tue, 25 Feb 2020)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    M llvm/test/Transforms/VectorCombine/X86/extract-binop.ll

  Log Message:
  -----------
  [VectorCombine] make cost calc consistent for binops and cmps

Code duplication (subsequently removed by refactoring) allowed
a logic discrepancy to creep in here.

We were being conservative about creating a vector binop -- but
not a vector cmp -- in the case where a vector op has the same
estimated cost as the scalar op. We want to be more aggressive
here because that can allow other combines based on reduced
instruction count/uses.

We can reverse the transform in DAGCombiner (potentially with a
more accurate cost model) if this causes regressions.

AFAIK, this does not conflict with InstCombine. We have a
scalarize transform there, but it relies on finding a constant
operand or a matching insertelement, so that means it eliminates
an extractelement from the sequence (so we won't have 2 extracts
by the time we get here if InstCombine succeeds).

Differential Revision: https://reviews.llvm.org/D75062




More information about the All-commits mailing list