//===--- Utils.cpp - Utility functions for the code generation --*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains utility functions for the code generation. // //===----------------------------------------------------------------------===// #include "polly/CodeGen/Utils.h" #include "polly/CodeGen/IRBuilder.h" #include "polly/ScopInfo.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/RegionInfo.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" usingnamespacellvm; // Alternative to llvm::SplitCriticalEdge. // // Creates a new block which branches to Succ. The edge to split is redirected // to the new block. // // The issue with llvm::SplitCriticalEdge is that it does nothing if the edge is // not critical. // The issue with llvm::SplitEdge is that it does not always create the middle // block, but reuses Prev/Succ if it can. We always want a new middle block. static BasicBlock *splitEdge(BasicBlock *Prev, BasicBlock *Succ, const char *Suffix, DominatorTree *DT, LoopInfo *LI, RegionInfo *RI) { … } std::pair<polly::BBPair, BranchInst *> polly::executeScopConditionally(Scop &S, Value *RTC, DominatorTree &DT, RegionInfo &RI, LoopInfo &LI) { … }