deadfunction.ll 722 B

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