Problem Statement
Hi folks. I tried to extract the target address of a store instruction:
store i32 0, ptr inttoptr (i32 268697856 to ptr), align 256, !dbg !4216, !tbaa !4166
To this end, I wrote a FunctionPass which analyzed the code at the LTO stage. Particularly, I casted the pointer operand of the store instruction into IntToPtrInst
and dumped the instruction:
if (IntToPtrInst *int_to_ptr_inst = dyn_cast<IntToPtrInst>(store_inst->getPointerOperand())) {
int_to_ptr_inst->dump();
}
However, the pointer operand of this store instruction cannot be casted into IntToPtrInst
and the dumped nothing.
I guess the pointer operand is not IntToPtrInst
. Can anyone tell me how to extract correctly? Thank you in advance!
Settings
- LLVM version: 15.0.1