diff options
author | Craig Topper <craig.topper@intel.com> | 2017-11-03 21:08:13 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-11-03 21:08:13 +0000 |
commit | 12463779d3746a36e2adeac7d884c126236986de (patch) | |
tree | 559ea09adc0d86e038acd63a9c47ef8d3b6f2781 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | dc95dbfcabde6d0ea941ac8421f5ad71143cf526 (diff) | |
download | bcm5719-llvm-12463779d3746a36e2adeac7d884c126236986de.tar.gz bcm5719-llvm-12463779d3746a36e2adeac7d884c126236986de.zip |
[SimplifyCFG] When merging conditional stores, don't count the store we're merging against the PHINodeFoldingThreshold
Merging conditional stores tries to check to see if the code is if convertible after the store is moved. But the store hasn't been moved yet so its being counted against the threshold.
The patch adds 1 to the threshold comparison to make sure we don't count the store. I've adjusted a test to use a lower threshold to ensure we still do that conversion with the lower threshold.
Differential Revision: https://reviews.llvm.org/D39570
llvm-svn: 317368
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 3c4dae92ebf..e0045e9f48a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2901,7 +2901,9 @@ static bool mergeConditionalStoreToAddress(BasicBlock *PTB, BasicBlock *PFB, else return false; } - return N <= PHINodeFoldingThreshold; + // The store we want to merge is counted in N, so add 1 to make sure + // we're counting the instructions that would be left. + return N <= (PHINodeFoldingThreshold + 1); }; if (!MergeCondStoresAggressively && |