brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 542c1e8 Raw
56 lines · plain
1; REQUIRES: x86-registered-target2 3; Test devirtualization requiring promotion of local targets, where the4; promotion is required by one devirtualization and needs to be updated5; for a second devirtualization in the defining module as a post-pass6; update.7 8; Generate unsplit module with summary for ThinLTO index-based WPD.9; RUN: opt -thinlto-bc -o %t3.o %s10; RUN: opt -thinlto-bc -o %t4.o %p/Inputs/devirt_promote.ll11 12; RUN: llvm-lto -thinlto-action=run %t3.o %t4.o --thinlto-save-temps=%t5. \13; RUN:   -whole-program-visibility \14; RUN:   --pass-remarks=. \15; RUN:   --exported-symbol=test \16; RUN:   --exported-symbol=test2 \17; RUN:   --exported-symbol=_ZTV1B 2>&1 | FileCheck %s --check-prefix=REMARK18; RUN: llvm-dis %t5.0.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR119; RUN: llvm-dis %t5.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR220 21; We should devirt call to _ZN1A1nEi once in importing module and once22; in original (exporting) module.23; REMARK-COUNT-2: single-impl: devirtualized a call to _ZN1A1nEi.llvm.24 25target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"26target triple = "x86_64-grtev4-linux-gnu"27 28%struct.A = type { ptr }29 30; CHECK-IR1-LABEL: define i32 @test31define i32 @test(ptr %obj, i32 %a) {32entry:33  %vtable = load ptr, ptr %obj34  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")35  call void @llvm.assume(i1 %p)36  %fptrptr = getelementptr ptr, ptr %vtable, i32 137  %fptr1 = load ptr, ptr %fptrptr, align 838 39  ; Check that the call was devirtualized.40  ; CHECK-IR1: = tail call i32 @_ZN1A1nEi41  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)42 43  ret i32 %call44}45; CHECK-IR1-LABEL: ret i3246; CHECK-IR1-LABEL: }47 48; CHECK-IR2: define noundef i32 @test249; Check that the call was devirtualized.50; CHECK-IR2: = tail call i32 @_ZN1A1nEi51 52declare i1 @llvm.type.test(ptr, metadata)53declare void @llvm.assume(i1)54 55attributes #0 = { noinline optnone }56