yonghong-song added a comment. In D100567#2697412 <https://reviews.llvm.org/D100567#2697412>, @dblaikie wrote:
> In D100567#2696095 <https://reviews.llvm.org/D100567#2696095>, @yonghong-song > wrote: > >> Sorry, I know what is the segfault now after some debugging. It is because >> `auto *Fn = dyn_cast<llvm::Function>(LV.getPointer(*this));` is a NULL >> pointer after there is a definition before this. > > Hmm, not sure I follow - is `LV.getPointer(*this)` returning null, or is the > dyn_cast returning null because the thing isn't an llvm::Function? If it's > not a function, what is it? The patched code is `LV.getPointer(*this)->dump();`, so `LV.getPointer(*this)` is not return NULL. It returns a valid object. If the function already has a definition, it returns a llvm:ConstantExpr, and if you call the `LV.getPointer(*this)->dump()`, and it prints `i32 (...)* bitcast (i32 ()* @foo to i32 (...)*)`. I didn't try subclasses of "llvm:ConstantExpr". I think you may have a better idea what the real object could be? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100567/new/ https://reviews.llvm.org/D100567 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits