[llvm-commits] [llvm] r85704 - /llvm/trunk/lib/Transforms/Utils/Local.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 1 10:13:57 PST 2009
On Nov 1, 2009, at 2:09 AM, Duncan Sands wrote:
> 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.
Right.
> Or is it
> harmless since you will delete it later anyway?
Right. The code is ok, because in this situation the block could not
be in the successor list.
-Chris
More information about the llvm-commits
mailing list