1 ; Make sure MSan handles llvm.launder.invariant.group correctly.
3 ; RUN: opt < %s -passes='module(msan),default<O1>' -msan-kernel=1 -S | FileCheck -check-prefixes=CHECK %s
4 ; RUN: opt < %s -passes='module(msan),default<O1>' -S | FileCheck -check-prefixes=CHECK %s
6 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 %class.Foo = type { ptr }
10 @flag = dso_local local_unnamed_addr global i8 0, align 1
12 define dso_local ptr @_Z1fv() local_unnamed_addr #0 {
14 %p = alloca ptr, align 8
15 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p)
16 %0 = load i8, ptr @flag, align 1
17 %tobool = icmp ne i8 %0, 0
18 %call = call zeroext i1 @_Z2f1PPvb(ptr nonnull %p, i1 zeroext %tobool)
19 %1 = load ptr, ptr %p, align 8
20 %2 = call ptr @llvm.launder.invariant.group.p0(ptr %1)
21 %retval.0 = select i1 %call, ptr %2, ptr null
22 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p)
26 ; CHECK-NOT: call void @__msan_warning_with_origin_noreturn
28 declare dso_local zeroext i1 @_Z2f1PPvb(ptr, i1 zeroext) local_unnamed_addr
30 declare ptr @llvm.launder.invariant.group.p0(ptr)
32 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
34 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
36 attributes #0 = { sanitize_memory uwtable }