mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 12:02:58 +02:00
997f895ee0
Summary: The default threshold for fully unroll is too conservative. This patch doubles the full-unroll threshold This change will affect the following speccpu2006 benchmarks (performance numbers were collected from Intel Sandybridge): Performance: 403 0.11% 433 0.51% 445 0.48% 447 3.50% 453 1.49% 464 0.75% Code size: 403 0.56% 433 0.96% 445 2.16% 447 2.96% 453 0.94% 464 8.02% The compiler time overhead is similar with code size. Reviewers: davidxl, mkuper, mzolotukhin, hfinkel, chandlerc Reviewed By: hfinkel, chandlerc Subscribers: mehdi_amini, zzheng, efriedma, haicheng, hfinkel, llvm-commits Differential Revision: https://reviews.llvm.org/D28368 llvm-svn: 295538
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
//===- LoopUnrollPass.h -----------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TRANSFORMS_SCALAR_LOOPUNROLLPASS_H
|
|
#define LLVM_TRANSFORMS_SCALAR_LOOPUNROLLPASS_H
|
|
|
|
#include "llvm/Analysis/LoopInfo.h"
|
|
#include "llvm/IR/PassManager.h"
|
|
#include "llvm/Transforms/Scalar/LoopPassManager.h"
|
|
|
|
namespace llvm {
|
|
|
|
class LoopUnrollPass : public PassInfoMixin<LoopUnrollPass> {
|
|
const bool AllowPartialUnrolling;
|
|
const int OptLevel;
|
|
|
|
explicit LoopUnrollPass(bool AllowPartialUnrolling, int OptLevel)
|
|
: AllowPartialUnrolling(AllowPartialUnrolling), OptLevel(OptLevel) {}
|
|
|
|
public:
|
|
/// Create an instance of the loop unroll pass that will support both full
|
|
/// and partial unrolling.
|
|
///
|
|
/// This uses the target information (or flags) to control the thresholds for
|
|
/// different unrolling stategies but supports all of them.
|
|
static LoopUnrollPass create(int OptLevel = 2) {
|
|
return LoopUnrollPass(/*AllowPartialUnrolling*/ true, OptLevel);
|
|
}
|
|
|
|
/// Create an instance of the loop unroll pass that only does full loop
|
|
/// unrolling.
|
|
///
|
|
/// This will disable any runtime or partial unrolling.
|
|
static LoopUnrollPass createFull(int OptLevel = 2) {
|
|
return LoopUnrollPass(/*AllowPartialUnrolling*/ false, OptLevel);
|
|
}
|
|
|
|
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
|
|
LoopStandardAnalysisResults &AR, LPMUpdater &U);
|
|
};
|
|
} // end namespace llvm
|
|
|
|
#endif // LLVM_TRANSFORMS_SCALAR_LOOPUNROLLPASS_H
|