[polly] r303039 - [Simplify] Fix r302986 that introduced non-inferrable templates.
Siddharth Bhat via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 01:18:52 PDT 2017
Author: bollu
Date: Mon May 15 03:18:51 2017
New Revision: 303039
URL: http://llvm.org/viewvc/llvm-project?rev=303039&view=rev
Log:
[Simplify] Fix r302986 that introduced non-inferrable templates.
- auto + decltype + template use was not inferrable in
`Transform/Simplify.cpp accessesInOrder`.
- changed code to explicitly construct required vector instead of using
higher order iterator helpers.
- Failing compiler spec:
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Modified:
polly/trunk/lib/Transform/Simplify.cpp
Modified: polly/trunk/lib/Transform/Simplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Simplify.cpp?rev=303039&r1=303038&r2=303039&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Simplify.cpp (original)
+++ polly/trunk/lib/Transform/Simplify.cpp Mon May 15 03:18:51 2017
@@ -48,7 +48,7 @@ static bool isImplicitWrite(MemoryAccess
return MA->isWrite() && MA->isOriginalScalarKind();
}
-/// Return an iterator range that iterates over MemoryAccesses in the order in
+/// Return a vector that contains MemoryAccesses in the order in
/// which they are executed.
///
/// The order is:
@@ -62,15 +62,23 @@ static bool isImplicitWrite(MemoryAccess
/// - Implicit writes (BlockGenerator::generateScalarStores)
/// The order in which implicit writes are executed relative to each other is
/// undefined.
-static auto accessesInOrder(ScopStmt *Stmt) -> decltype(concat<MemoryAccess *>(
- make_filter_range(make_range(Stmt->begin(), Stmt->end()), isImplicitRead),
- make_filter_range(make_range(Stmt->begin(), Stmt->end()), isExplicitAccess),
- make_filter_range(make_range(Stmt->begin(), Stmt->end()),
- isImplicitWrite))) {
- auto AllRange = make_range(Stmt->begin(), Stmt->end());
- return concat<MemoryAccess *>(make_filter_range(AllRange, isImplicitRead),
- make_filter_range(AllRange, isExplicitAccess),
- make_filter_range(AllRange, isImplicitWrite));
+static SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt) {
+
+ SmallVector<MemoryAccess *, 32> Accesses;
+
+ for (MemoryAccess *MemAcc : Stmt)
+ if (isImplicitRead(MemAcc))
+ Accesses.push_back(MemAcc);
+
+ for (MemoryAccess *MemAcc : Stmt)
+ if (isExplicitAccess(MemAcc))
+ Accesses.push_back(MemAcc);
+
+ for (MemoryAccess *MemAcc : Stmt)
+ if (isImplicitWrite(MemAcc))
+ Accesses.push_back(MemAcc);
+
+ return Accesses;
}
class Simplify : public ScopPass {
@@ -175,9 +183,7 @@ private:
isl::union_map WillBeOverwritten =
isl::union_map::empty(give(S->getParamSpace()));
- auto AccRange = accessesInOrder(&Stmt);
- SmallVector<MemoryAccess *, 32> Accesses{AccRange.begin(),
- AccRange.end()};
+ SmallVector<MemoryAccess *, 32> Accesses(getAccessesInOrder(Stmt));
// Iterate in reverse order, so the overwrite comes before the write that
// is to be removed.
More information about the llvm-commits
mailing list