[PATCH] D23388: [LoopUnroll] By default disable unrolling when optimizing for size.
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 16:21:26 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279585: [LoopUnroll] By default disable unrolling when optimizing for size. (authored by mzolotukhin).
Changed prior to commit:
https://reviews.llvm.org/D23388?vs=67639&id=69054#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23388
Files:
llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Index: llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
@@ -285,7 +285,11 @@
// Enable runtime and partial unrolling up to the specified size.
UP.Partial = UP.Runtime = true;
- UP.PartialThreshold = UP.PartialOptSizeThreshold = MaxOps;
+ UP.PartialThreshold = MaxOps;
+
+ // Avoid unrolling when optimizing for size.
+ UP.OptSizeThreshold = 0;
+ UP.PartialOptSizeThreshold = 0;
}
/// @}
Index: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -948,6 +948,10 @@
L, TTI, ProvidedThreshold, ProvidedCount, ProvidedAllowPartial,
ProvidedRuntime);
+ // Exit early if unrolling is disabled.
+ if (UP.Threshold == 0 && (!UP.Partial || UP.PartialThreshold == 0))
+ return false;
+
// If the loop contains a convergent operation, the prelude we'd add
// to do the first few instructions before we hit the unrolled loop
// is unsafe -- it adds a control-flow dependency to the convergent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23388.69054.patch
Type: text/x-patch
Size: 1297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160823/495d100b/attachment.bin>
More information about the llvm-commits
mailing list