Change the RegionSet type to a SetVector

This patch changes the RegionSet type used in ScopDetection from a
std::set to a llvm::SetVector. The reason for the change is to
ensure deterministic output when printing the result of the
analysis. We had a windows buildbot failure for the modified test
because the output was coming in a different order.

Only one test case needed to be modified for this change. We could
use CHECK-DAG directives instead of CHECK in the analysis test cases
because the actual order of scops does not matter, but I think that
change should be done in a separate patch that modifies all the
appliciable tests. I simply modified the test to reflect the
expected deterministic output.

Differential Revision: http://reviews.llvm.org/D5897


git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220423 91177308-0d34-0410-b5e6-96231b3b80d8
Use braces in multi-statement DEBUG() code [NFC]

By adding braces into the DEBUG statement we can make clang-format format code
such as:

  DEBUG(stmt1(); stmt2())

as multi-line code:

  DEBUG({
    stmt1();
    stmt2();
  });

This makes control-flow in debug statements easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220441 91177308-0d34-0410-b5e6-96231b3b80d8
Use stringFromIslObj instead of isl_..._dump to print to dbgs()

This makes sure we consistently use dbgs() when printing debug output.
Previously, the code just mixed calls to isl_*_dump() with printing to dbgs()
and was relying for both methods to interact in predictable ways (same output
stream, no unexpected reordering of outputs).

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220443 91177308-0d34-0410-b5e6-96231b3b80d8
Remove incorrect value description for -enable-polly-aligned

The description of the parameter value passed to -enable-polly-aligned did
not make any sense at all, but was just a leftover coming from when this option
was copied form -enable-polly-openmp. We just drop it as the option description
gives sufficient information already.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220445 91177308-0d34-0410-b5e6-96231b3b80d8
Fix typo

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220446 91177308-0d34-0410-b5e6-96231b3b80d8
Fix polly formatting after recent clang-format behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220711 91177308-0d34-0410-b5e6-96231b3b80d8
Fix typo

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220870 91177308-0d34-0410-b5e6-96231b3b80d8
Delete some unnecessary code

Originally we have needed this code to map the isl_id of an array to its base
pointer. However, as now the isl_id contains a reference to the array itself we
obtain the base pointer from this isl_id and we do not need to add this
information to the IDToValue map.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@220876 91177308-0d34-0410-b5e6-96231b3b80d8
[Refactor][NFC] Map basic blocks to SCoP statements.

  This will simplify the construction of domains and the modeling of
  PHI's.



git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221015 91177308-0d34-0410-b5e6-96231b3b80d8
[Refactor][NFC] Remove unused argument.



git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221016 91177308-0d34-0410-b5e6-96231b3b80d8
Remove the MaxLoopDepth attribute from the TempScop class

  Now MaxLoopDepth only lives in Scops not in TempScops anymore.
  This is the first part of a series of changes to make TempScops
  obsolete.

Differential Revision: http://reviews.llvm.org/D6069


git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221026 91177308-0d34-0410-b5e6-96231b3b80d8
Remove the LoopBounds from the TempScop class.

  We will use ScalarEvolution in the ScopInfo.cpp to get the loop trip
  count, not cache it in the TempScop object.

Differential Revision: http://reviews.llvm.org/D6070


git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221035 91177308-0d34-0410-b5e6-96231b3b80d8
[FIX] Move the statistic code to fix the build.


git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221038 91177308-0d34-0410-b5e6-96231b3b80d8
Temporary disable formatting error

This should silence the buildbots until we understand if the clang-format
changes in r221125 have been intentional. See reply on cfe-commits for details.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221159 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Temporary disable formatting error"

This reverts commit r221159, as clang-format is again back to its old behaviour
and we do not cause any buildbot error messages any more.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221189 91177308-0d34-0410-b5e6-96231b3b80d8
Use argument type directly from fflush if available in translation unit

When our RuntimeDebugBuilder calles fflush(NULL) to flush all output streams, it
is important that the types we use in the call match the ones used in a
declaration of fflush possible already available in the translation unit.

As we just pass on a NULL pointer, the type of the pointer value does not really
matter. However, as LLVM complains in case of mismatched types, we make sure
to create a NULL pointer of identical type.

No test case, as RuntimeDebugBuilder is not permanently used in Polly. Calls to
it are until now only used to add informative output during debugging sessions.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221251 91177308-0d34-0410-b5e6-96231b3b80d8
BlockGenerator: inline lookupAvailableValue into getValue [NFC]

There was no good reason why this code was split accross two functions.

In subsequent changes we will change the order in which values are looked up.
Doing so would make the split into two functions even more arbitrary.

We also slightly improve the documentation.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221388 91177308-0d34-0410-b5e6-96231b3b80d8
BlockGenerator: Recompute values from SCEV before handing back the original values

This patch moves the SCEV based (re)generation of values before the checking for
scop-constant terms. It enables us to provide SCEV based replacements, which
are necessary to correctly generate OpenMP subfunctions when using the SCEV
based code generation.

When recomputing a new value for a value used in the code of the original scop,
we previously directly returned the same original value for all scop-constant
expressions without even trying to regenerate these values using our SCEV
expression. This is correct when the newly generated code remains fully in the
same function, however in case we want to outline parts of the newly generated
scop into subfunctions, this approach means we do not have any opportunity to
update these values in the SCEV based code generation. (In the non-SCEV based
code generation, we can provide such updates through the GlobalMap). To ensure
we have this opportunity, we first try to regenerate scalar terms with our SCEV
builder and will only return scop-constant expressions if SCEV based code
generation was not possible.

This change should not affect the results of the existing code generation
passes. It only impacts the upcoming OpenMP based code generation.

This commit also adds a test case. This test case passes before and after this
commit. It was added to ensure test coverage for the changed code.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221393 91177308-0d34-0410-b5e6-96231b3b80d8
Extract SCEV generation into subfunction

This makes the code more readable and will be reused in subsequent OpenMP
patches.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221418 91177308-0d34-0410-b5e6-96231b3b80d8
Explicitly annotate loops we want to run thread-parallel

We introduces a new flag -polly-parallel and use it to annotate the for-nodes in
the isl ast that we want to execute thread parallel (e.g., using OpenMP). We
previously already emmitted openmp annotations, but we did this for various
kinds of parallel loops, including some which we can not run in parallel.

With this patch we now have three annotations:

  1) #pragma known-parallel [reduction]
  2) #pragma omp for
  3) #pragma simd

meaning:

  1) loop has no loop carried dependences
  2) loop will be executed thread-parallel
  3) loop can possibly be vectorized

This patch introduces 1) and reduces the use of 2) to only the cases where we
will actually generate thread parallel code.

It is in preparation of openmp code generation in our isl backend.

Legacy:

- We also have a command line option -enable-polly-openmp. This option controls
  the OpenMP code generation in CLooG. It will become an alias of
  -polly-parallel after the CLooG code generation has been dropped.

http://reviews.llvm.org/D6142

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@221479 91177308-0d34-0410-b5e6-96231b3b80d8