112 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -msan-track-origins=2 -msan-eager-checks=1 -S -passes=msan 2>&1 | FileCheck %s --implicit-check-not="call void @__msan_"3 4target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"5target triple = "x86_64-unknown-linux-gnu"6 7!llvm.module.flags = !{!0}8 9!0 = !{i32 2, !"Debug Info Version", i32 3}10!2 = distinct !DISubprogram(name: "t", scope: !3, file: !3, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !6)11!3 = !DIFile(filename: "tmp/noundef.cpp", directory: "/")12!4 = !DISubroutineType(types: !5)13!5 = !{}14!6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)15!10 = !DILocation(line: 9, column: 0, scope: !2)16!11 = !DILocation(line: 9, column: 1, scope: !2)17!12 = !DILocation(line: 9, column: 2, scope: !2)18!13 = !DILocation(line: 9, column: 3, scope: !2)19 20declare void @OneArg(i32 noundef %a) nounwind uwtable sanitize_memory;21declare void @ManyArgs(i32 noundef %a, i32 noundef %b, i32 noundef %c) nounwind uwtable sanitize_memory;22 23define void @TestOne(ptr noundef %a) nounwind uwtable sanitize_memory {24; CHECK-LABEL: @TestOne(25; CHECK-NEXT: entry:26; CHECK-NEXT: call void @llvm.donothing(), !dbg [[DBG1:![0-9]+]]27; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[A:%.*]], align 4, !dbg [[DBG1]]28; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64, !dbg [[DBG1]]29; CHECK-NEXT: [[TMP1:%.*]] = xor i64 [[TMP0]], 87960930222080, !dbg [[DBG1]]30; CHECK-NEXT: [[TMP2:%.*]] = inttoptr i64 [[TMP1]] to ptr, !dbg [[DBG1]]31; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[TMP1]], 17592186044416, !dbg [[DBG1]]32; CHECK-NEXT: [[TMP4:%.*]] = inttoptr i64 [[TMP3]] to ptr, !dbg [[DBG1]]33; CHECK-NEXT: [[_MSLD:%.*]] = load i32, ptr [[TMP2]], align 4, !dbg [[DBG1]]34; CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP4]], align 4, !dbg [[DBG1]]35; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i32 [[_MSLD]], 0, !dbg [[DBG7:![0-9]+]]36; CHECK-NEXT: br i1 [[_MSCMP]], label [[TMP6:%.*]], label [[TMP7:%.*]], !dbg [[DBG7]], !prof [[PROF8:![0-9]+]]37; CHECK: 6:38; CHECK-NEXT: call void @__msan_warning_with_origin_noreturn(i32 [[TMP5]]) #[[ATTR3:[0-9]+]], !dbg [[DBG7]]39; CHECK-NEXT: unreachable, !dbg [[DBG7]]40; CHECK: 7:41; CHECK-NEXT: call void @OneArg(i32 noundef [[V]]), !dbg [[DBG7]]42; CHECK-NEXT: ret void43;44entry:45 %v = load i32, ptr %a, !dbg !1146 call void @OneArg(i32 noundef %v), !dbg !1047 ret void48}49 50define void @TestMany(ptr noundef %a) nounwind uwtable sanitize_memory {51; CHECK-LABEL: @TestMany(52; CHECK-NEXT: entry:53; CHECK-NEXT: call void @llvm.donothing(), !dbg [[DBG1]]54; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[A:%.*]], align 4, !dbg [[DBG1]]55; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64, !dbg [[DBG1]]56; CHECK-NEXT: [[TMP1:%.*]] = xor i64 [[TMP0]], 87960930222080, !dbg [[DBG1]]57; CHECK-NEXT: [[TMP2:%.*]] = inttoptr i64 [[TMP1]] to ptr, !dbg [[DBG1]]58; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[TMP1]], 17592186044416, !dbg [[DBG1]]59; CHECK-NEXT: [[TMP4:%.*]] = inttoptr i64 [[TMP3]] to ptr, !dbg [[DBG1]]60; CHECK-NEXT: [[_MSLD:%.*]] = load i32, ptr [[TMP2]], align 4, !dbg [[DBG1]]61; CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP4]], align 4, !dbg [[DBG1]]62; CHECK-NEXT: [[Y:%.*]] = load i32, ptr [[A]], align 4, !dbg [[DBG9:![0-9]+]]63; CHECK-NEXT: [[TMP6:%.*]] = ptrtoint ptr [[A]] to i64, !dbg [[DBG9]]64; CHECK-NEXT: [[TMP7:%.*]] = xor i64 [[TMP6]], 87960930222080, !dbg [[DBG9]]65; CHECK-NEXT: [[TMP8:%.*]] = inttoptr i64 [[TMP7]] to ptr, !dbg [[DBG9]]66; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[TMP7]], 17592186044416, !dbg [[DBG9]]67; CHECK-NEXT: [[TMP10:%.*]] = inttoptr i64 [[TMP9]] to ptr, !dbg [[DBG9]]68; CHECK-NEXT: [[_MSLD1:%.*]] = load i32, ptr [[TMP8]], align 4, !dbg [[DBG9]]69; CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP10]], align 4, !dbg [[DBG9]]70; CHECK-NEXT: [[Z:%.*]] = load i32, ptr [[A]], align 4, !dbg [[DBG10:![0-9]+]]71; CHECK-NEXT: [[TMP12:%.*]] = ptrtoint ptr [[A]] to i64, !dbg [[DBG10]]72; CHECK-NEXT: [[TMP13:%.*]] = xor i64 [[TMP12]], 87960930222080, !dbg [[DBG10]]73; CHECK-NEXT: [[TMP14:%.*]] = inttoptr i64 [[TMP13]] to ptr, !dbg [[DBG10]]74; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[TMP13]], 17592186044416, !dbg [[DBG10]]75; CHECK-NEXT: [[TMP16:%.*]] = inttoptr i64 [[TMP15]] to ptr, !dbg [[DBG10]]76; CHECK-NEXT: [[_MSLD2:%.*]] = load i32, ptr [[TMP14]], align 4, !dbg [[DBG10]]77; CHECK-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP16]], align 4, !dbg [[DBG10]]78; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i32 [[_MSLD]], 0, !dbg [[DBG7]]79; CHECK-NEXT: br i1 [[_MSCMP]], label [[TMP18:%.*]], label [[TMP20:%.*]], !dbg [[DBG7]], !prof [[PROF8]]80; CHECK: 18:81; CHECK-NEXT: [[TMP19:%.*]] = call i32 @__msan_chain_origin(i32 [[TMP5]]), !dbg [[DBG1]]82; CHECK-NEXT: call void @__msan_warning_with_origin_noreturn(i32 [[TMP19]]) #[[ATTR3]], !dbg [[DBG7]]83; CHECK-NEXT: unreachable, !dbg [[DBG7]]84; CHECK: 20:85; CHECK-NEXT: [[_MSCMP3:%.*]] = icmp ne i32 [[_MSLD1]], 0, !dbg [[DBG7]]86; CHECK-NEXT: br i1 [[_MSCMP3]], label [[TMP21:%.*]], label [[TMP23:%.*]], !dbg [[DBG7]], !prof [[PROF8]]87; CHECK: 21:88; CHECK-NEXT: [[TMP22:%.*]] = call i32 @__msan_chain_origin(i32 [[TMP11]]), !dbg [[DBG9]]89; CHECK-NEXT: call void @__msan_warning_with_origin_noreturn(i32 [[TMP22]]) #[[ATTR3]], !dbg [[DBG7]]90; CHECK-NEXT: unreachable, !dbg [[DBG7]]91; CHECK: 23:92; CHECK-NEXT: [[_MSCMP4:%.*]] = icmp ne i32 [[_MSLD2]], 0, !dbg [[DBG7]]93; CHECK-NEXT: br i1 [[_MSCMP4]], label [[TMP24:%.*]], label [[TMP26:%.*]], !dbg [[DBG7]], !prof [[PROF8]]94; CHECK: 24:95; CHECK-NEXT: [[TMP25:%.*]] = call i32 @__msan_chain_origin(i32 [[TMP17]]), !dbg [[DBG10]]96; CHECK-NEXT: call void @__msan_warning_with_origin_noreturn(i32 [[TMP25]]) #[[ATTR3]], !dbg [[DBG7]]97; CHECK-NEXT: unreachable, !dbg [[DBG7]]98; CHECK: 26:99; CHECK-NEXT: call void @ManyArgs(i32 noundef [[X]], i32 noundef [[Y]], i32 noundef [[Z]]), !dbg [[DBG7]]100; CHECK-NEXT: ret void101;102entry:103 %x = load i32, ptr %a, !dbg !11104 %y = load i32, ptr %a, !dbg !12105 %z = load i32, ptr %a, !dbg !13106 call void @ManyArgs(i32 noundef %x, i32 noundef %y, i32 noundef %z), !dbg !10107 ret void108}109 110; CHECK-LABEL: define internal void @msan.module_ctor()111; CHECK: call void @__msan_init()112