brintos

brintos / llvm-project-archived public Read only

0
0
Text · 26.1 KiB · ebe66e0 Raw
513 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; Test basic address sanitizer instrumentation.3; Generic code is covered by ../basic.ll, only the x86_64 specific code is4; tested here.5;6; RUN: opt < %s -passes=hwasan -S | FileCheck %s7; RUN: opt < %s -passes=hwasan -hwasan-inline-fast-path-checks=0 -S | FileCheck %s --check-prefixes=NOFASTPATH8; RUN: opt < %s -passes=hwasan -hwasan-inline-fast-path-checks=1 -S | FileCheck %s --check-prefixes=FASTPATH9; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -S | FileCheck %s  --check-prefixes=ABORT10; RUN: opt < %s -passes=hwasan -hwasan-recover=1 -S | FileCheck %s  --check-prefixes=RECOVER11; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -hwasan-instrument-with-calls=0 -S | FileCheck %s  --check-prefixes=ABORT-INLINE12; RUN: opt < %s -passes=hwasan -hwasan-recover=1 -hwasan-instrument-with-calls=0 -S | FileCheck %s  --check-prefixes=RECOVER-INLINE13 14target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"15target triple = "x86_64-unknown-linux-gnu"16 17define i8 @test_load8(ptr %a) sanitize_hwaddress {18; CHECK-LABEL: define i8 @test_load819; CHECK-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {20; CHECK-NEXT:  entry:21; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)22; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i6423; CHECK-NEXT:    call void @__hwasan_load1(i64 [[TMP0]])24; CHECK-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 425; CHECK-NEXT:    ret i8 [[B]]26;27; NOFASTPATH-LABEL: define i8 @test_load828; NOFASTPATH-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {29; NOFASTPATH-NEXT:  entry:30; NOFASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)31; NOFASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i6432; NOFASTPATH-NEXT:    call void @__hwasan_load1(i64 [[TMP0]])33; NOFASTPATH-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 434; NOFASTPATH-NEXT:    ret i8 [[B]]35;36; FASTPATH-LABEL: define i8 @test_load837; FASTPATH-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {38; FASTPATH-NEXT:  entry:39; FASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)40; FASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i6441; FASTPATH-NEXT:    call void @__hwasan_load1(i64 [[TMP0]])42; FASTPATH-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 443; FASTPATH-NEXT:    ret i8 [[B]]44;45; ABORT-LABEL: define i8 @test_load846; ABORT-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {47; ABORT-NEXT:  entry:48; ABORT-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)49; ABORT-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i6450; ABORT-NEXT:    call void @__hwasan_load1(i64 [[TMP0]])51; ABORT-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 452; ABORT-NEXT:    ret i8 [[B]]53;54; RECOVER-LABEL: define i8 @test_load855; RECOVER-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {56; RECOVER-NEXT:  entry:57; RECOVER-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)58; RECOVER-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i6459; RECOVER-NEXT:    call void @__hwasan_load1_noabort(i64 [[TMP0]])60; RECOVER-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 461; RECOVER-NEXT:    ret i8 [[B]]62;63; ABORT-INLINE-LABEL: define i8 @test_load864; ABORT-INLINE-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {65; ABORT-INLINE-NEXT:  entry:66; ABORT-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 867; ABORT-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -907925684877891993768; ABORT-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 429496729569; ABORT-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 170; ABORT-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr71; ABORT-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i6472; ABORT-INLINE-NEXT:    [[TMP5:%.*]] = lshr i64 [[TMP4]], 5773; ABORT-INLINE-NEXT:    [[TMP6:%.*]] = trunc i64 [[TMP5]] to i874; ABORT-INLINE-NEXT:    [[TMP7:%.*]] = and i64 [[TMP4]], -907925684877891993775; ABORT-INLINE-NEXT:    [[TMP8:%.*]] = lshr i64 [[TMP7]], 476; ABORT-INLINE-NEXT:    [[TMP9:%.*]] = getelementptr i8, ptr [[TMP3]], i64 [[TMP8]]77; ABORT-INLINE-NEXT:    [[TMP10:%.*]] = load i8, ptr [[TMP9]], align 178; ABORT-INLINE-NEXT:    [[TMP11:%.*]] = icmp ne i8 [[TMP6]], [[TMP10]]79; ABORT-INLINE-NEXT:    br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP26:%.*]], !prof [[PROF1:![0-9]+]]80; ABORT-INLINE:       12:81; ABORT-INLINE-NEXT:    [[TMP13:%.*]] = icmp ugt i8 [[TMP10]], 1582; ABORT-INLINE-NEXT:    br i1 [[TMP13]], label [[TMP14:%.*]], label [[TMP15:%.*]], !prof [[PROF1]]83; ABORT-INLINE:       14:84; ABORT-INLINE-NEXT:    call void asm sideeffect "int3\0Anopl 64([[RAX:%.*]])", "{rdi}"(i64 [[TMP4]])85; ABORT-INLINE-NEXT:    unreachable86; ABORT-INLINE:       15:87; ABORT-INLINE-NEXT:    [[TMP16:%.*]] = and i64 [[TMP4]], 1588; ABORT-INLINE-NEXT:    [[TMP17:%.*]] = trunc i64 [[TMP16]] to i889; ABORT-INLINE-NEXT:    [[TMP18:%.*]] = add i8 [[TMP17]], 090; ABORT-INLINE-NEXT:    [[TMP19:%.*]] = icmp uge i8 [[TMP18]], [[TMP10]]91; ABORT-INLINE-NEXT:    br i1 [[TMP19]], label [[TMP14]], label [[TMP20:%.*]], !prof [[PROF1]]92; ABORT-INLINE:       20:93; ABORT-INLINE-NEXT:    [[TMP21:%.*]] = or i64 [[TMP7]], 1594; ABORT-INLINE-NEXT:    [[TMP22:%.*]] = inttoptr i64 [[TMP21]] to ptr95; ABORT-INLINE-NEXT:    [[TMP23:%.*]] = load i8, ptr [[TMP22]], align 196; ABORT-INLINE-NEXT:    [[TMP24:%.*]] = icmp ne i8 [[TMP6]], [[TMP23]]97; ABORT-INLINE-NEXT:    br i1 [[TMP24]], label [[TMP14]], label [[TMP25:%.*]], !prof [[PROF1]]98; ABORT-INLINE:       25:99; ABORT-INLINE-NEXT:    br label [[TMP26]]100; ABORT-INLINE:       26:101; ABORT-INLINE-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 4102; ABORT-INLINE-NEXT:    ret i8 [[B]]103;104; RECOVER-INLINE-LABEL: define i8 @test_load8105; RECOVER-INLINE-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {106; RECOVER-INLINE-NEXT:  entry:107; RECOVER-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8108; RECOVER-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937109; RECOVER-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295110; RECOVER-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1111; RECOVER-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr112; RECOVER-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64113; RECOVER-INLINE-NEXT:    [[TMP5:%.*]] = lshr i64 [[TMP4]], 57114; RECOVER-INLINE-NEXT:    [[TMP6:%.*]] = trunc i64 [[TMP5]] to i8115; RECOVER-INLINE-NEXT:    [[TMP7:%.*]] = and i64 [[TMP4]], -9079256848778919937116; RECOVER-INLINE-NEXT:    [[TMP8:%.*]] = lshr i64 [[TMP7]], 4117; RECOVER-INLINE-NEXT:    [[TMP9:%.*]] = getelementptr i8, ptr [[TMP3]], i64 [[TMP8]]118; RECOVER-INLINE-NEXT:    [[TMP10:%.*]] = load i8, ptr [[TMP9]], align 1119; RECOVER-INLINE-NEXT:    [[TMP11:%.*]] = icmp ne i8 [[TMP6]], [[TMP10]]120; RECOVER-INLINE-NEXT:    br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP26:%.*]], !prof [[PROF1:![0-9]+]]121; RECOVER-INLINE:       12:122; RECOVER-INLINE-NEXT:    [[TMP13:%.*]] = icmp ugt i8 [[TMP10]], 15123; RECOVER-INLINE-NEXT:    br i1 [[TMP13]], label [[TMP14:%.*]], label [[TMP15:%.*]], !prof [[PROF1]]124; RECOVER-INLINE:       14:125; RECOVER-INLINE-NEXT:    call void asm sideeffect "int3\0Anopl 96([[RAX:%.*]])", "{rdi}"(i64 [[TMP4]])126; RECOVER-INLINE-NEXT:    br label [[TMP25:%.*]]127; RECOVER-INLINE:       15:128; RECOVER-INLINE-NEXT:    [[TMP16:%.*]] = and i64 [[TMP4]], 15129; RECOVER-INLINE-NEXT:    [[TMP17:%.*]] = trunc i64 [[TMP16]] to i8130; RECOVER-INLINE-NEXT:    [[TMP18:%.*]] = add i8 [[TMP17]], 0131; RECOVER-INLINE-NEXT:    [[TMP19:%.*]] = icmp uge i8 [[TMP18]], [[TMP10]]132; RECOVER-INLINE-NEXT:    br i1 [[TMP19]], label [[TMP14]], label [[TMP20:%.*]], !prof [[PROF1]]133; RECOVER-INLINE:       20:134; RECOVER-INLINE-NEXT:    [[TMP21:%.*]] = or i64 [[TMP7]], 15135; RECOVER-INLINE-NEXT:    [[TMP22:%.*]] = inttoptr i64 [[TMP21]] to ptr136; RECOVER-INLINE-NEXT:    [[TMP23:%.*]] = load i8, ptr [[TMP22]], align 1137; RECOVER-INLINE-NEXT:    [[TMP24:%.*]] = icmp ne i8 [[TMP6]], [[TMP23]]138; RECOVER-INLINE-NEXT:    br i1 [[TMP24]], label [[TMP14]], label [[TMP25]], !prof [[PROF1]]139; RECOVER-INLINE:       25:140; RECOVER-INLINE-NEXT:    br label [[TMP26]]141; RECOVER-INLINE:       26:142; RECOVER-INLINE-NEXT:    [[B:%.*]] = load i8, ptr [[A]], align 4143; RECOVER-INLINE-NEXT:    ret i8 [[B]]144;145entry:146  %b = load i8, ptr %a, align 4147  ret i8 %b148}149 150define i40 @test_load40(ptr %a) sanitize_hwaddress {151; CHECK-LABEL: define i40 @test_load40152; CHECK-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {153; CHECK-NEXT:  entry:154; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)155; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64156; CHECK-NEXT:    call void @__hwasan_loadN(i64 [[TMP0]], i64 5)157; CHECK-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4158; CHECK-NEXT:    ret i40 [[B]]159;160; NOFASTPATH-LABEL: define i40 @test_load40161; NOFASTPATH-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {162; NOFASTPATH-NEXT:  entry:163; NOFASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)164; NOFASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64165; NOFASTPATH-NEXT:    call void @__hwasan_loadN(i64 [[TMP0]], i64 5)166; NOFASTPATH-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4167; NOFASTPATH-NEXT:    ret i40 [[B]]168;169; FASTPATH-LABEL: define i40 @test_load40170; FASTPATH-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {171; FASTPATH-NEXT:  entry:172; FASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)173; FASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64174; FASTPATH-NEXT:    call void @__hwasan_loadN(i64 [[TMP0]], i64 5)175; FASTPATH-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4176; FASTPATH-NEXT:    ret i40 [[B]]177;178; ABORT-LABEL: define i40 @test_load40179; ABORT-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {180; ABORT-NEXT:  entry:181; ABORT-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)182; ABORT-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64183; ABORT-NEXT:    call void @__hwasan_loadN(i64 [[TMP0]], i64 5)184; ABORT-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4185; ABORT-NEXT:    ret i40 [[B]]186;187; RECOVER-LABEL: define i40 @test_load40188; RECOVER-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {189; RECOVER-NEXT:  entry:190; RECOVER-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)191; RECOVER-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64192; RECOVER-NEXT:    call void @__hwasan_loadN_noabort(i64 [[TMP0]], i64 5)193; RECOVER-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4194; RECOVER-NEXT:    ret i40 [[B]]195;196; ABORT-INLINE-LABEL: define i40 @test_load40197; ABORT-INLINE-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {198; ABORT-INLINE-NEXT:  entry:199; ABORT-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8200; ABORT-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937201; ABORT-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295202; ABORT-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1203; ABORT-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr204; ABORT-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64205; ABORT-INLINE-NEXT:    call void @__hwasan_loadN(i64 [[TMP4]], i64 5)206; ABORT-INLINE-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4207; ABORT-INLINE-NEXT:    ret i40 [[B]]208;209; RECOVER-INLINE-LABEL: define i40 @test_load40210; RECOVER-INLINE-SAME: (ptr [[A:%.*]]) #[[ATTR0]] {211; RECOVER-INLINE-NEXT:  entry:212; RECOVER-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8213; RECOVER-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937214; RECOVER-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295215; RECOVER-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1216; RECOVER-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr217; RECOVER-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64218; RECOVER-INLINE-NEXT:    call void @__hwasan_loadN_noabort(i64 [[TMP4]], i64 5)219; RECOVER-INLINE-NEXT:    [[B:%.*]] = load i40, ptr [[A]], align 4220; RECOVER-INLINE-NEXT:    ret i40 [[B]]221;222entry:223  %b = load i40, ptr %a, align 4224  ret i40 %b225}226 227define void @test_store8(ptr %a, i8 %b) sanitize_hwaddress {228; CHECK-LABEL: define void @test_store8229; CHECK-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {230; CHECK-NEXT:  entry:231; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)232; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64233; CHECK-NEXT:    call void @__hwasan_store1(i64 [[TMP0]])234; CHECK-NEXT:    store i8 [[B]], ptr [[A]], align 4235; CHECK-NEXT:    ret void236;237; NOFASTPATH-LABEL: define void @test_store8238; NOFASTPATH-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {239; NOFASTPATH-NEXT:  entry:240; NOFASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)241; NOFASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64242; NOFASTPATH-NEXT:    call void @__hwasan_store1(i64 [[TMP0]])243; NOFASTPATH-NEXT:    store i8 [[B]], ptr [[A]], align 4244; NOFASTPATH-NEXT:    ret void245;246; FASTPATH-LABEL: define void @test_store8247; FASTPATH-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {248; FASTPATH-NEXT:  entry:249; FASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)250; FASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64251; FASTPATH-NEXT:    call void @__hwasan_store1(i64 [[TMP0]])252; FASTPATH-NEXT:    store i8 [[B]], ptr [[A]], align 4253; FASTPATH-NEXT:    ret void254;255; ABORT-LABEL: define void @test_store8256; ABORT-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {257; ABORT-NEXT:  entry:258; ABORT-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)259; ABORT-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64260; ABORT-NEXT:    call void @__hwasan_store1(i64 [[TMP0]])261; ABORT-NEXT:    store i8 [[B]], ptr [[A]], align 4262; ABORT-NEXT:    ret void263;264; RECOVER-LABEL: define void @test_store8265; RECOVER-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {266; RECOVER-NEXT:  entry:267; RECOVER-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)268; RECOVER-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64269; RECOVER-NEXT:    call void @__hwasan_store1_noabort(i64 [[TMP0]])270; RECOVER-NEXT:    store i8 [[B]], ptr [[A]], align 4271; RECOVER-NEXT:    ret void272;273; ABORT-INLINE-LABEL: define void @test_store8274; ABORT-INLINE-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {275; ABORT-INLINE-NEXT:  entry:276; ABORT-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8277; ABORT-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937278; ABORT-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295279; ABORT-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1280; ABORT-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr281; ABORT-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64282; ABORT-INLINE-NEXT:    [[TMP5:%.*]] = lshr i64 [[TMP4]], 57283; ABORT-INLINE-NEXT:    [[TMP6:%.*]] = trunc i64 [[TMP5]] to i8284; ABORT-INLINE-NEXT:    [[TMP7:%.*]] = and i64 [[TMP4]], -9079256848778919937285; ABORT-INLINE-NEXT:    [[TMP8:%.*]] = lshr i64 [[TMP7]], 4286; ABORT-INLINE-NEXT:    [[TMP9:%.*]] = getelementptr i8, ptr [[TMP3]], i64 [[TMP8]]287; ABORT-INLINE-NEXT:    [[TMP10:%.*]] = load i8, ptr [[TMP9]], align 1288; ABORT-INLINE-NEXT:    [[TMP11:%.*]] = icmp ne i8 [[TMP6]], [[TMP10]]289; ABORT-INLINE-NEXT:    br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP26:%.*]], !prof [[PROF1]]290; ABORT-INLINE:       12:291; ABORT-INLINE-NEXT:    [[TMP13:%.*]] = icmp ugt i8 [[TMP10]], 15292; ABORT-INLINE-NEXT:    br i1 [[TMP13]], label [[TMP14:%.*]], label [[TMP15:%.*]], !prof [[PROF1]]293; ABORT-INLINE:       14:294; ABORT-INLINE-NEXT:    call void asm sideeffect "int3\0Anopl 80([[RAX:%.*]])", "{rdi}"(i64 [[TMP4]])295; ABORT-INLINE-NEXT:    unreachable296; ABORT-INLINE:       15:297; ABORT-INLINE-NEXT:    [[TMP16:%.*]] = and i64 [[TMP4]], 15298; ABORT-INLINE-NEXT:    [[TMP17:%.*]] = trunc i64 [[TMP16]] to i8299; ABORT-INLINE-NEXT:    [[TMP18:%.*]] = add i8 [[TMP17]], 0300; ABORT-INLINE-NEXT:    [[TMP19:%.*]] = icmp uge i8 [[TMP18]], [[TMP10]]301; ABORT-INLINE-NEXT:    br i1 [[TMP19]], label [[TMP14]], label [[TMP20:%.*]], !prof [[PROF1]]302; ABORT-INLINE:       20:303; ABORT-INLINE-NEXT:    [[TMP21:%.*]] = or i64 [[TMP7]], 15304; ABORT-INLINE-NEXT:    [[TMP22:%.*]] = inttoptr i64 [[TMP21]] to ptr305; ABORT-INLINE-NEXT:    [[TMP23:%.*]] = load i8, ptr [[TMP22]], align 1306; ABORT-INLINE-NEXT:    [[TMP24:%.*]] = icmp ne i8 [[TMP6]], [[TMP23]]307; ABORT-INLINE-NEXT:    br i1 [[TMP24]], label [[TMP14]], label [[TMP25:%.*]], !prof [[PROF1]]308; ABORT-INLINE:       25:309; ABORT-INLINE-NEXT:    br label [[TMP26]]310; ABORT-INLINE:       26:311; ABORT-INLINE-NEXT:    store i8 [[B]], ptr [[A]], align 4312; ABORT-INLINE-NEXT:    ret void313;314; RECOVER-INLINE-LABEL: define void @test_store8315; RECOVER-INLINE-SAME: (ptr [[A:%.*]], i8 [[B:%.*]]) #[[ATTR0]] {316; RECOVER-INLINE-NEXT:  entry:317; RECOVER-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8318; RECOVER-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937319; RECOVER-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295320; RECOVER-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1321; RECOVER-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr322; RECOVER-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64323; RECOVER-INLINE-NEXT:    [[TMP5:%.*]] = lshr i64 [[TMP4]], 57324; RECOVER-INLINE-NEXT:    [[TMP6:%.*]] = trunc i64 [[TMP5]] to i8325; RECOVER-INLINE-NEXT:    [[TMP7:%.*]] = and i64 [[TMP4]], -9079256848778919937326; RECOVER-INLINE-NEXT:    [[TMP8:%.*]] = lshr i64 [[TMP7]], 4327; RECOVER-INLINE-NEXT:    [[TMP9:%.*]] = getelementptr i8, ptr [[TMP3]], i64 [[TMP8]]328; RECOVER-INLINE-NEXT:    [[TMP10:%.*]] = load i8, ptr [[TMP9]], align 1329; RECOVER-INLINE-NEXT:    [[TMP11:%.*]] = icmp ne i8 [[TMP6]], [[TMP10]]330; RECOVER-INLINE-NEXT:    br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP26:%.*]], !prof [[PROF1]]331; RECOVER-INLINE:       12:332; RECOVER-INLINE-NEXT:    [[TMP13:%.*]] = icmp ugt i8 [[TMP10]], 15333; RECOVER-INLINE-NEXT:    br i1 [[TMP13]], label [[TMP14:%.*]], label [[TMP15:%.*]], !prof [[PROF1]]334; RECOVER-INLINE:       14:335; RECOVER-INLINE-NEXT:    call void asm sideeffect "int3\0Anopl 112([[RAX:%.*]])", "{rdi}"(i64 [[TMP4]])336; RECOVER-INLINE-NEXT:    br label [[TMP25:%.*]]337; RECOVER-INLINE:       15:338; RECOVER-INLINE-NEXT:    [[TMP16:%.*]] = and i64 [[TMP4]], 15339; RECOVER-INLINE-NEXT:    [[TMP17:%.*]] = trunc i64 [[TMP16]] to i8340; RECOVER-INLINE-NEXT:    [[TMP18:%.*]] = add i8 [[TMP17]], 0341; RECOVER-INLINE-NEXT:    [[TMP19:%.*]] = icmp uge i8 [[TMP18]], [[TMP10]]342; RECOVER-INLINE-NEXT:    br i1 [[TMP19]], label [[TMP14]], label [[TMP20:%.*]], !prof [[PROF1]]343; RECOVER-INLINE:       20:344; RECOVER-INLINE-NEXT:    [[TMP21:%.*]] = or i64 [[TMP7]], 15345; RECOVER-INLINE-NEXT:    [[TMP22:%.*]] = inttoptr i64 [[TMP21]] to ptr346; RECOVER-INLINE-NEXT:    [[TMP23:%.*]] = load i8, ptr [[TMP22]], align 1347; RECOVER-INLINE-NEXT:    [[TMP24:%.*]] = icmp ne i8 [[TMP6]], [[TMP23]]348; RECOVER-INLINE-NEXT:    br i1 [[TMP24]], label [[TMP14]], label [[TMP25]], !prof [[PROF1]]349; RECOVER-INLINE:       25:350; RECOVER-INLINE-NEXT:    br label [[TMP26]]351; RECOVER-INLINE:       26:352; RECOVER-INLINE-NEXT:    store i8 [[B]], ptr [[A]], align 4353; RECOVER-INLINE-NEXT:    ret void354;355entry:356  store i8 %b, ptr %a, align 4357  ret void358}359 360define void @test_store40(ptr %a, i40 %b) sanitize_hwaddress {361; CHECK-LABEL: define void @test_store40362; CHECK-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {363; CHECK-NEXT:  entry:364; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)365; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64366; CHECK-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 5)367; CHECK-NEXT:    store i40 [[B]], ptr [[A]], align 4368; CHECK-NEXT:    ret void369;370; NOFASTPATH-LABEL: define void @test_store40371; NOFASTPATH-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {372; NOFASTPATH-NEXT:  entry:373; NOFASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)374; NOFASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64375; NOFASTPATH-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 5)376; NOFASTPATH-NEXT:    store i40 [[B]], ptr [[A]], align 4377; NOFASTPATH-NEXT:    ret void378;379; FASTPATH-LABEL: define void @test_store40380; FASTPATH-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {381; FASTPATH-NEXT:  entry:382; FASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)383; FASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64384; FASTPATH-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 5)385; FASTPATH-NEXT:    store i40 [[B]], ptr [[A]], align 4386; FASTPATH-NEXT:    ret void387;388; ABORT-LABEL: define void @test_store40389; ABORT-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {390; ABORT-NEXT:  entry:391; ABORT-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)392; ABORT-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64393; ABORT-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 5)394; ABORT-NEXT:    store i40 [[B]], ptr [[A]], align 4395; ABORT-NEXT:    ret void396;397; RECOVER-LABEL: define void @test_store40398; RECOVER-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {399; RECOVER-NEXT:  entry:400; RECOVER-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)401; RECOVER-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64402; RECOVER-NEXT:    call void @__hwasan_storeN_noabort(i64 [[TMP0]], i64 5)403; RECOVER-NEXT:    store i40 [[B]], ptr [[A]], align 4404; RECOVER-NEXT:    ret void405;406; ABORT-INLINE-LABEL: define void @test_store40407; ABORT-INLINE-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {408; ABORT-INLINE-NEXT:  entry:409; ABORT-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8410; ABORT-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937411; ABORT-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295412; ABORT-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1413; ABORT-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr414; ABORT-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64415; ABORT-INLINE-NEXT:    call void @__hwasan_storeN(i64 [[TMP4]], i64 5)416; ABORT-INLINE-NEXT:    store i40 [[B]], ptr [[A]], align 4417; ABORT-INLINE-NEXT:    ret void418;419; RECOVER-INLINE-LABEL: define void @test_store40420; RECOVER-INLINE-SAME: (ptr [[A:%.*]], i40 [[B:%.*]]) #[[ATTR0]] {421; RECOVER-INLINE-NEXT:  entry:422; RECOVER-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8423; RECOVER-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937424; RECOVER-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295425; RECOVER-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1426; RECOVER-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr427; RECOVER-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64428; RECOVER-INLINE-NEXT:    call void @__hwasan_storeN_noabort(i64 [[TMP4]], i64 5)429; RECOVER-INLINE-NEXT:    store i40 [[B]], ptr [[A]], align 4430; RECOVER-INLINE-NEXT:    ret void431;432entry:433  store i40 %b, ptr %a, align 4434  ret void435}436 437define void @test_store_unaligned(ptr %a, i64 %b) sanitize_hwaddress {438; CHECK-LABEL: define void @test_store_unaligned439; CHECK-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {440; CHECK-NEXT:  entry:441; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)442; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64443; CHECK-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 8)444; CHECK-NEXT:    store i64 [[B]], ptr [[A]], align 4445; CHECK-NEXT:    ret void446;447; NOFASTPATH-LABEL: define void @test_store_unaligned448; NOFASTPATH-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {449; NOFASTPATH-NEXT:  entry:450; NOFASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)451; NOFASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64452; NOFASTPATH-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 8)453; NOFASTPATH-NEXT:    store i64 [[B]], ptr [[A]], align 4454; NOFASTPATH-NEXT:    ret void455;456; FASTPATH-LABEL: define void @test_store_unaligned457; FASTPATH-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {458; FASTPATH-NEXT:  entry:459; FASTPATH-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)460; FASTPATH-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64461; FASTPATH-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 8)462; FASTPATH-NEXT:    store i64 [[B]], ptr [[A]], align 4463; FASTPATH-NEXT:    ret void464;465; ABORT-LABEL: define void @test_store_unaligned466; ABORT-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {467; ABORT-NEXT:  entry:468; ABORT-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)469; ABORT-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64470; ABORT-NEXT:    call void @__hwasan_storeN(i64 [[TMP0]], i64 8)471; ABORT-NEXT:    store i64 [[B]], ptr [[A]], align 4472; ABORT-NEXT:    ret void473;474; RECOVER-LABEL: define void @test_store_unaligned475; RECOVER-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {476; RECOVER-NEXT:  entry:477; RECOVER-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)478; RECOVER-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64479; RECOVER-NEXT:    call void @__hwasan_storeN_noabort(i64 [[TMP0]], i64 8)480; RECOVER-NEXT:    store i64 [[B]], ptr [[A]], align 4481; RECOVER-NEXT:    ret void482;483; ABORT-INLINE-LABEL: define void @test_store_unaligned484; ABORT-INLINE-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {485; ABORT-INLINE-NEXT:  entry:486; ABORT-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8487; ABORT-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937488; ABORT-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295489; ABORT-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1490; ABORT-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr491; ABORT-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64492; ABORT-INLINE-NEXT:    call void @__hwasan_storeN(i64 [[TMP4]], i64 8)493; ABORT-INLINE-NEXT:    store i64 [[B]], ptr [[A]], align 4494; ABORT-INLINE-NEXT:    ret void495;496; RECOVER-INLINE-LABEL: define void @test_store_unaligned497; RECOVER-INLINE-SAME: (ptr [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {498; RECOVER-INLINE-NEXT:  entry:499; RECOVER-INLINE-NEXT:    [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8500; RECOVER-INLINE-NEXT:    [[TMP1:%.*]] = and i64 [[TMP0]], -9079256848778919937501; RECOVER-INLINE-NEXT:    [[TMP2:%.*]] = or i64 [[TMP1]], 4294967295502; RECOVER-INLINE-NEXT:    [[HWASAN_SHADOW:%.*]] = add i64 [[TMP2]], 1503; RECOVER-INLINE-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr504; RECOVER-INLINE-NEXT:    [[TMP4:%.*]] = ptrtoint ptr [[A]] to i64505; RECOVER-INLINE-NEXT:    call void @__hwasan_storeN_noabort(i64 [[TMP4]], i64 8)506; RECOVER-INLINE-NEXT:    store i64 [[B]], ptr [[A]], align 4507; RECOVER-INLINE-NEXT:    ret void508;509entry:510  store i64 %b, ptr %a, align 4511  ret void512}513