Add memory's undef vars when calling fn with reads_memory
MODIFY
ir/state.cpp
ir/state.cpp
@@ -241,6 +241,11 @@ State::addFnCall(const string &name, vector<StateValue> &&inputs,
return vector<StateValue>(out_types.size());
}
+ if (reads_memory) {
+ auto &uvs = memory.getUndefVars();
+ undef_vars.insert(uvs.begin(), uvs.end());
+ }
+
// TODO: this doesn't need to compare the full memory, just a subset of fields
auto call_data_pair
= fn_call_data[name].try_emplace({ move(inputs), move(ptr_inputs),

RENAME
tests/alive-tv/br-undef.srctgt.ll
tests/alive-tv/undef/br-undef.srctgt.ll
RENAME
tests/alive-tv/br-undef2.srctgt.ll
tests/alive-tv/undef/br-undef2.srctgt.ll
RENAME
tests/alive-tv/br-undef3.srctgt.ll
tests/alive-tv/undef/br-undef3.srctgt.ll
ADD
tests/alive-tv/undef/fncall-readmem.srctgt.ll
+@x = global i32 0
+declare void @g() noreturn
+
+define void @src(i32 %v) {
+ store i32 %v, i32* @x
+ call void @g()
+ unreachable
+}
+
+; identity
+define void @tgt(i32 %v) {
+ store i32 %v, i32* @x
+ call void @g()
+ unreachable
+}

Add memory's undef vars when calling fn with reads_memory (#423)