xref: /llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/musttail.ll (revision d39b4ce3ce8a3c256e01bdec2b140777a332a633)
1; Regression test for a compiler bug that caused a crash when instrumenting code
2; using musttail.
3
4; RUN: opt -S -passes=hwasan -hwasan-use-stack-safety=0 %s -o - | FileCheck %s
5
6target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
7target triple = "aarch64"
8
9define dso_local noundef i32 @_Z3bari(i32 noundef %0) sanitize_hwaddress {
10  %2 = alloca i32, align 4
11  store i32 %0, ptr %2, align 4
12  %3 = load i32, ptr %2, align 4
13  ret i32 %3
14}
15
16define dso_local noundef i32 @_Z3fooi(i32 noundef %0) sanitize_hwaddress {
17  %2 = alloca i32, align 4
18  %3 = alloca i32, align 4
19  store i32 %0, ptr %2, align 4
20  store volatile i32 5, ptr %3, align 4
21  %4 = load i32, ptr %2, align 4
22  %5 = load volatile i32, ptr %3, align 4
23  %6 = add nsw i32 %4, %5
24  ; Check we untag before the musttail.
25  ; CHECK: call void @llvm.memset.p0.i64
26  ; CHECK: musttail call
27  ; CHECK-NOT: call void @llvm.memset.p0.i64
28  %7 = musttail call noundef i32 @_Z3bari(i32 noundef %6)
29  ret i32 %7
30}
31