Skip to content

Commit e3c0558

Browse files
committed
Add OpenMP code generation to isl backend
This backend supports besides the classical code generation the upcoming SCEV based code generation (which the existing CLooG backend does not support robustly). OpenMP code generation in the isl backend benefits from our run-time alias checks such that the set of loops that can possibly be parallelized is a lot larger. The code was tested on LNT. We do not regress on builds without -polly-parallel. When using -polly-parallel most tests work flawlessly, but a few issues still remain and will be addressed in follow up commits. SCEV/non-SCEV codegen: - Compile time failure in ldecod and TimberWolfMC due a problem in our run-time alias check generation triggered by pointers that escape through the OpenMP subfunction (OpenMP specific). - Several execution time failures. Due to the larger set of loops that we now parallelize (compared to the classical code generation), we currently run into some timeouts in tests with a lot loops that have a low trip count and are slowed down by parallelizing them. SCEV only: - One existing failure in lencod due to llvm.org/PR21204 (not OpenMP specific) OpenMP code generation is the last feature that was only available in the CLooG backend. With the isl backend being the only one supporting features such as run-time alias checks and delinearization, we will soon switch to use the isl ast generator by the default and subsequently remove our dependency on CLooG. http://reviews.llvm.org/D5517 llvm-svn: 222088
1 parent 6d675f4 commit e3c0558

16 files changed

+1047
-11
lines changed

polly/include/polly/CodeGen/IslExprBuilder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
#include "polly/CodeGen/IRBuilder.h"
1616

17-
#include "isl/ast.h"
17+
#include "llvm/ADT/MapVector.h"
1818

19-
#include <map>
19+
#include "isl/ast.h"
2020

2121
namespace llvm {
2222
class SCEVExpander;
@@ -81,7 +81,7 @@ namespace polly {
8181
class IslExprBuilder {
8282
public:
8383
/// @brief A map from isl_ids to llvm::Values.
84-
typedef std::map<isl_id *, llvm::Value *> IDToValueTy;
84+
typedef llvm::MapVector<isl_id *, llvm::Value *> IDToValueTy;
8585

8686
/// @brief Construct an IslExprBuilder.
8787
///
@@ -125,7 +125,7 @@ class IslExprBuilder {
125125

126126
private:
127127
PollyIRBuilder &Builder;
128-
std::map<isl_id *, llvm::Value *> &IDToValue;
128+
IDToValueTy &IDToValue;
129129

130130
/// @brief A SCEVExpander to translate dimension sizes to llvm values.
131131
llvm::SCEVExpander &Expander;

polly/include/polly/Support/SCEVValidator.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,32 @@
1212
#ifndef POLLY_SCEV_VALIDATOR_H
1313
#define POLLY_SCEV_VALIDATOR_H
1414

15+
#include "llvm/ADT/SetVector.h"
1516
#include <vector>
1617

1718
namespace llvm {
1819
class Region;
1920
class SCEV;
2021
class ScalarEvolution;
2122
class Value;
23+
class Loop;
2224
}
2325

2426
namespace polly {
27+
/// @brief Find the loops referenced from a SCEV expression.
28+
///
29+
/// @param Expr The SCEV expression to scan for loops.
30+
/// @param Loops A vector into which the found loops are inserted.
31+
void findLoops(const llvm::SCEV *Expr,
32+
llvm::SetVector<const llvm::Loop *> &Loops);
33+
34+
/// @brief Find the values referenced by SCEVUnknowns in a given SCEV
35+
/// expression.
36+
///
37+
/// @param Expr The SCEV expression to scan for SCEVUnknowns.
38+
/// @param Expr A vector into which the found values are inserted.
39+
void findValues(const llvm::SCEV *Expr, llvm::SetVector<llvm::Value *> &Values);
40+
2541
/// Returns true when the SCEV contains references to instructions within the
2642
/// region.
2743
///

0 commit comments

Comments
 (0)