1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/Bitcode/branch-weight.ll
Steven Wu 7e7fa937e3 [Bitcode] Drop invalid branch_weight in BitcodeReader
Summary:
If bitcode reader gets an invalid branch weight, drop that from the
inputs. This allows us to read the broken modules we generated before
the verifier was able to catch this.

rdar://64870641

Reviewers: yrouban, t.p.northover, dexonsmith, arphaman, aprantl

Reviewed By: aprantl

Subscribers: aprantl, hiraditya, jkorous, ributzka, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83699
2020-07-23 09:07:15 -07:00

20 lines
573 B
LLVM

;; Test strip branch_weight if operand number doesn't match.
;; Input bitcode is generated from:
;; define void @test(i1 %0) {
;; br i1 %0, label %2, label %3, !prof !0
;; 2:
;; br i1 %0, label %4, label %3, !prof !1
;; 3:
;; unreachable
;; 4:
;; ret void
;; }
;;!0 = !{!"branch_weights", i32 1, i32 2}
;;!1 = !{!"branch_weights", i32 1, i32 2, i32 3}
; RUN: llvm-dis %S/Inputs/branch-weight.bc -o - | FileCheck %s
; CHECK: !prof !0
; CHECK: !0 = !{!"branch_weights", i32 1, i32 2}
; CHECK-NOT: !prof !1
; CHECK-NOT: !1 = !{!"branch_weights", i32 1, i32 2, i32 3}