| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2019-2021 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "common/LLVMWarningsPush.hpp" |
| 12 |
#include <llvm/Pass.h> |
| 13 |
#include <llvm/Analysis/LoopPass.h> |
| 14 |
#include <llvm/Transforms/Utils/UnrollLoop.h> |
| 15 |
#include "common/LLVMWarningsPop.hpp" |
| 16 |
|
| 17 |
using namespace llvm; |
| 18 |
|
| 19 |
namespace IGC { |
| 20 |
/// @brief Disables loop unroll for each loop by setting llvm.loop.unroll.disable |
| 21 |
class DisableLoopUnrollOnRetry : public LoopPass { |
| 22 |
public: |
| 23 |
static char ID; |
| 24 |
|
| 25 |
DisableLoopUnrollOnRetry(); |
| 26 |
|
| 27 |
virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const { AU.setPreservesCFG(); } |
| 28 |
|
| 29 |
virtual StringRef getPassName() const { return "DisableLoopUnrollOnRetry"; } |
| 30 |
|
| 31 |
virtual bool runOnLoop(Loop *L, LPPassManager &LPM); |
| 32 |
}; |
| 33 |
|
| 34 |
} // namespace IGC |