BasicBlock::iterator bit = BB->begin();
LoadInst *li = = dyn_cast(bit);
li->dump(); // %tmp6 = load i32* getelementptr inbounds (%struct.node* @Node, i32 0, i32 0), align 4, !dbg !59
li->getOperand(0)->dump(); // i32* getelementptr inbounds (%struct.node* @Node, i32 0, i32 0), align 4, !dbg !59
GetElementPtrInst *gep = dyn_cast(li->getOperand(0));
if (gep != NULL) {
std::cout << “gep not NULL” << std::endl;
}
The previous codes’ BB is a BasicBlock pointer, I want to get the string name Node. I want to use dyn_cast to cast
the value of li->getOperand(0) to a GetElementPtr pointer type, but it is likely can not casted by the dyn_cast operation.
The if statement never executed. How it can be implemented? I confused by the load instruction? Any advice would be
appreciate, thank you.