summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineCombiner.cpp
diff options
context:
space:
mode:
authorAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2018-03-16 16:06:24 +0000
committerAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2018-03-16 16:06:24 +0000
commita0cd09d4a2ef4642550d0b6971ad76345a41e549 (patch)
tree7e07b45d5dce414393fcfc0957c6490aa01ca7b6 /llvm/lib/CodeGen/MachineCombiner.cpp
parent9c1a6e7e24272aefc2ae2182ce24e9c4e1cded42 (diff)
downloadbcm5719-llvm-a0cd09d4a2ef4642550d0b6971ad76345a41e549.tar.gz
bcm5719-llvm-a0cd09d4a2ef4642550d0b6971ad76345a41e549.zip
This patch fixes the invalid usage of OptSize in Machine Combiner.
Differential Revision: https://reviews.llvm.org/D43813 llvm-svn: 327721
Diffstat (limited to 'llvm/lib/CodeGen/MachineCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCombiner.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineCombiner.cpp b/llvm/lib/CodeGen/MachineCombiner.cpp
index efb463f8810..7637a6474ff 100644
--- a/llvm/lib/CodeGen/MachineCombiner.cpp
+++ b/llvm/lib/CodeGen/MachineCombiner.cpp
@@ -407,8 +407,8 @@ bool MachineCombiner::preservesResourceLen(
/// \returns true when new instruction sequence should be generated
/// independent if it lengthens critical path or not
bool MachineCombiner::doSubstitute(unsigned NewSize, unsigned OldSize) {
- if (OptSize && (NewSize < OldSize))
- return true;
+ if (OptSize) // First of all check OptSize option
+ return (NewSize < OldSize); // Only substitute if new size < old size
if (!TSchedModel.hasInstrSchedModelOrItineraries())
return true;
return false;
@@ -588,7 +588,7 @@ bool MachineCombiner::combineInstructions(MachineBasicBlock *MBB) {
// Eagerly stop after the first pattern fires.
Changed = true;
break;
- } else {
+ } else if (!OptSize || (NewInstCount <= OldInstCount)) {
// For big basic blocks, we only compute the full trace the first time
// we hit this. We do not invalidate the trace, but instead update the
// instruction depths incrementally.
OpenPOWER on IntegriCloud