A LLVM IR transformation pass to mark and insert check on getelementptr
instrustions.
the pass has to be running on EP_ModuleOptimizerEarly
, otherwise(no mark, early_as_possible
and after_optimize
) will cause a random kernel corruption.
2009 make CC=clang-12 O=out-all-inst/ -j16 "KCFLAGS=-Xclang -load -Xclang /home/wangzc/Desktop/experiment/rationale-getelementptr-replace/transform/libTransPass.so"
2010 sudo make CC=clang-12 O=out-all-inst/ -j16 "KCFLAGS=-Xclang -load -Xclang /home/wangzc/Desktop/experiment/rationale-getelementptr-replace/transform/libTransPass.so" modules_install
2011 sudo make CC=clang-12 O=out-all-inst/ -j16 "KCFLAGS=-Xclang -load -Xclang /home/wangzc/Desktop/experiment/rationale-getelementptr-replace/transform/libTransPass.so" install
%2 = alloca %struct.s*, align 8
%4 = load %struct.s*, %struct.s** %2, align 8
%5 = getelementptr inbounds %struct.s, %struct.s* %4, i32 0, i32 0
store i64 2, i64* %5, align 8
st->a = 2;