[PATCH] D43813: [Machine Combiner] Valid use of OptSize

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 09:08:57 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327721: This patch fixes the invalid usage of OptSize in Machine Combiner. (authored by avt77, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43813?vs=136054&id=138723#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43813

Files:
  llvm/trunk/lib/CodeGen/MachineCombiner.cpp


Index: llvm/trunk/lib/CodeGen/MachineCombiner.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MachineCombiner.cpp
+++ llvm/trunk/lib/CodeGen/MachineCombiner.cpp
@@ -407,8 +407,8 @@
 /// \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 @@
         // 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43813.138723.patch
Type: text/x-patch
Size: 1126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180316/b0444f16/attachment.bin>


More information about the llvm-commits mailing list