ScopInfo: Only give away a copy of the access relation.
Also take the chance and rename access functions to access relations. This is
because we do not only allow plain functions to describe an access, but we
can have any access relation that can be described with linear constraints.
llvm-svn: 141257
diff --git a/polly/lib/CodeGeneration.cpp b/polly/lib/CodeGeneration.cpp
index 5e155aa..e339706 100644
--- a/polly/lib/CodeGeneration.cpp
+++ b/polly/lib/CodeGeneration.cpp
@@ -358,22 +358,26 @@
/// @brief Generate the operand address
Value *generateLocationAccessed(const Instruction *Inst,
const Value *pointer, ValueMapT &BBMap ) {
- MemoryAccess &access = statement.getAccessFor(Inst);
- isl_map *currentAccessRelation = access.getAccessFunction();
- isl_map *newAccessRelation = access.getNewAccessFunction();
+ MemoryAccess &Access = statement.getAccessFor(Inst);
+ isl_map *CurrentAccessRelation = Access.getAccessRelation();
+ isl_map *NewAccessRelation = Access.getNewAccessRelation();
- assert(isl_map_has_equal_space(currentAccessRelation, newAccessRelation)
+ assert(isl_map_has_equal_space(CurrentAccessRelation, NewAccessRelation)
&& "Current and new access function use different spaces");
- if (!newAccessRelation) {
- Value *newPointer = getOperand(pointer, BBMap);
- return newPointer;
+ Value *NewPointer;
+
+ if (!NewAccessRelation) {
+ NewPointer = getOperand(pointer, BBMap);
+ } else {
+ Value *BaseAddr = const_cast<Value*>(Access.getBaseAddr());
+ NewPointer = getNewAccessOperand(NewAccessRelation, BaseAddr, pointer,
+ BBMap);
}
- Value *baseAddr = const_cast<Value*>(access.getBaseAddr());
- Value *newPointer = getNewAccessOperand(newAccessRelation, baseAddr,
- pointer, BBMap);
- return newPointer;
+ isl_map_free(CurrentAccessRelation);
+ isl_map_free(NewAccessRelation);
+ return NewPointer;
}
Value *generateScalarLoad(const LoadInst *load, ValueMapT &BBMap) {