diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index cf6f1d5c..6fd06f59 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -96,6 +96,8 @@ jobs: -DLLVM_PARALLEL_LINK_JOBS=1 ../cmake/superbuild \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_STANDARD=14 \ + -DLLVM_ENABLE_CXX1Y=ON \ -DOPTSCHEDSUPER_LLVM_EXTRA_CMAKE_ARGS='-DLLVM_ENABLE_ASSERTIONS=ON' \ -DOPTSCHED_EXTRA_DEFINITIONS='-DIS_DEBUG' @@ -188,6 +190,7 @@ jobs: cmake ../llvm-project/llvm -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ '-DLLVM_TARGETS_TO_BUILD=X86;AMDGPU' \ -DLLVM_TABLEGEN=$(which llvm-tblgen-7) \ diff --git a/.github/workflows/llvm-versions.yml b/.github/workflows/llvm-versions.yml new file mode 100644 index 00000000..2c1c4fe9 --- /dev/null +++ b/.github/workflows/llvm-versions.yml @@ -0,0 +1,149 @@ +name: Check LLVM Versions + +on: + push: + branches: [ master ] + issue_comment: # On PR issue comment + types: [ created ] + +jobs: + comment-triggered: + runs-on: ubuntu-20.04 + + outputs: + value: ${{ steps.value.outputs.value }} + checks_should_run: ${{ steps.checks_should_run.outputs.checks_should_run }} + + steps: + - id: value + # Allow triggering with a comment of `Do: Check LLVM Versions`. + # If we are a pull_request, we have the trigger comment, and the person + # requesting is the one who made the PR, then we run. + run: >- + echo "::set-output name=value::${{ github.event_name == 'issue_comment' + && github.event.issue.pull_request != '' + && github.event.comment.body == 'Do: Check LLVM Versions' + && github.event.comment.user.id == github.event.issue.user.id }}" + + - id: checks_should_run + run: >- + echo "::set-output name=checks_should_run::${{ + steps.value.outputs.value == 'true' + || github.event_name == 'push' + || github.event_name == 'pull_request' }}" + + init-report: + needs: comment-triggered + runs-on: ubuntu-20.04 + if: needs.comment-triggered.outputs.value == 'true' + + outputs: + report: ${{ steps.report.outputs.comment-id }} + + steps: + - name: Initialize Report + uses: peter-evans/create-or-update-comment@v1.4.3 + id: report + with: + issue-number: ${{ github.event.issue.number }} + body: | + Checking LLVM versions: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + check-llvm-versions: + needs: comment-triggered + runs-on: ubuntu-${{ matrix.os }} + if: needs.comment-triggered.outputs.checks_should_run == 'true' + + strategy: + fail-fast: false + matrix: + include: + - llvm: 7 + llvm-ver: 7.1 + os: 18.04 + ubuntu: bionic + - llvm: 8 + llvm-ver: 8.0 + os: 18.04 + ubuntu: bionic + - llvm: 9 + llvm-ver: 9.0 + os: 20.04 + ubuntu: focal + - llvm: 10 + llvm-ver: 10.0 + os: 20.04 + ubuntu: focal + - llvm: 11 + llvm-ver: 11.1 + os: 20.04 + ubuntu: focal + - llvm: 12 + llvm-ver: 12.0 + os: 20.04 + ubuntu: focal + - llvm: 13 + llvm-ver: 13.0 + os: 20.04 + ubuntu: focal + + steps: + - name: Install dependencies + run: | + # Setup LLVM GPG Key + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + + sudo add-apt-repository "deb http://apt.llvm.org/${{ matrix.ubuntu }}/ llvm-toolchain-${{ matrix.ubuntu }}-${{ matrix.llvm }} main" + sudo apt-get update + + sudo apt-get install clang++-${{ matrix.llvm }} llvm-${{ matrix.llvm }} ninja-build + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - run: | + echo ${{ github.token }} | gh auth login --with-token + gh pr checkout ${{ github.event.issue.number }} + if: needs.comment-triggered.outputs.value == 'true' + + - name: Configure OptSched + run: | + mkdir build-optsched && cd build-optsched + + cmake .. -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPTSCHED_LLVM_VERSION=${{ matrix.llvm-ver }} \ + -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc \ + -DOPTSCHED_ENABLE_AMDGPU=OFF \ + -DCMAKE_INSTALL_PREFIX=$PWD/install + + - name: Build OptSched + working-directory: build-optsched + run: ninja + + - name: Run tests + working-directory: build-optsched + run: ctest -VV + + report: + needs: [comment-triggered, init-report, check-llvm-versions] + runs-on: ubuntu-20.04 + if: always() + + steps: + - name: Report CI + if: needs.comment-triggered.outputs.value == 'true' + uses: peter-evans/create-or-update-comment@v1.4.3 + with: + comment-id: ${{ needs.init-report.outputs.report }} + body: | + | Check | Status | + | ----- | ------ | + ${{ + format('| Check LLVM Versions | {0}{1}{2} |', + needs.check-llvm-versions.result == 'success' && '✔ Passed' || '', + needs.check-llvm-versions.result == 'failure' && '❌ Failed' || '', + (needs.check-llvm-versions.result != 'success' && needs.check-llvm-versions.result != 'failure') && 'Skipped' || '' + ) + }} diff --git a/.gitignore b/.gitignore index be2ee7fd..9959d908 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/build -/.vscode +build +.vscode __pycache__ *.pyc diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b0eab82..b16db6be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4.3) +cmake_minimum_required(VERSION 3.8) project(OptSched) diff --git a/include/opt-sched/Scheduler/lnkd_lst.h b/include/opt-sched/Scheduler/lnkd_lst.h index 9331fb7b..8e641152 100644 --- a/include/opt-sched/Scheduler/lnkd_lst.h +++ b/include/opt-sched/Scheduler/lnkd_lst.h @@ -178,9 +178,9 @@ template std::unique_ptr> makeDynamicOrArenaAllocator(int MaxSize) { if (MaxSize == INVALID_VALUE) - return llvm::make_unique>(); + return std::make_unique>(); else - return llvm::make_unique>(MaxSize); + return std::make_unique>(MaxSize); } template class LinkedList; diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f831478b..c027926c 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -58,4 +58,5 @@ add_optsched_library(OptSched ${OPTSCHED_SRCS} LINK_LIBS ${OPTSCHED_LINK_LIBS} ) +target_compile_features(OptSched PUBLIC cxx_std_14) # We need >= C++14 add_dependencies(OptSched ${OPTSCHED_TARGET_DEPS}) diff --git a/lib/Scheduler/aco.cpp b/lib/Scheduler/aco.cpp index 9d2b8d71..31c486d0 100644 --- a/lib/Scheduler/aco.cpp +++ b/lib/Scheduler/aco.cpp @@ -283,7 +283,7 @@ std::unique_ptr ACOScheduler::FindOneSchedule(InstCount TargetRPCost) { SchedInstruction *lastInst = NULL; std::unique_ptr schedule = - llvm::make_unique(machMdl_, dataDepGraph_, true); + std::make_unique(machMdl_, dataDepGraph_, true); InstCount maxPriority = rdyLst_->MaxPriority(); if (maxPriority == 0) maxPriority = 1; // divide by 0 is bad @@ -671,7 +671,7 @@ void PrintSchedule(InstSchedule *schedule) { void ACOScheduler::setInitialSched(InstSchedule *Sched) { if (Sched) { InitialSchedule = - llvm::make_unique(machMdl_, dataDepGraph_, VrfySched_); + std::make_unique(machMdl_, dataDepGraph_, VrfySched_); InitialSchedule->Copy(Sched); } } diff --git a/lib/Scheduler/bb_spill.cpp b/lib/Scheduler/bb_spill.cpp index 53a50975..654afe00 100644 --- a/lib/Scheduler/bb_spill.cpp +++ b/lib/Scheduler/bb_spill.cpp @@ -199,7 +199,7 @@ static InstCount ComputeSLILStaticLowerBound(int64_t regTypeCnt_, // between the recursive successor list of this instruction and the // recursive predecessors of the dependent instruction. auto recSuccBV = inst->GetRcrsvNghbrBitVector(DIR_FRWRD); - for (Register *def : inst->GetDefs()) { + for (opt_sched::Register *def : inst->GetDefs()) { for (const auto &dependentInst : def->GetUseList()) { auto recPredBV = const_cast(dependentInst) ->GetRcrsvNghbrBitVector(DIR_BKWRD); @@ -225,14 +225,15 @@ static InstCount ComputeSLILStaticLowerBound(int64_t regTypeCnt_, // based on the instructions that use more than one register (defined by // different instructions). int commonUseLowerBound = closureLowerBound; - std::vector> usedInsts; + std::vector> + usedInsts; for (int i = 0; i < dataDepGraph_->GetInstCnt(); ++i) { const auto &inst = dataDepGraph_->GetInstByIndx(i); // Get a list of instructions that define the registers, in array form. usedInsts.clear(); llvm::transform(inst->GetUses(), std::back_inserter(usedInsts), - [&](Register *reg) { + [&](opt_sched::Register *reg) { assert(reg->GetDefList().size() == 1 && "Number of defs for register is not 1!"); return std::make_pair(*(reg->GetDefList().begin()), reg); @@ -477,7 +478,7 @@ void BBWithSpill::UpdateSpillInfoForSchdul_(SchedInstruction *inst, #endif // Update Live regs after uses - for (Register *use : inst->GetUses()) { + for (opt_sched::Register *use : inst->GetUses()) { regType = use->GetType(); regNum = use->GetNum(); physRegNum = use->GetPhysicalNumber(); @@ -519,7 +520,7 @@ void BBWithSpill::UpdateSpillInfoForSchdul_(SchedInstruction *inst, } // Update Live regs after defs - for (Register *def : inst->GetDefs()) { + for (opt_sched::Register *def : inst->GetDefs()) { regType = def->GetType(); regNum = def->GetNum(); physRegNum = def->GetPhysicalNumber(); @@ -575,7 +576,7 @@ void BBWithSpill::UpdateSpillInfoForSchdul_(SchedInstruction *inst, sumOfLiveIntervalLengths_[i] += liveRegs_[i].GetOneCnt(); for (int j = 0; j < liveRegs_[i].GetSize(); ++j) { if (liveRegs_[i].GetBit(j)) { - const Register *reg = regFiles_[i].GetReg(j); + const opt_sched::Register *reg = regFiles_[i].GetReg(j); if (!reg->IsInInterval(inst) && !reg->IsInPossibleInterval(inst)) { ++dynamicSlilLowerBound_; } @@ -636,7 +637,7 @@ void BBWithSpill::UpdateSpillInfoForUnSchdul_(SchedInstruction *inst) { for (int i = 0; i < regTypeCnt_; ++i) { for (int j = 0; j < liveRegs_[i].GetSize(); ++j) { if (liveRegs_[i].GetBit(j)) { - const Register *reg = regFiles_[i].GetReg(j); + const opt_sched::Register *reg = regFiles_[i].GetReg(j); sumOfLiveIntervalLengths_[i]--; if (!reg->IsInInterval(inst) && !reg->IsInPossibleInterval(inst)) { --dynamicSlilLowerBound_; @@ -649,7 +650,7 @@ void BBWithSpill::UpdateSpillInfoForUnSchdul_(SchedInstruction *inst) { } // Update Live regs - for (Register *def : inst->GetDefs()) { + for (opt_sched::Register *def : inst->GetDefs()) { regType = def->GetType(); regNum = def->GetNum(); physRegNum = def->GetPhysicalNumber(); @@ -674,7 +675,7 @@ void BBWithSpill::UpdateSpillInfoForUnSchdul_(SchedInstruction *inst) { //} } - for (Register *use : inst->GetUses()) { + for (opt_sched::Register *use : inst->GetUses()) { regType = use->GetType(); regNum = use->GetNum(); physRegNum = use->GetPhysicalNumber(); @@ -1091,8 +1092,8 @@ bool BBWithSpill::ChkInstLglty(SchedInstruction *inst) { /* int16_t regType; int defCnt, physRegNum; - Register **defs; - Register *def, *liveDef; + opt_sched::Register **defs; + opt_sched::Register *def, *liveDef; #ifdef IS_DEBUG_CHECK Logger::Info("Checking inst %d %s", inst->GetNum(), inst->GetOpCode()); @@ -1111,7 +1112,7 @@ bool BBWithSpill::ChkInstLglty(SchedInstruction *inst) { } // Update Live regs - for (Register *def : inst->GetDefs()) { + for (opt_sched::Register *def : inst->GetDefs()) { regType = def->GetType(); physRegNum = def->GetPhysicalNumber(); diff --git a/lib/Scheduler/data_dep.cpp b/lib/Scheduler/data_dep.cpp index 1a31ae63..4861a3be 100644 --- a/lib/Scheduler/data_dep.cpp +++ b/lib/Scheduler/data_dep.cpp @@ -197,7 +197,7 @@ DataDepGraph::DataDepGraph(MachineModel *machMdl, LATENCY_PRECISION ltncyPrcsn) entryInstCnt_ = 0; exitInstCnt_ = 0; - RegFiles = llvm::make_unique(machMdl_->GetRegTypeCnt()); + RegFiles = std::make_unique(machMdl_->GetRegTypeCnt()); } DataDepGraph::~DataDepGraph() { diff --git a/lib/Scheduler/graph_trans_ilp.cpp b/lib/Scheduler/graph_trans_ilp.cpp index 14736687..4830e494 100644 --- a/lib/Scheduler/graph_trans_ilp.cpp +++ b/lib/Scheduler/graph_trans_ilp.cpp @@ -158,7 +158,7 @@ StaticNodeSupILPTrans::DataAlloc::DataAlloc(DataDepGraph &DDG) SuperiorNodesList( createSuperiorNodesList(wrapAs2D(SuperiorArray, DDG.GetNodeCnt()))), AddedEdges(), Stats(), - Data_(llvm::make_unique(Data{ + Data_(std::make_unique(Data{ DDG, wrapAs2D(this->DistanceTable, DDG.GetNodeCnt()), wrapAs2D(this->SuperiorArray, DDG.GetNodeCnt()), diff --git a/lib/Scheduler/register.cpp b/lib/Scheduler/register.cpp index 85d638aa..f5839f74 100644 --- a/lib/Scheduler/register.cpp +++ b/lib/Scheduler/register.cpp @@ -165,7 +165,7 @@ void RegisterFile::ResetCrntLngths() { Register *RegisterFile::getNext() { size_t RegNum = Regs.size(); - auto Reg = llvm::make_unique(); + auto Reg = std::make_unique(); Reg->SetType(regType_); Reg->SetNum(RegNum); Regs.push_back(std::move(Reg)); @@ -178,7 +178,7 @@ void RegisterFile::SetRegCnt(int regCnt) { Regs.resize(regCnt); for (int i = 0; i < getCount(); i++) { - auto Reg = llvm::make_unique(); + auto Reg = std::make_unique(); Reg->SetType(regType_); Reg->SetNum(i); Regs[i] = std::move(Reg); diff --git a/lib/Scheduler/sched_region.cpp b/lib/Scheduler/sched_region.cpp index 478c3cdd..c3399018 100644 --- a/lib/Scheduler/sched_region.cpp +++ b/lib/Scheduler/sched_region.cpp @@ -146,7 +146,7 @@ static bool isBbEnabled(Config &schedIni, Milliseconds rgnTimeout) { static void dumpDDG(DataDepGraph *DDG, llvm::StringRef DDGDumpPath, llvm::StringRef Suffix = "") { - std::string Path = DDGDumpPath; + std::string Path(DDGDumpPath); Path += DDG->GetDagID(); if (!Suffix.empty()) { diff --git a/lib/Wrapper/AMDGPU/GCNOptSched.cpp b/lib/Wrapper/AMDGPU/GCNOptSched.cpp index 7c3d2993..27625567 100644 --- a/lib/Wrapper/AMDGPU/GCNOptSched.cpp +++ b/lib/Wrapper/AMDGPU/GCNOptSched.cpp @@ -22,7 +22,7 @@ static cl::opt static ScheduleDAGInstrs *createOptSchedGCN(MachineSchedContext *C) { ScheduleDAGMILive *DAG = new ScheduleDAGOptSchedGCN( - C, llvm::make_unique(C)); + C, std::make_unique(C)); DAG->addMutation(createLoadClusterDAGMutation(DAG->TII, DAG->TRI)); DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI)); return DAG; diff --git a/lib/Wrapper/AMDGPU/OptSchedDDGWrapperGCN.cpp b/lib/Wrapper/AMDGPU/OptSchedDDGWrapperGCN.cpp index 6f18a644..2ba35b68 100644 --- a/lib/Wrapper/AMDGPU/OptSchedDDGWrapperGCN.cpp +++ b/lib/Wrapper/AMDGPU/OptSchedDDGWrapperGCN.cpp @@ -29,7 +29,7 @@ namespace { std::unique_ptr createSubRegSet(unsigned Reg, const MachineRegisterInfo &MRI, int16_t Type) { - return llvm::make_unique( + return std::make_unique( MRI.getMaxLaneMaskForVReg(Reg).getNumLanes(), Type); } diff --git a/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp b/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp index de934477..f26fa0be 100644 --- a/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp +++ b/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp @@ -66,15 +66,15 @@ class OptSchedGCNTarget : public OptSchedTarget { public: std::unique_ptr createMachineModel(const char *ConfigPath) override { - return llvm::make_unique(ConfigPath); + return std::make_unique(ConfigPath); } std::unique_ptr createDDGWrapper(llvm::MachineSchedContext *Context, ScheduleDAGOptSched *DAG, OptSchedMachineModel *MM, LATENCY_PRECISION LatencyPrecision, const std::string &RegionID) override { - return llvm::make_unique(Context, DAG, MM, - LatencyPrecision, RegionID); + return std::make_unique(Context, DAG, MM, + LatencyPrecision, RegionID); } void initRegion(llvm::ScheduleDAGInstrs *DAG, MachineModel *MM_) override; @@ -113,7 +113,7 @@ class OptSchedGCNTarget : public OptSchedTarget { }; std::unique_ptr createOptSchedGCNTarget() { - return llvm::make_unique(); + return std::make_unique(); } } // end anonymous namespace diff --git a/lib/Wrapper/OptSchedDDGWrapperBasic.cpp b/lib/Wrapper/OptSchedDDGWrapperBasic.cpp index d90ec76e..5c1be1de 100644 --- a/lib/Wrapper/OptSchedDDGWrapperBasic.cpp +++ b/lib/Wrapper/OptSchedDDGWrapperBasic.cpp @@ -449,7 +449,7 @@ void OptSchedDDGWrapperBasic::convertEdges(const SUnit &SU, int16_t Latency; if (ltncyPrcsn_ == LTP_PRECISE) { // get latency from the machine model const auto &InstName = DAG->TII->getName(instr->getOpcode()); - const auto &InstType = MM->GetInstTypeByName(InstName); + const auto &InstType = MM->GetInstTypeByName(std::string(InstName)); Latency = MM->GetLatency(InstType, DepType); } else if (ltncyPrcsn_ == LTP_ROUGH) { // rough latency = llvm latency Latency = I->getLatency(); @@ -457,9 +457,11 @@ void OptSchedDDGWrapperBasic::convertEdges(const SUnit &SU, // by the specified divisor if (DAG->reducedLatencyPassStarted() && Latency > DAG->getLatencyTarget()) { - const string &InstFromName = DAG->TII->getName(instr->getOpcode()); + const string &InstFromName = + std::string(DAG->TII->getName(instr->getOpcode())); const MachineInstr *ToInstr = I->getSUnit()->getInstr(); - const string &InstToName = DAG->TII->getName(ToInstr->getOpcode()); + const string &InstToName = + std::string(DAG->TII->getName(ToInstr->getOpcode())); int16_t OldLatency = Latency; Latency /= DAG->getLatencyDivisor(); if (Latency < DAG->getLatencyMinimun()) @@ -484,7 +486,7 @@ void OptSchedDDGWrapperBasic::convertSUnit(const SUnit &SU) { return; const MachineInstr *MI = SU.getInstr(); - InstName = DAG->TII->getName(MI->getOpcode()); + InstName = std::string(DAG->TII->getName(MI->getOpcode())); // Search in the machine model for an instType with this OpCode name InstType = MM->GetInstTypeByName(InstName.c_str()); diff --git a/lib/Wrapper/OptSchedGenericTarget.cpp b/lib/Wrapper/OptSchedGenericTarget.cpp index 3299d1b1..02f8e105 100644 --- a/lib/Wrapper/OptSchedGenericTarget.cpp +++ b/lib/Wrapper/OptSchedGenericTarget.cpp @@ -24,14 +24,14 @@ class OptSchedGenericTarget : public OptSchedTarget { public: std::unique_ptr createMachineModel(const char *ConfigPath) override { - return llvm::make_unique(ConfigPath); + return std::make_unique(ConfigPath); } std::unique_ptr createDDGWrapper(llvm::MachineSchedContext *Context, ScheduleDAGOptSched *DAG, OptSchedMachineModel *MM, LATENCY_PRECISION LatencyPrecision, const std::string &RegionID) override { - return llvm::make_unique( + return std::make_unique( Context, DAG, MM, LatencyPrecision, RegionID); } @@ -57,7 +57,7 @@ namespace llvm { namespace opt_sched { std::unique_ptr createOptSchedGenericTarget() { - return llvm::make_unique(); + return std::make_unique(); } OptSchedTargetRegistry diff --git a/lib/Wrapper/OptSchedMachineWrapper.cpp b/lib/Wrapper/OptSchedMachineWrapper.cpp index c22b62af..caf4dfec 100644 --- a/lib/Wrapper/OptSchedMachineWrapper.cpp +++ b/lib/Wrapper/OptSchedMachineWrapper.cpp @@ -45,13 +45,13 @@ void dumpInstType(InstTypeInfo &instType, MachineModel *mm) { std::unique_ptr createCortexA7MMGenerator(const llvm::ScheduleDAGInstrs *dag, MachineModel *mm) { - return make_unique(dag, mm); + return std::make_unique(dag, mm); } std::unique_ptr createCortexA53MMGenerator(const llvm::ScheduleDAGInstrs *dag, MachineModel *mm) { - return make_unique(dag, mm); + return std::make_unique(dag, mm); } } // end anonymous namespace @@ -183,7 +183,7 @@ IssueType CortexA7MMGenerator::generateIssueType(const InstrStage *E) const { InstType CortexA7MMGenerator::generateInstrType(const MachineInstr *instr) { // Search in the machine model for an instType with this OpCode - const std::string instrName = DAG->TII->getName(instr->getOpcode()); + const std::string instrName(DAG->TII->getName(instr->getOpcode())); const InstType InstType = MM->GetInstTypeByName(instrName); // If the machine model does not have instType with this OpCode name, @@ -242,7 +242,7 @@ void CortexA53MMGenerator::generateProcessorData(std::string *mdlName_, InstType CortexA53MMGenerator::generateInstrType(const llvm::MachineInstr *instr) { // Search in the machine model for an instType with this OpCode - const std::string InstrName = DAG->TII->getName(instr->getOpcode()); + const std::string InstrName(DAG->TII->getName(instr->getOpcode())); const InstType InstrType = MM->GetInstTypeByName(InstrName); // If the machine model does not have instType with this OpCode name, diff --git a/lib/Wrapper/OptimizingScheduler.cpp b/lib/Wrapper/OptimizingScheduler.cpp index 49ea6d79..2e605bcb 100644 --- a/lib/Wrapper/OptimizingScheduler.cpp +++ b/lib/Wrapper/OptimizingScheduler.cpp @@ -32,6 +32,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetMachine.h" #include #include #include @@ -68,7 +69,7 @@ static constexpr const char *DEFAULT_CFGMM_FNAME = "/machine_model.cfg"; // Create OptSched ScheduleDAG. static ScheduleDAGInstrs *createOptSched(MachineSchedContext *C) { ScheduleDAGMILive *DAG = - new ScheduleDAGOptSched(C, llvm::make_unique(C)); + new ScheduleDAGOptSched(C, std::make_unique(C)); DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI)); // README: if you need the x86 mutations uncomment the next line. // addMutation(createX86MacroFusionDAGMutation()); @@ -178,7 +179,7 @@ static SchedulerType parseListSchedType() { static std::unique_ptr createStaticNodeSupTrans(DataDepGraph *DataDepGraph, bool IsMultiPass = false) { - return llvm::make_unique(DataDepGraph, IsMultiPass); + return std::make_unique(DataDepGraph, IsMultiPass); } void ScheduleDAGOptSched::addGraphTransformations( @@ -196,7 +197,7 @@ void ScheduleDAGOptSched::addGraphTransformations( if (ILPStaticNodeSup) { GraphTransformations->push_back( - llvm::make_unique(BDDG)); + std::make_unique(BDDG)); } } @@ -424,7 +425,7 @@ void ScheduleDAGOptSched::schedule() { addGraphTransformations(BDDG); // create region - auto region = llvm::make_unique( + auto region = std::make_unique( OST.get(), static_cast(DDG.get()), 0, HistTableHashBits, LowerBoundAlgorithm, HeuristicPriorities, EnumPriorities, VerifySchedule, PruningStrategy, SchedForRPOnly, EnumStalls, SCW, SCF, HeurSchedType); @@ -652,7 +653,7 @@ bool ScheduleDAGOptSched::isOptSchedEnabled() const { return true; } else if (optSchedOption == "HOT_ONLY") { // get the name of the function this scheduler was created for - std::string functionName = C->MF->getFunction().getName(); + std::string functionName(C->MF->getFunction().getName()); // check the list of hot functions for the name of the current function return HotFunctions.GetBool(functionName, false); } else if (optSchedOption == "NO") { @@ -761,7 +762,7 @@ bool ScheduleDAGOptSched::shouldPrintSpills() const { } else if (printSpills == "NO") { return false; } else if (printSpills == "HOT_ONLY") { - std::string functionName = C->MF->getFunction().getName(); + std::string functionName(C->MF->getFunction().getName()); return HotFunctions.GetBool(functionName, false); } diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 38005ba2..b1ee73df 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -10,6 +10,7 @@ endfunction() # All unit test targets depend on OptSched add_library(UnitTest.OptSched STATIC $) +target_compile_features(UnitTest.OptSched PUBLIC cxx_std_14) link_libraries(UnitTest.OptSched) add_subdirectory(Basic)