[polly] r220423 - Change the RegionSet type to a SetVector
David Peixotto
dpeixott at codeaurora.org
Wed Oct 22 13:39:07 PDT 2014
Author: dpeixott
Date: Wed Oct 22 15:39:07 2014
New Revision: 220423
URL: http://llvm.org/viewvc/llvm-project?rev=220423&view=rev
Log:
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
Modified:
polly/trunk/include/polly/ScopDetection.h
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/test/ScopInfo/multi-scop.ll
Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=220423&r1=220422&r2=220423&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Wed Oct 22 15:39:07 2014
@@ -48,6 +48,7 @@
#define POLLY_SCOP_DETECTION_H
#include "llvm/Pass.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/AliasSetTracker.h"
#include "polly/ScopDetectionDiagnostic.h"
@@ -118,6 +119,10 @@ extern llvm::StringRef PollySkipFnAttr;
/// @brief Pass to detect the maximal static control parts (Scops) of a
/// function.
class ScopDetection : public FunctionPass {
+public:
+ typedef SetVector<const Region *> RegionSet;
+
+private:
//===--------------------------------------------------------------------===//
ScopDetection(const ScopDetection &) LLVM_DELETED_FUNCTION;
const ScopDetection &operator=(const ScopDetection &) LLVM_DELETED_FUNCTION;
@@ -155,7 +160,6 @@ class ScopDetection : public FunctionPas
};
// Remember the valid regions
- typedef std::set<const Region *> RegionSet;
RegionSet ValidRegions;
// Remember a list of errors for every region.
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=220423&r1=220422&r2=220423&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Wed Oct 22 15:39:07 2014
@@ -691,13 +691,13 @@ static bool regionWithoutLoops(Region &R
// but do not recurse further if the first child has been found.
//
// Return the number of regions erased from Regs.
-static unsigned eraseAllChildren(std::set<const Region *> &Regs,
+static unsigned eraseAllChildren(ScopDetection::RegionSet &Regs,
const Region &R) {
unsigned Count = 0;
for (auto &SubRegion : R) {
- if (Regs.find(SubRegion.get()) != Regs.end()) {
+ if (Regs.count(SubRegion.get())) {
++Count;
- Regs.erase(SubRegion.get());
+ Regs.remove(SubRegion.get());
} else {
Count += eraseAllChildren(Regs, *SubRegion);
}
@@ -740,7 +740,7 @@ void ScopDetection::findScops(Region &R)
// Skip invalid regions. Regions may become invalid, if they are element of
// an already expanded region.
- if (ValidRegions.find(CurrentRegion) == ValidRegions.end())
+ if (!ValidRegions.count(CurrentRegion))
continue;
Region *ExpandedR = expandRegion(*CurrentRegion);
@@ -750,7 +750,7 @@ void ScopDetection::findScops(Region &R)
R.addSubRegion(ExpandedR, true);
ValidRegions.insert(ExpandedR);
- ValidRegions.erase(CurrentRegion);
+ ValidRegions.remove(CurrentRegion);
// Erase all (direct and indirect) children of ExpandedR from the valid
// regions and update the number of valid regions.
Modified: polly/trunk/test/ScopInfo/multi-scop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/multi-scop.ll?rev=220423&r1=220422&r2=220423&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/multi-scop.ll (original)
+++ polly/trunk/test/ScopInfo/multi-scop.ll Wed Oct 22 15:39:07 2014
@@ -33,6 +33,6 @@ for.end170:
ret void
}
-; CHECK: Valid Region for Scop: for.body81 => for.end170
; CHECK: Valid Region for Scop: entry.split => for.end
+; CHECK: Valid Region for Scop: for.body81 => for.end170
More information about the llvm-commits
mailing list