[NFC]Migrate VectorCombine.cpp to use InstructionCost
authorCaroline Concatto <caroline.concatto@arm.com>
Mon, 4 Jan 2021 15:21:21 +0000 (15:21 +0000)
committerCaroline Concatto <caroline.concatto@arm.com>
Mon, 18 Jan 2021 13:37:21 +0000 (13:37 +0000)
commit36710c38c1b741ff9cc70060893d53fc24c07833
treec04c92af2ea306b012a176839c9db2b3cf02b623
parent9399681a57cef143dc4d087706947a03af819ef5
[NFC]Migrate VectorCombine.cpp to use InstructionCost

This patch changes these functions:
vectorizeLoadInsert
isExtractExtractCheap
foldExtractedCmps
scalarizeBinopOrCmp
getShuffleExtract
foldBitcastShuf
to use the class InstructionCost when calling TTI.get<something>Cost().

This patch is part of a series of patches to use InstructionCost instead of
 unsigned/int for the cost model functions.
See this thread for context:
    http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
See this patch for the introduction of the type:
    https://reviews.llvm.org/D91174

ps.:This patch adds the test || !NewCost.isValid(), because we want to
return false when:
 !NewCost.isValid && !OldCost.isValid()->the cost to transform it expensive
and
 !NewCost.isValid() && OldCost.isValid()
Therefore for simplication we only add  test for !NewCost.isValid()

Differential Revision: https://reviews.llvm.org/D94069
llvm/lib/Transforms/Vectorize/VectorCombine.cpp