1; Test KHWASan instrumentation. 2; Generic code is covered by ../kernel.ll, only the x86_64 specific code is 3; tested here. 4; 5; RUN: opt < %s -hwasan -hwasan-kernel=1 -S | FileCheck %s --allow-empty --check-prefixes=INIT 6; RUN: opt < %s -hwasan -hwasan-kernel=1 -S | FileCheck %s 7; RUN: opt < %s -hwasan -hwasan-kernel=1 -hwasan-mapping-offset=12345678 -S | FileCheck %s 8; RUN: opt < %s -hwasan -hwasan-kernel=1 -hwasan-recover=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT 9; RUN: opt < %s -hwasan -hwasan-kernel=1 -hwasan-recover=1 -S | FileCheck %s --check-prefixes=CHECK,RECOVER 10 11target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 12target triple = "x86_64-unknown-linux-gnu" 13 14define i8 @test_load(i8* %a) sanitize_hwaddress { 15; CHECK-LABEL: @test_load( 16; CHECK: %[[A:[^ ]*]] = ptrtoint i8* %a to i64 17 18; ABORT: call void asm sideeffect "int3\0Anopl 64(%rax)", "{rdi}"(i64 %[[A]]) 19; ABORT: unreachable 20; RECOVER: call void asm sideeffect "int3\0Anopl 96(%rax)", "{rdi}"(i64 %[[A]]) 21; RECOVER: br label 22 23; CHECK: %[[A:[^ ]*]] = ptrtoint i8* %a to i64 24; CHECK: %[[UNTAGGED:[^ ]*]] = or i64 %[[A]], -72057594037927936 25; CHECK: %[[UNTAGGED_PTR:[^ ]*]] = inttoptr i64 %[[UNTAGGED]] to i8* 26; CHECK: %[[G:[^ ]*]] = load i8, i8* %[[UNTAGGED_PTR]], align 4 27; CHECK: ret i8 %[[G]] 28 29entry: 30 %b = load i8, i8* %a, align 4 31 ret i8 %b 32} 33 34; INIT-NOT: call void @__hwasan_init 35