SVF
SVF copied to clipboard
Does calling andersen analyze modify the .bc file?
I have SVF as a lib in order to call its andersen analysis. I saved all the LLVM Inst objects in a map after calling the pointer analysis, when I finish the pointer analysis and want to traverse to find the information based on the LLVM Inst object there is a situation where I can't find it, and when I print the Inst it shows an instruction that is not in my IR.
I print the function that this instruction is in. It is a different function than the one in my bc.
The original function was as follows
define linkonce_odr dso_local void @_ZN4test1AC2Ev(%"class.test::A"* %0) unnamed_addr #0 comdat align 2 !dbg !64 {
%2 = alloca %"class.test::A"*, align 8
store %"class.test::A"* %0, %"class.test::A"** %2, align 8
call void @llvm.dbg.declare(metadata %"class.test::A"** %2, metadata !74, metadata !DIExpression()), !dbg !76
%3 = load %"class.test::A"*, %"class.test::A"** %2, align 8
%4 = bitcast %"class.test::A"* %3 to %"class.test::base"*, !dbg !77
call void @_ZN4test4baseC2Ev(%"class.test::base"* %4), !dbg !78
%5 = bitcast %"class.test::A"* %3 to i32 (...)***, !dbg !77
store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTVN4test1AE, i32 0, inrange i32 0, i32 2) to i32 (...)**), i32 (...)*** %5, align 8, !dbg !77
ret void, !dbg !79
}
Function after execution of andersen analysis
define linkonce_odr dso_local void @_ZN4test1AC2Ev(%"class.test::A"* %0) unnamed_addr #0 comdat align 2 !dbg !64 {
%2 = alloca %"class.test::A"*, align 8
store %"class.test::A"* %0, %"class.test::A"** %2, align 8
call void @llvm.dbg.declare(metadata %"class.test::A"** %2, metadata !74, metadata !DIExpression()), !dbg !76
%3 = load %"class.test::A"*, %"class.test::A"** %2, align 8
%4 = bitcast %"class.test::A"* %3 to %"class.test::base"*, !dbg !77
call void @_ZN4test4baseC2Ev(%"class.test::base"* %4), !dbg !78
%5 = bitcast %"class.test::A"* %3 to i32 (...)***, !dbg !77
%6 = getelementptr { [4 x i8*] }, { [4 x i8*] }* @_ZTVN4test1AE, i32 0, i32 0, i32 2
%7 = bitcast i8** %6 to i32 (...)**
store i32 (...)** %7, i32 (...)*** %5, align 8, !dbg !77
ret void, !dbg !79
}
Yes, will modify the IR. See here https://github.com/SVF-tools/SVF/blob/master/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h