[SimplifyCFG] mergeConditionalStoreToAddress(): consider cost, not instruction count
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 18 Sep 2019 19:46:57 +0000 (19:46 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 18 Sep 2019 19:46:57 +0000 (19:46 +0000)
commitdd0170ab24577f76a5c8c78b4f7e068ac29de40c
tree845ca00c3f550eb51c1f016072414fa6f8c5aa3a
parentec6b91b6655a92d02c88e942d83366004575a234
[SimplifyCFG] mergeConditionalStoreToAddress(): consider cost, not instruction count

Summary:
As it can be see in the changed test, while `div` is really costly,
we were speculating it. This does not seem correct.

Also, the old code would run for every single insturuction in BB,
instead of eagerly bailing out as soon as there are too many instructions.

This function still has a problem that `PHINodeFoldingThreshold` is
per-basic-block, while it should be for all the basic blocks.

Reviewers: efriedma, craig.topper, dmgreen, jmolloy

Reviewed By: jmolloy

Subscribers: xbolva00, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372255
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/X86/merge-cond-stores-cost.ll