##Key points:-
(1)Before doing any modification on the instruction. Collect first in the worklist.
(2)perform the modification on the worklist.
(3)you cannot do the modification while using the iterator.
1、load一个地址空间为空的memory
%.sroa.3.0.copyload = load volatile i16, i16* bitcast (i8* getelementptr inbounds (i8, i8* bitcast (%struct.str* @global to i8*), i64 14) to i16*), align 2
store volatile i16 %.sroa.3.0.copyload, i16* %.sroa.3, align 2
暂时解决办法:将load语句删掉,调用其地方替换为value 0;
2、memcpy的问题总结:
(1)
%.sroa.523.0.sroa_idx = getelementptr inbounds [3 x i8], [3 x i8]* %.sroa.523, i64 0, i64 0
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %.sroa.523.0.sroa_idx, i8* getelementptr inbounds (i8, i8* bitcast (%struct.str* @global to i8*), i64 17), i64 3, i32 1, i1 true)
(2)
%global = alloca %struct.str, align 8
%1 = bitcast %struct.str* %global to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast (%struct.str* @global to i8*), i64 56, i32 8, i1 false) #3
br label %2
(3)
%1 = alloca %struct.str, align 8
%2 = getelementptr inbounds %struct.str, %struct.str* %1, i64 0, i32 0, i32 0
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull %2, i8* getelementptr inbounds (%struct.str, %struct.str* @global, i64 0, i32 0, i32 0), i64 44, i32 4, i1 false)
GlobalVarGetelementptr()
无法将处理函数移植到replaceGlobalvarGetelementprt()