[polly] r217665 - [Polly] Move MAY/MUST write property to IRAccess
Johannes Doerfert
doerfert at cs.uni-saarland.de
Fri Sep 12 04:00:50 PDT 2014
Author: jdoerfert
Date: Fri Sep 12 06:00:49 2014
New Revision: 217665
URL: http://llvm.org/viewvc/llvm-project?rev=217665&view=rev
Log:
[Polly] Move MAY/MUST write property to IRAccess
Differential Revision: http://reviews.llvm.org/D5223
Modified:
polly/trunk/include/polly/TempScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Analysis/TempScopInfo.cpp
Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=217665&r1=217664&r2=217665&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Fri Sep 12 06:00:49 2014
@@ -42,7 +42,8 @@ public:
// The type of the scev affine function
enum TypeKind {
READ = 0x1,
- WRITE = 0x2,
+ MUST_WRITE = 0x2,
+ MAY_WRITE = 0x3,
};
private:
@@ -72,7 +73,9 @@ public:
bool isRead() const { return Type == READ; }
- bool isWrite() const { return Type == WRITE; }
+ bool isWrite() const { return Type == MUST_WRITE; }
+
+ bool isMayWrite() const { return Type == MAY_WRITE; }
bool isScalar() const { return Subscripts.size() == 0; }
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=217665&r1=217664&r2=217665&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Sep 12 06:00:49 2014
@@ -330,6 +330,18 @@ MemoryAccess::~MemoryAccess() {
isl_map_free(newAccessRelation);
}
+static MemoryAccess::AccessType getMemoryAccessType(const IRAccess &Access) {
+ switch (Access.getType()) {
+ case IRAccess::READ:
+ return MemoryAccess::READ;
+ case IRAccess::MUST_WRITE:
+ return MemoryAccess::MUST_WRITE;
+ case IRAccess::MAY_WRITE:
+ return MemoryAccess::MAY_WRITE;
+ }
+ llvm_unreachable("Unknown IRAccess type!");
+}
+
isl_id *MemoryAccess::getArrayId() const {
return isl_map_get_tuple_id(AccessRelation, isl_dim_out);
}
@@ -416,7 +428,8 @@ void MemoryAccess::assumeNoOutOfBound(co
MemoryAccess::MemoryAccess(const IRAccess &Access, Instruction *AccInst,
ScopStmt *Statement)
- : Statement(Statement), Inst(AccInst), newAccessRelation(nullptr) {
+ : Type(getMemoryAccessType(Access)), Statement(Statement), Inst(AccInst),
+ newAccessRelation(nullptr) {
isl_ctx *Ctx = Statement->getIslCtx();
BaseAddr = Access.getBase();
@@ -431,12 +444,9 @@ MemoryAccess::MemoryAccess(const IRAcces
AccessRelation = isl_map_from_basic_map(createBasicAccessMap(Statement));
AccessRelation =
isl_map_set_tuple_id(AccessRelation, isl_dim_out, BaseAddrId);
- Type = Access.isRead() ? READ : MAY_WRITE;
return;
}
- Type = Access.isRead() ? READ : MUST_WRITE;
-
isl_space *Space = isl_space_alloc(Ctx, 0, Statement->getNumIterators(), 0);
AccessRelation = isl_map_universe(Space);
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=217665&r1=217664&r2=217665&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Fri Sep 12 06:00:49 2014
@@ -41,9 +41,11 @@ using namespace polly;
void IRAccess::print(raw_ostream &OS) const {
if (isRead())
OS << "Read ";
- else
+ else {
+ if (isMayWrite())
+ OS << "May";
OS << "Write ";
-
+ }
OS << BaseAddress->getName() << '[' << *Offset << "]\n";
}
@@ -160,7 +162,7 @@ IRAccess TempScopInfo::buildIRAccess(Ins
StoreInst *Store = cast<StoreInst>(Inst);
SizeType = Store->getValueOperand()->getType();
Size = TD->getTypeStoreSize(SizeType);
- Type = IRAccess::WRITE;
+ Type = IRAccess::MUST_WRITE;
}
const SCEV *AccessFunction = SE->getSCEVAtScope(getPointerOperand(*Inst), L);
@@ -178,6 +180,9 @@ IRAccess TempScopInfo::buildIRAccess(Ins
bool IsAffine = isAffineExpr(R, AccessFunction, *SE, BasePointer->getValue());
Subscripts.push_back(AccessFunction);
+ if (!IsAffine && Type == IRAccess::MUST_WRITE)
+ Type = IRAccess::MAY_WRITE;
+
Sizes.push_back(SE->getConstant(ZeroOffset->getType(), Size));
return IRAccess(Type, BasePointer->getValue(), AccessFunction, Size, IsAffine,
Subscripts, Sizes);
@@ -196,7 +201,7 @@ void TempScopInfo::buildAccessFunctions(
// If the Instruction is used outside the statement, we need to build the
// write access.
SmallVector<const SCEV *, 4> Subscripts, Sizes;
- IRAccess ScalarAccess(IRAccess::WRITE, Inst, ZeroOffset, 1, true,
+ IRAccess ScalarAccess(IRAccess::MUST_WRITE, Inst, ZeroOffset, 1, true,
Subscripts, Sizes);
Functions.push_back(std::make_pair(ScalarAccess, Inst));
}
More information about the llvm-commits
mailing list