[PATCH] D43813: [Machine Combiner] Valid use of OptSize
Andrew V. Tischenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 02:33:51 PST 2018
avt77 created this revision.
avt77 added reviewers: Gerolf, RKSimon, spatel, dtemirbulatov.
Currently we're able to select longer alternative code sequence if it has better sched numbers but we should always select the shortest code sequence if OptSize == true. This patch fixes the given issue.
https://reviews.llvm.org/D43813
Files:
lib/CodeGen/MachineCombiner.cpp
Index: lib/CodeGen/MachineCombiner.cpp
===================================================================
--- lib/CodeGen/MachineCombiner.cpp
+++ lib/CodeGen/MachineCombiner.cpp
@@ -407,8 +407,11 @@
/// \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
+ if (NewSize < OldSize)
+ return true; // Do substitute in any case if new size < old size
+ return false; // We should not do substitute if new size >= old size
+ }
if (!TSchedModel.hasInstrSchedModelOrItineraries())
return true;
return false;
@@ -588,7 +591,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.136054.patch
Type: text/x-patch
Size: 1183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180227/6f0dad08/attachment.bin>
More information about the llvm-commits
mailing list