[llvm] r189566 - Revert: r189565 - Add getUnrollingPreferences to TTI
Hal Finkel
hfinkel at anl.gov
Wed Aug 28 20:33:15 PDT 2013
Author: hfinkel
Date: Wed Aug 28 22:33:15 2013
New Revision: 189566
URL: http://llvm.org/viewvc/llvm-project?rev=189566&view=rev
Log:
Revert: r189565 - Add getUnrollingPreferences to TTI
Revert unintentional commit (of an unreviewed change).
Original commit message:
Add getUnrollingPreferences to TTI
Allow targets to customize the default behavior of the generic loop unrolling
transformation. This will be used by the PowerPC backend when targeting the A2
core (which is in-order with a deep pipeline), and using more aggressive
defaults is important.
Modified:
llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
llvm/trunk/lib/CodeGen/BasicTargetTransformInfo.cpp
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h?rev=189566&r1=189565&r2=189566&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h Wed Aug 28 22:33:15 2013
@@ -191,20 +191,6 @@ public:
/// incurs significant execution cost.
virtual bool isLoweredToCall(const Function *F) const;
- /// Parameters that control the generic loop unrolling transformation.
- struct UnrollingPreferences {
- unsigned Threshold; ///< The cost threshold for the unrolled loop.
- unsigned OptSizeThreshold; ///< The cost threshold for the unrolled loop
- ///< when optimizing for size.
- bool Partial; ///< Allow partial loop unrolling.
- bool Runtime; ///< Perform runtime unrolling.
- };
-
- /// \brief Get target-customized preferences for the generic loop unrolling
- /// transformation. Returns true if the UnrollingPreferences struct has been
- /// initialized.
- virtual bool getUnrollingPreferences(UnrollingPreferences &UP) const;
-
/// @}
/// \name Scalar Target Information
Modified: llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=189566&r1=189565&r2=189566&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetTransformInfo.cpp Wed Aug 28 22:33:15 2013
@@ -96,11 +96,6 @@ bool TargetTransformInfo::isLoweredToCal
return PrevTTI->isLoweredToCall(F);
}
-bool TargetTransformInfo::getUnrollingPreferences(
- UnrollingPreferences &UP) const {
- return PrevTTI->getUnrollingPreferences(UP);
-}
-
bool TargetTransformInfo::isLegalAddImmediate(int64_t Imm) const {
return PrevTTI->isLegalAddImmediate(Imm);
}
@@ -474,10 +469,6 @@ struct NoTTI : ImmutablePass, TargetTran
return true;
}
- virtual bool getUnrollingPreferences(UnrollingPreferences &) const {
- return false;
- }
-
bool isLegalAddImmediate(int64_t Imm) const {
return false;
}
Modified: llvm/trunk/lib/CodeGen/BasicTargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BasicTargetTransformInfo.cpp?rev=189566&r1=189565&r2=189566&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BasicTargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/BasicTargetTransformInfo.cpp Wed Aug 28 22:33:15 2013
@@ -84,7 +84,6 @@ public:
virtual unsigned getJumpBufSize() const;
virtual bool shouldBuildLookupTables() const;
virtual bool haveFastSqrt(Type *Ty) const;
- virtual bool getUnrollingPreferences(UnrollingPreferences &UP) const;
/// @}
@@ -190,10 +189,6 @@ bool BasicTTI::haveFastSqrt(Type *Ty) co
return TLI->isTypeLegal(VT) && TLI->isOperationLegalOrCustom(ISD::FSQRT, VT);
}
-bool BasicTTI::getUnrollingPreferences(UnrollingPreferences &) const {
- return false;
-}
-
//===----------------------------------------------------------------------===//
//
// Calls used by the vectorizers.
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=189566&r1=189565&r2=189566&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Wed Aug 28 22:33:15 2013
@@ -55,8 +55,6 @@ namespace {
CurrentAllowPartial = (P == -1) ? UnrollAllowPartial : (bool)P;
UserThreshold = (T != -1) || (UnrollThreshold.getNumOccurrences() > 0);
- UserAllowPartial = (P != -1) ||
- (UnrollAllowPartial.getNumOccurrences() > 0);
initializeLoopUnrollPass(*PassRegistry::getPassRegistry());
}
@@ -78,7 +76,6 @@ namespace {
unsigned CurrentThreshold;
bool CurrentAllowPartial;
bool UserThreshold; // CurrentThreshold is user-specified.
- bool UserAllowPartial; // CurrentAllowPartial is user-specified.
bool runOnLoop(Loop *L, LPPassManager &LPM);
@@ -148,20 +145,16 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPa
<< "] Loop %" << Header->getName() << "\n");
(void)Header;
- TargetTransformInfo::UnrollingPreferences UP;
- bool HasUP = TTI.getUnrollingPreferences(UP);
-
// Determine the current unrolling threshold. While this is normally set
// from UnrollThreshold, it is overridden to a smaller value if the current
// function is marked as optimize-for-size, and the unroll threshold was
// not user specified.
- unsigned Threshold = (HasUP && !UserThreshold) ? UP.Threshold :
- CurrentThreshold;
+ unsigned Threshold = CurrentThreshold;
if (!UserThreshold &&
Header->getParent()->getAttributes().
hasAttribute(AttributeSet::FunctionIndex,
Attribute::OptimizeForSize))
- Threshold = HasUP ? UP.OptSizeThreshold : OptSizeUnrollThreshold;
+ Threshold = OptSizeUnrollThreshold;
// Find trip count and trip multiple if count is not available
unsigned TripCount = 0;
@@ -191,9 +184,6 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPa
Count = TripCount;
}
- bool Runtime = (HasUP && UnrollRuntime.getNumOccurrences() == 0) ?
- UP.Runtime : UnrollRuntime;
-
// Enforce the threshold.
if (Threshold != NoThreshold) {
unsigned NumInlineCandidates;
@@ -214,9 +204,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPa
if (TripCount != 1 && Size > Threshold) {
DEBUG(dbgs() << " Too large to fully unroll with count: " << Count
<< " because size: " << Size << ">" << Threshold << "\n");
- bool AllowPartial = (HasUP && !UserAllowPartial) ? UP.Partial :
- CurrentAllowPartial;
- if (!AllowPartial && !(Runtime && TripCount == 0)) {
+ if (!CurrentAllowPartial && !(UnrollRuntime && TripCount == 0)) {
DEBUG(dbgs() << " will not try to unroll partially because "
<< "-unroll-allow-partial not given\n");
return false;
@@ -227,7 +215,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPa
while (Count != 0 && TripCount%Count != 0)
Count--;
}
- else if (Runtime) {
+ else if (UnrollRuntime) {
// Reduce unroll count to be a lower power-of-two value
while (Count != 0 && Size > Threshold) {
Count >>= 1;
@@ -243,7 +231,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPa
}
// Unroll the loop.
- if (!UnrollLoop(L, Count, TripCount, Runtime, TripMultiple, LI, &LPM))
+ if (!UnrollLoop(L, Count, TripCount, UnrollRuntime, TripMultiple, LI, &LPM))
return false;
return true;
More information about the llvm-commits
mailing list