llvm/test/Transforms/PGOProfile/unreachable_bb.ll
Rong Xu e72670cb54 [PGO] Fix PGO use ICE when there are unreachable BBs
For -O0 there might be unreachable BBs, which breaks the assumption that all the
BBs have an auxiliary data structure.  In this patch, we add another interface
called findBBInfo() so that a nullptr can be returned for the unreachable BBs
(and the callers can ignore those BBs).

This fixes the bug reported
https://llvm.org/bugs/show_bug.cgi?id=31209

Differential Revision: https://reviews.llvm.org/D27280



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288528 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 19:10:29 +00:00

24 lines
668 B
LLVM

; RUN: llvm-profdata merge %S/Inputs/unreachable_bb.proftext -o %t.profdata
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @foo() {
entry:
call void @bar()
unreachable
return:
ret void
}
declare void @bar()
;USE: !0 = !{i32 1, !"ProfileSummary", !1}
;USE: !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
;USE: !2 = !{!"ProfileFormat", !"InstrProf"}
;USE: !3 = !{!"TotalCount", i64 0}