1; Test to ensure type tests that are only used in assumes are ignored by 2; LowerTypeTests (in the normal pass sequence they will be stripped out 3; by a subsequent special LTT invocation). 4 5; RUN: opt -S -passes=lowertypetests < %s | FileCheck %s 6 7; ModuleID = 'pr48245.o' 8source_filename = "pr48245.cpp" 9target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 10target triple = "x86_64-unknown-linux-gnu" 11 12%struct.Foo = type { ptr } 13 14; Check that the vtable was not turned into an alias to a rewritten private 15; global. 16; CHECK: @_ZTV3Foo = dso_local unnamed_addr constant 17@_ZTV3Foo = dso_local unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr @_ZTI3Foo, ptr @_ZN3Foo2f1Ev, ptr @_ZN3Foo2f2Ev] }, align 8, !type !0, !type !1, !type !2 18 19@_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global ptr 20@_ZTS3Foo = dso_local constant [5 x i8] c"3Foo\00", align 1 21@_ZTI3Foo = dso_local constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS3Foo }, align 8 22@b = dso_local local_unnamed_addr global ptr null, align 8 23 24define dso_local i32 @main() local_unnamed_addr { 25entry: 26 %0 = load ptr, ptr @b, align 8 27 %vtable.i = load ptr, ptr %0, align 8 28 29 ; Check that the type test was not lowered. 30 ; CHECK: tail call i1 @llvm.type.test 31 %1 = tail call i1 @llvm.type.test(ptr %vtable.i, metadata !"_ZTS3Foo") 32 33 tail call void @llvm.assume(i1 %1) 34 %2 = load ptr, ptr %vtable.i, align 8 35 %call.i = tail call i32 %2(ptr nonnull dereferenceable(8) %0) 36 ret i32 %call.i 37} 38 39declare i1 @llvm.type.test(ptr, metadata) 40declare void @llvm.assume(i1 noundef) 41declare dso_local i32 @_ZN3Foo2f1Ev(ptr nocapture nonnull readnone dereferenceable(8) %this) unnamed_addr 42declare dso_local i32 @_ZN3Foo2f2Ev(ptr nocapture nonnull readnone dereferenceable(8) %this) unnamed_addr 43 44!0 = !{i64 16, !"_ZTS3Foo"} 45!1 = !{i64 16, !"_ZTSM3FooFivE.virtual"} 46!2 = !{i64 24, !"_ZTSM3FooFivE.virtual"} 47