1*8ebb3eacSBjorn Pettersson; RUN: opt < %s -passes=globalopt -S | FileCheck %s 2cee313d2SEric Christopher 3cee313d2SEric Christopher; CHECK-NOT: test 4cee313d2SEric Christopher 5cee313d2SEric Christopherdeclare void @aa() 6cee313d2SEric Christopherdeclare void @bb() 7cee313d2SEric Christopher 8cee313d2SEric Christopher; Test that we can erase a function which has a blockaddress referring to it 9cee313d2SEric Christopher@test.x = internal unnamed_addr constant [3 x i8*] [i8* blockaddress(@test, %a), i8* blockaddress(@test, %b), i8* blockaddress(@test, %c)], align 16 10cee313d2SEric Christopherdefine internal void @test(i32 %n) nounwind noinline { 11cee313d2SEric Christopherentry: 12cee313d2SEric Christopher %idxprom = sext i32 %n to i64 13cee313d2SEric Christopher %arrayidx = getelementptr inbounds [3 x i8*], [3 x i8*]* @test.x, i64 0, i64 %idxprom 14cee313d2SEric Christopher %0 = load i8*, i8** %arrayidx, align 8 15cee313d2SEric Christopher indirectbr i8* %0, [label %a, label %b, label %c] 16cee313d2SEric Christopher 17cee313d2SEric Christophera: 18cee313d2SEric Christopher tail call void @aa() nounwind 19cee313d2SEric Christopher br label %b 20cee313d2SEric Christopher 21cee313d2SEric Christopherb: 22cee313d2SEric Christopher tail call void @bb() nounwind 23cee313d2SEric Christopher br label %c 24cee313d2SEric Christopher 25cee313d2SEric Christopherc: 26cee313d2SEric Christopher ret void 27cee313d2SEric Christopher} 28