make fn call range empty if function never reads memory
MODIFY
ir/state.cpp
ir/state.cpp
@@ -693,8 +693,10 @@ State::addFnCall(const string &name, vector<StateValue> &&inputs,
if (isSource()) {
auto &calls_fn = fn_call_data[name];
auto call_data_pair
- = calls_fn.try_emplace({ move(inputs), move(ptr_inputs),
- analysis.ranges_fn_calls,
+ = calls_fn.try_emplace(
+ { move(inputs), move(ptr_inputs),
+ reads_memory ? analysis.ranges_fn_calls
+ : State::ValueAnalysis::FnCallRanges(),
reads_memory ? memory : Memory(*this),
reads_memory, argmemonly });
auto &I = call_data_pair.first;

ADD
tests/alive-tv/calls/readnone-duplicated.srctgt.ll
+declare void @g()
+
+define void @src() {
+ %call = call i32* @__errno_location()
+ call void @g()
+ %call2 = call i32* @__errno_location()
+ store i32 0, i32* %call2, align 4
+ ret void
+}
+
+define void @tgt() {
+ %call = call i32* @__errno_location()
+ call void @g()
+ store i32 0, i32* %call, align 4
+ ret void
+}
+
+declare i32* @__errno_location() readnone

make fn call range empty if function never reads memory (#551)