brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 1384b1c Raw
50 lines · plain
1; REQUIRES: x86-registered-target2 3; Test CFI through the thin link and backend.4 5; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t.o %s6 7; RUN: llvm-lto2 run -save-temps %t.o \8; RUN:   -o %t3 \9; RUN:   -r=%t.o,test,px \10; RUN:   -r=%t.o,_ZTV1B, \11; RUN:   -r=%t.o,_ZN1B1fEi, \12; RUN:   -r=%t.o,_ZTV1B,px13; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR14 15target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"16target triple = "x86_64-grtev4-linux-gnu"17 18%struct.B = type { %struct.A }19%struct.A = type { ptr }20 21@_ZTV1B = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !022 23; CHECK-IR-LABEL: define void @test24define void @test(ptr %b) {25entry:26  ; Ensure that traps are conditional. Invalid TYPE_ID can cause27  ; unconditional traps.28  ; CHECK-IR: br i1 {{.*}}, label %trap29  %vtable2 = load ptr, ptr %b30  %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A")31  br i1 %0, label %cont, label %trap32 33trap:34  tail call void @llvm.trap()35  unreachable36 37cont:38  ; CHECK-IR-LABEL: ret void39  ret void40}41; CHECK-IR-LABEL: }42 43declare i1 @llvm.type.test(ptr, metadata)44declare void @llvm.trap()45 46declare i32 @_ZN1B1fEi(ptr %this, i32 %a)47 48!0 = !{i64 16, !"_ZTS1A"}49!1 = !{i64 16, !"_ZTS1B"}50