initialize bits_program_pointer before unroll
MODIFY
ir/memory.cpp
ir/memory.cpp
@@ -1915,6 +1915,8 @@ void Memory::free(const expr &ptr, bool unconstrained) {
}
unsigned Memory::getStoreByteSize(const Type &ty) {
+ assert(bits_program_pointer != 0);
+
if (ty.isPtrType())
return divide_up(bits_program_pointer, 8);

MODIFY
tools/transform.cpp
tools/transform.cpp
@@ -597,10 +597,6 @@ static void calculateAndInitConstants(Transform &t) {
num_globals_src = globals_src.size();
unsigned num_globals = num_globals_src;
- // FIXME: varies among address spaces
- bits_program_pointer = t.src.bitsPointers();
- assert(bits_program_pointer > 0 && bits_program_pointer <= 64);
- assert(bits_program_pointer == t.tgt.bitsPointers());
heap_block_alignment = 8;
num_consts_src = 0;
@@ -1194,6 +1190,12 @@ void Transform::preprocess() {
} while (changed);
}
+ // bits_program_pointer is used by unroll. Initialize it in advance
+ // FIXME: varies among address spaces
+ bits_program_pointer = src.bitsPointers();
+ assert(bits_program_pointer > 0 && bits_program_pointer <= 64);
+ assert(bits_program_pointer == tgt.bitsPointers());
+
src.unroll(config::src_unroll_cnt);
tgt.unroll(config::tgt_unroll_cnt);
}

initialize bits_program_pointer before unroll (#563)