1; To test that asan does not break the musttail call contract. 2; 3; RUN: opt < %s -asan -asan-module -S -enable-new-pm=0 | FileCheck %s 4; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s 5 6define internal i32 @foo(i32* %p) sanitize_address { 7 %rv = load i32, i32* %p 8 ret i32 %rv 9} 10 11declare void @alloca_test_use([10 x i8]*) 12define i32 @call_foo(i32* %a) sanitize_address { 13 %x = alloca [10 x i8], align 1 14 call void @alloca_test_use([10 x i8]* %x) 15 %r = musttail call i32 @foo(i32* %a) 16 ret i32 %r 17} 18 19; CHECK-LABEL: define i32 @call_foo(i32* %a) 20; CHECK: %r = musttail call i32 @foo(i32* %a) 21; CHECK-NEXT: ret i32 %r 22 23 24define i32 @call_foo_cast(i32* %a) sanitize_address { 25 %x = alloca [10 x i8], align 1 26 call void @alloca_test_use([10 x i8]* %x) 27 %r = musttail call i32 @foo(i32* %a) 28 %t = bitcast i32 %r to i32 29 ret i32 %t 30} 31 32; CHECK-LABEL: define i32 @call_foo_cast(i32* %a) 33; CHECK: %r = musttail call i32 @foo(i32* %a) 34; CHECK-NEXT: %t = bitcast i32 %r to i32 35; CHECK-NEXT: ret i32 %t 36