From 49e004fbe0416bc23ebea8824805fd7f07f90fa8 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Mon, 11 Nov 2024 16:40:02 -0800 Subject: [PATCH] [nfc][msan] Regenerate tests missing FileCheck (#115794) Extracted and updated from #115018 Co-authored-by: Kamil Kashapov --- .../MemorySanitizer/LoongArch/vararg.ll | 32 +++++++++++++++++- .../MemorySanitizer/i386/vararg.ll | 33 +++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/llvm/test/Instrumentation/MemorySanitizer/LoongArch/vararg.ll b/llvm/test/Instrumentation/MemorySanitizer/LoongArch/vararg.ll index dcbe2a2422488..1ed716e3de3fc 100644 --- a/llvm/test/Instrumentation/MemorySanitizer/LoongArch/vararg.ll +++ b/llvm/test/Instrumentation/MemorySanitizer/LoongArch/vararg.ll @@ -1,10 +1,40 @@ -; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck %s ; Test that code using va_start can be compiled on LoongArch. target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128" target triple = "loongarch64-unknown-linux-gnu" define void @VaStart(ptr %s, ...) { +; CHECK-LABEL: define void @VaStart( +; CHECK-SAME: ptr [[S:%.*]], ...) { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__msan_va_arg_overflow_size_tls, align 8 +; CHECK-NEXT: [[TMP1:%.*]] = add i64 0, [[TMP0]] +; CHECK-NEXT: [[TMP2:%.*]] = alloca i8, i64 [[TMP1]], align 8 +; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP2]], i8 0, i64 [[TMP1]], i1 false) +; CHECK-NEXT: [[TMP3:%.*]] = call i64 @llvm.umin.i64(i64 [[TMP1]], i64 800) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TMP2]], ptr align 8 @__msan_va_arg_tls, i64 [[TMP3]], i1 false) +; CHECK-NEXT: call void @llvm.donothing() +; CHECK-NEXT: [[VL:%.*]] = alloca ptr, align 4 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[VL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = xor i64 [[TMP4]], 87960930222080 +; CHECK-NEXT: [[TMP6:%.*]] = inttoptr i64 [[TMP5]] to ptr +; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[TMP6]], i8 0, i64 8, i1 false) +; CHECK-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[VL]] to i64 +; CHECK-NEXT: [[TMP8:%.*]] = xor i64 [[TMP7]], 87960930222080 +; CHECK-NEXT: [[TMP9:%.*]] = inttoptr i64 [[TMP8]] to ptr +; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP9]], i8 0, i64 8, i1 false) +; CHECK-NEXT: call void @llvm.va_start.p0(ptr [[VL]]) +; CHECK-NEXT: [[TMP10:%.*]] = ptrtoint ptr [[VL]] to i64 +; CHECK-NEXT: [[TMP11:%.*]] = inttoptr i64 [[TMP10]] to ptr +; CHECK-NEXT: [[TMP12:%.*]] = load ptr, ptr [[TMP11]], align 8 +; CHECK-NEXT: [[TMP13:%.*]] = ptrtoint ptr [[TMP12]] to i64 +; CHECK-NEXT: [[TMP14:%.*]] = xor i64 [[TMP13]], 87960930222080 +; CHECK-NEXT: [[TMP15:%.*]] = inttoptr i64 [[TMP14]] to ptr +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TMP15]], ptr align 8 [[TMP2]], i64 [[TMP1]], i1 false) +; CHECK-NEXT: ret void +; entry: %vl = alloca ptr, align 4 call void @llvm.va_start(ptr %vl) diff --git a/llvm/test/Instrumentation/MemorySanitizer/i386/vararg.ll b/llvm/test/Instrumentation/MemorySanitizer/i386/vararg.ll index cb3103610ae8c..9d86850bd5215 100644 --- a/llvm/test/Instrumentation/MemorySanitizer/i386/vararg.ll +++ b/llvm/test/Instrumentation/MemorySanitizer/i386/vararg.ll @@ -1,12 +1,41 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 -; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 -; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan -msan-kernel=1 2>&1 +; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck %s +; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan -msan-kernel=1 2>&1 | FileCheck %s --check-prefixes=KERNEL ; Test that code using va_start can be compiled on i386. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" target triple = "i386-unknown-linux-gnu" define void @VaStart(ptr %s, ...) { +; CHECK-LABEL: define void @VaStart( +; CHECK-SAME: ptr [[S:%.*]], ...) { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: call void @llvm.donothing() +; CHECK-NEXT: [[VL:%.*]] = alloca ptr, align 4 +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[VL]] to i32 +; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 2147483647 +; CHECK-NEXT: [[TMP2:%.*]] = inttoptr i32 [[TMP1]] to ptr +; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 4 [[TMP2]], i8 0, i32 4, i1 false) +; CHECK-NEXT: call void @llvm.va_start.p0(ptr [[VL]]) +; CHECK-NEXT: ret void +; +; KERNEL-LABEL: define void @VaStart( +; KERNEL-SAME: ptr [[S:%.*]], ...) { +; KERNEL-NEXT: [[ENTRY:.*:]] +; KERNEL-NEXT: [[TMP0:%.*]] = call ptr @__msan_get_context_state() +; KERNEL-NEXT: [[PARAM_SHADOW:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 0 +; KERNEL-NEXT: [[RETVAL_SHADOW:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 1 +; KERNEL-NEXT: [[VA_ARG_SHADOW:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 2 +; KERNEL-NEXT: [[VA_ARG_ORIGIN:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 3 +; KERNEL-NEXT: [[VA_ARG_OVERFLOW_SIZE:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 4 +; KERNEL-NEXT: [[PARAM_ORIGIN:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 5 +; KERNEL-NEXT: [[RETVAL_ORIGIN:%.*]] = getelementptr { [100 x i64], [100 x i64], [100 x i64], [100 x i64], i64, [200 x i32], i32, i32 }, ptr [[TMP0]], i32 0, i32 6 +; KERNEL-NEXT: call void @llvm.donothing() +; KERNEL-NEXT: [[VL:%.*]] = alloca ptr, align 4 +; KERNEL-NEXT: call void @__msan_unpoison_alloca(ptr [[VL]], i32 4) +; KERNEL-NEXT: call void @llvm.va_start.p0(ptr [[VL]]) +; KERNEL-NEXT: ret void +; entry: %vl = alloca ptr, align 4 call void @llvm.va_start(ptr %vl)