[llvm-commits] [llvm] r85704 - /llvm/trunk/lib/Transforms/Utils/Local.cpp
Duncan Sands
baldrick at free.fr
Sun Nov 1 02:09:03 PST 2009
Hi Chris,
> + if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(T)) {
> + // indirectbr blockaddress(@F, @BB) -> br label @BB
> + if (BlockAddress *BA =
> + dyn_cast<BlockAddress>(IBI->getAddress()->stripPointerCasts())) {
> + BasicBlock *TheOnlyDest = BA->getBasicBlock();
> + // Insert the new branch.
> + BranchInst::Create(TheOnlyDest, IBI);
won't this crash if the block address is for another function? This could occur
due to (invalid) code that takes a block address for a callee, and indirect
jumps to it in a caller, if the callee is inlined into the caller. Or is it
harmless since you will delete it later anyway?
Ciao,
Duncan.
More information about the llvm-commits
mailing list