[llvm] r329129 - [Hexagon] peel loops with runtime small trip counts
Ikhlas Ajbar via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 3 15:55:09 PDT 2018
Author: iajbar
Date: Tue Apr 3 15:55:09 2018
New Revision: 329129
URL: http://llvm.org/viewvc/llvm-project?rev=329129&view=rev
Log:
[Hexagon] peel loops with runtime small trip counts
Move the check canPeel() to Hexagon Target before setting PeelCount.
Differential Revision: https://reviews.llvm.org/D44880
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp?rev=329129&r1=329128&r2=329129&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp Tue Apr 3 15:55:09 2018
@@ -21,6 +21,7 @@
#include "llvm/IR/User.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Transforms/Utils/UnrollLoop.h"
using namespace llvm;
@@ -45,7 +46,7 @@ void HexagonTTIImpl::getUnrollingPrefere
TTI::UnrollingPreferences &UP) {
UP.Runtime = UP.Partial = true;
// Only try to peel innermost loops with small runtime trip counts.
- if (L && L->empty() &&
+ if (L && L->empty() && canPeel(L) &&
SE.getSmallConstantTripCount(L) == 0 &&
SE.getSmallConstantMaxTripCount(L) > 0 &&
SE.getSmallConstantMaxTripCount(L) <= 5) {
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=329129&r1=329128&r2=329129&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Tue Apr 3 15:55:09 2018
@@ -978,9 +978,6 @@ static LoopUnrollResult tryToUnrollLoop(
if (UP.Threshold == 0 && (!UP.Partial || UP.PartialThreshold == 0))
return LoopUnrollResult::Unmodified;
- if (UP.PeelCount && !canPeel(L))
- UP.PeelCount = 0;
-
SmallPtrSet<const Value *, 32> EphValues;
CodeMetrics::collectEphemeralValues(L, &AC, EphValues);
More information about the llvm-commits
mailing list