diff options
Diffstat (limited to 'llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll')
-rw-r--r-- | llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll b/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll index 8b8e2970959..73e2c7ac120 100644 --- a/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll +++ b/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll @@ -864,6 +864,7 @@ entry: ; CHECK: call void (i32, ...) @VAArgStructFn ; CHECK: ret void + declare i32 @InnerTailCall(i32 %a) define void @MismatchedReturnTypeTailCall(i32 %a) sanitize_memory { @@ -878,5 +879,41 @@ define void @MismatchedReturnTypeTailCall(i32 %a) sanitize_memory { ; CHECK: tail call i32 @InnerTailCall ; CHECK: ret void + +declare i32 @MustTailCall(i32 %a) + +define i32 @CallMustTailCall(i32 %a) sanitize_memory { + %b = musttail call i32 @MustTailCall(i32 %a) + ret i32 %b +} + +; For "musttail" calls we can not insert any shadow manipulating code between +; call and the return instruction. And we don't need to, because everything is +; taken care of in the callee. + +; CHECK-LABEL: define i32 @CallMustTailCall +; CHECK: musttail call i32 @MustTailCall +; No instrumentation between call and ret. +; CHECK-NEXT: ret i32 + +declare i32* @MismatchingMustTailCall(i32 %a) + +define i8* @MismatchingCallMustTailCall(i32 %a) sanitize_memory { + %b = musttail call i32* @MismatchingMustTailCall(i32 %a) + %c = bitcast i32* %b to i8* + ret i8* %c +} + +; For "musttail" calls we can not insert any shadow manipulating code between +; call and the return instruction. And we don't need to, because everything is +; taken care of in the callee. + +; CHECK-LABEL: define i8* @MismatchingCallMustTailCall +; CHECK: musttail call i32* @MismatchingMustTailCall +; No instrumentation between call and ret. +; CHECK-NEXT: bitcast i32* {{.*}} to i8* +; CHECK-NEXT: ret i8* + + ; CHECK-LABEL: define internal void @msan.module_ctor ; CHECK: call void @__msan_init() |