llvm.org GIT mirror llvm / 6536223
[Local] Zap blockaddress without users in ConstantFoldTerminator. If the blockaddress is not destoryed, the destination block will still be marked as having its address taken, limiting further transformations. I think there are other places where the dead blockaddress constants are kept around, I'll look into that as follow up. Reviewers: craig.topper, brzycki, davide Reviewed By: brzycki, davide Differential Revision: https://reviews.llvm.org/D64936 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366633 91177308-0d34-0410-b5e6-96231b3b80d8 Florian Hahn a month ago
2 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
323323 Value *Address = IBI->getAddress();
324324 IBI->eraseFromParent();
325325 if (DeleteDeadConditions)
326 // Delete pointer cast instructions.
326327 RecursivelyDeleteTriviallyDeadInstructions(Address, TLI);
329 // Also zap the blockaddress constant if there are no users remaining,
330 // otherwise the destination is still marked as having its address taken.
331 if (BA->use_empty())
332 BA->destroyConstant();
328334 // If we didn't find our destination in the IBI successor list, then we
329335 // have undefined behavior. Replace the unconditional branch with an
3636 entry:
3737 ; CHECK-LABEL: @test_indirectbr(
3838 ; CHECK-NEXT: entry:
39 ; Ideally this should now check:
40 ; CHK-NEXT: ret void
41 ; But that doesn't happen yet. Instead:
42 ; CHECK-NEXT: br label %L1
39 ; CHECK-NEXT: ret void
4441 %label = bitcast i8* blockaddress(@test_indirectbr, %L1) to i8*
4542 indirectbr i8* %label, [label %L1, label %L2]