brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.2 KiB · 1b00cd8 Raw
199 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=asan -asan-use-after-return=never -S | FileCheck %s --check-prefixes=CHECK,NEVER3; RUN: opt < %s -passes=asan -asan-use-after-return=runtime -S | FileCheck %s --check-prefixes=CHECK,RUNTIME4; RUN: opt < %s -passes=asan -asan-use-after-return=always -S | FileCheck %s --check-prefixes=CHECK,ALWAYS5target datalayout = "e-i64:64-f80:128-s:64-n8:16:32:64-S128"6target triple = "x86_64-unknown-linux-gnu"7 8declare void @Foo(ptr)9 10define void @Empty() uwtable sanitize_address {11; CHECK-LABEL: @Empty(12; CHECK-NEXT:  entry:13; CHECK-NEXT:    ret void14;15entry:16  ret void17}18 19define void @Simple() uwtable sanitize_address {20; NEVER-LABEL: @Simple(21; NEVER-NEXT:  entry:22; NEVER-NEXT:    [[MYALLOCA:%.*]] = alloca i8, i64 64, align 3223; NEVER-NEXT:    [[TMP2:%.*]] = getelementptr i8, ptr [[MYALLOCA]], i64 3224; NEVER-NEXT:    store i64 1102416563, ptr [[MYALLOCA]], align 825; NEVER-NEXT:    [[TMP5:%.*]] = getelementptr i8, ptr [[MYALLOCA]], i64 826; NEVER-NEXT:    store i64 ptrtoint (ptr @___asan_gen_stack to i64), ptr [[TMP5]], align 827; NEVER-NEXT:    [[TMP7:%.*]] = getelementptr i8, ptr [[MYALLOCA]], i64 1628; NEVER-NEXT:    store i64 ptrtoint (ptr @Simple to i64), ptr [[TMP7]], align 829; NEVER-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[MYALLOCA]] to i6430; NEVER-NEXT:    [[TMP8:%.*]] = lshr i64 [[TMP0]], 331; NEVER-NEXT:    [[TMP9:%.*]] = add i64 [[TMP8]], 214745088032; NEVER-NEXT:    [[TMP10:%.*]] = add i64 [[TMP9]], 033; NEVER-NEXT:    [[TMP11:%.*]] = inttoptr i64 [[TMP10]] to ptr34; NEVER-NEXT:    store i64 -868083113472691727, ptr [[TMP11]], align 135; NEVER-NEXT:    call void @Foo(ptr [[TMP2]])36; NEVER-NEXT:    store i64 1172321806, ptr [[MYALLOCA]], align 837; NEVER-NEXT:    [[TMP12:%.*]] = add i64 [[TMP9]], 038; NEVER-NEXT:    [[TMP13:%.*]] = inttoptr i64 [[TMP12]] to ptr39; NEVER-NEXT:    store i64 0, ptr [[TMP13]], align 140; NEVER-NEXT:    ret void41;42; RUNTIME-LABEL: @Simple(43; RUNTIME-NEXT:  entry:44; RUNTIME-NEXT:    [[ASAN_LOCAL_STACK_BASE:%.*]] = alloca i64, align 845; RUNTIME-NEXT:    [[TMP0:%.*]] = load i32, ptr @__asan_option_detect_stack_use_after_return, align 446; RUNTIME-NEXT:    [[TMP1:%.*]] = icmp ne i32 [[TMP0]], 047; RUNTIME-NEXT:    br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP4:%.*]]48; RUNTIME:       2:49; RUNTIME-NEXT:    [[TMP3:%.*]] = call i64 @__asan_stack_malloc_0(i64 64)50; RUNTIME-NEXT:    br label [[TMP4]]51; RUNTIME:       4:52; RUNTIME-NEXT:    [[TMP5:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[TMP3]], [[TMP2]] ]53; RUNTIME-NEXT:    [[TMP8:%.*]] = inttoptr i64 [[TMP5]] to ptr54; RUNTIME-NEXT:    [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 055; RUNTIME-NEXT:    br i1 [[TMP6]], label [[TMP7:%.*]], label [[TMP9:%.*]]56; RUNTIME:       8:57; RUNTIME-NEXT:    [[MYALLOCA:%.*]] = alloca i8, i64 64, align 3258; RUNTIME-NEXT:    br label [[TMP9]]59; RUNTIME:       9:60; RUNTIME-NEXT:    [[TMP13:%.*]] = phi ptr [ [[TMP8]], [[TMP4]] ], [ [[MYALLOCA]], [[TMP7]] ]61; RUNTIME-NEXT:    store ptr [[TMP13]], ptr [[ASAN_LOCAL_STACK_BASE]], align 862; RUNTIME-NEXT:    [[TMP12:%.*]] = getelementptr i8, ptr [[TMP13]], i64 3263; RUNTIME-NEXT:    store i64 1102416563, ptr [[TMP13]], align 864; RUNTIME-NEXT:    [[TMP15:%.*]] = getelementptr i8, ptr [[TMP13]], i64 865; RUNTIME-NEXT:    store i64 ptrtoint (ptr @___asan_gen_stack to i64), ptr [[TMP15]], align 866; RUNTIME-NEXT:    [[TMP17:%.*]] = getelementptr i8, ptr [[TMP13]], i64 1667; RUNTIME-NEXT:    store i64 ptrtoint (ptr @Simple to i64), ptr [[TMP17]], align 868; RUNTIME-NEXT:    [[TMP10:%.*]] = ptrtoint ptr [[TMP13]] to i6469; RUNTIME-NEXT:    [[TMP18:%.*]] = lshr i64 [[TMP10]], 370; RUNTIME-NEXT:    [[TMP19:%.*]] = add i64 [[TMP18]], 214745088071; RUNTIME-NEXT:    [[TMP20:%.*]] = add i64 [[TMP19]], 072; RUNTIME-NEXT:    [[TMP21:%.*]] = inttoptr i64 [[TMP20]] to ptr73; RUNTIME-NEXT:    store i64 -868083113472691727, ptr [[TMP21]], align 174; RUNTIME-NEXT:    call void @Foo(ptr [[TMP12]])75; RUNTIME-NEXT:    store i64 1172321806, ptr [[TMP13]], align 876; RUNTIME-NEXT:    [[TMP22:%.*]] = icmp ne i64 [[TMP5]], 077; RUNTIME-NEXT:    br i1 [[TMP22]], label [[TMP23:%.*]], label [[TMP30:%.*]]78; RUNTIME:       20:79; RUNTIME-NEXT:    [[TMP24:%.*]] = add i64 [[TMP19]], 080; RUNTIME-NEXT:    [[TMP25:%.*]] = inttoptr i64 [[TMP24]] to ptr81; RUNTIME-NEXT:    store i64 -723401728380766731, ptr [[TMP25]], align 182; RUNTIME-NEXT:    [[TMP27:%.*]] = getelementptr i8, ptr [[TMP8]], i64 5683; RUNTIME-NEXT:    [[TMP28:%.*]] = load i64, ptr [[TMP27]], align 884; RUNTIME-NEXT:    [[TMP29:%.*]] = inttoptr i64 [[TMP28]] to ptr85; RUNTIME-NEXT:    store i8 0, ptr [[TMP29]], align 186; RUNTIME-NEXT:    br label [[TMP33:%.*]]87; RUNTIME:       26:88; RUNTIME-NEXT:    [[TMP31:%.*]] = add i64 [[TMP19]], 089; RUNTIME-NEXT:    [[TMP32:%.*]] = inttoptr i64 [[TMP31]] to ptr90; RUNTIME-NEXT:    store i64 0, ptr [[TMP32]], align 191; RUNTIME-NEXT:    br label [[TMP33]]92; RUNTIME:       29:93; RUNTIME-NEXT:    ret void94;95; ALWAYS-LABEL: @Simple(96; ALWAYS-NEXT:  entry:97; ALWAYS-NEXT:    [[ASAN_LOCAL_STACK_BASE:%.*]] = alloca i64, align 898; ALWAYS-NEXT:    [[TMP0:%.*]] = call i64 @__asan_stack_malloc_always_0(i64 64)99; ALWAYS-NEXT:    [[TMP3:%.*]] = inttoptr i64 [[TMP0]] to ptr100; ALWAYS-NEXT:    [[TMP1:%.*]] = icmp eq i64 [[TMP0]], 0101; ALWAYS-NEXT:    br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP4:%.*]]102; ALWAYS:       3:103; ALWAYS-NEXT:    [[MYALLOCA:%.*]] = alloca i8, i64 64, align 32104; ALWAYS-NEXT:    br label [[TMP4]]105; ALWAYS:       4:106; ALWAYS-NEXT:    [[TMP8:%.*]] = phi ptr [ [[TMP3]], [[ENTRY:%.*]] ], [ [[MYALLOCA]], [[TMP2]] ]107; ALWAYS-NEXT:    store ptr [[TMP8]], ptr [[ASAN_LOCAL_STACK_BASE]], align 8108; ALWAYS-NEXT:    [[TMP7:%.*]] = getelementptr i8, ptr [[TMP8]], i64 32109; ALWAYS-NEXT:    store i64 1102416563, ptr [[TMP8]], align 8110; ALWAYS-NEXT:    [[TMP10:%.*]] = getelementptr i8, ptr [[TMP8]], i64 8111; ALWAYS-NEXT:    store i64 ptrtoint (ptr @___asan_gen_stack to i64), ptr [[TMP10]], align 8112; ALWAYS-NEXT:    [[TMP12:%.*]] = getelementptr i8, ptr [[TMP8]], i64 16113; ALWAYS-NEXT:    store i64 ptrtoint (ptr @Simple to i64), ptr [[TMP12]], align 8114; ALWAYS-NEXT:    [[TMP5:%.*]] = ptrtoint ptr [[TMP8]] to i64115; ALWAYS-NEXT:    [[TMP13:%.*]] = lshr i64 [[TMP5]], 3116; ALWAYS-NEXT:    [[TMP14:%.*]] = add i64 [[TMP13]], 2147450880117; ALWAYS-NEXT:    [[TMP15:%.*]] = add i64 [[TMP14]], 0118; ALWAYS-NEXT:    [[TMP16:%.*]] = inttoptr i64 [[TMP15]] to ptr119; ALWAYS-NEXT:    store i64 -868083113472691727, ptr [[TMP16]], align 1120; ALWAYS-NEXT:    call void @Foo(ptr [[TMP7]])121; ALWAYS-NEXT:    store i64 1172321806, ptr [[TMP8]], align 8122; ALWAYS-NEXT:    [[TMP17:%.*]] = icmp ne i64 [[TMP0]], 0123; ALWAYS-NEXT:    br i1 [[TMP17]], label [[TMP18:%.*]], label [[TMP25:%.*]]124; ALWAYS:       15:125; ALWAYS-NEXT:    [[TMP19:%.*]] = add i64 [[TMP14]], 0126; ALWAYS-NEXT:    [[TMP20:%.*]] = inttoptr i64 [[TMP19]] to ptr127; ALWAYS-NEXT:    store i64 -723401728380766731, ptr [[TMP20]], align 1128; ALWAYS-NEXT:    [[TMP22:%.*]] = getelementptr i8, ptr [[TMP3]], i64 56129; ALWAYS-NEXT:    [[TMP23:%.*]] = load i64, ptr [[TMP22]], align 8130; ALWAYS-NEXT:    [[TMP24:%.*]] = inttoptr i64 [[TMP23]] to ptr131; ALWAYS-NEXT:    store i8 0, ptr [[TMP24]], align 1132; ALWAYS-NEXT:    br label [[TMP28:%.*]]133; ALWAYS:       21:134; ALWAYS-NEXT:    [[TMP26:%.*]] = add i64 [[TMP14]], 0135; ALWAYS-NEXT:    [[TMP27:%.*]] = inttoptr i64 [[TMP26]] to ptr136; ALWAYS-NEXT:    store i64 0, ptr [[TMP27]], align 1137; ALWAYS-NEXT:    br label [[TMP28]]138; ALWAYS:       24:139; ALWAYS-NEXT:    ret void140;141entry:142  %x = alloca i8, align 16143  call void @Foo(ptr %x)144  ret void145}146 147define void @Huge() uwtable sanitize_address {148; CHECK-LABEL: @Huge(149; CHECK-NEXT:  entry:150; CHECK-NEXT:    [[MYALLOCA:%.*]] = alloca i8, i64 100288, align 32151; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i8, ptr [[MYALLOCA]], i64 32152; CHECK-NEXT:    store i64 1102416563, ptr [[MYALLOCA]], align 8153; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr i8, ptr [[MYALLOCA]], i64 8154; CHECK-NEXT:    store i64 ptrtoint (ptr @___asan_gen_stack.1 to i64), ptr [[TMP5]], align 8155; CHECK-NEXT:    [[TMP7:%.*]] = getelementptr i8, ptr [[MYALLOCA]], i64 16156; CHECK-NEXT:    store i64 ptrtoint (ptr @Huge to i64), ptr [[TMP7]], align 8157; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[MYALLOCA]] to i64158; CHECK-NEXT:    [[TMP8:%.*]] = lshr i64 [[TMP0]], 3159; CHECK-NEXT:    [[TMP9:%.*]] = add i64 [[TMP8]], 2147450880160; CHECK-NEXT:    [[TMP10:%.*]] = add i64 [[TMP9]], 0161; CHECK-NEXT:    [[TMP11:%.*]] = inttoptr i64 [[TMP10]] to ptr162; CHECK-NEXT:    store i32 -235802127, ptr [[TMP11]], align 1163; CHECK-NEXT:    [[TMP12:%.*]] = add i64 [[TMP9]], 12504164; CHECK-NEXT:    [[TMP13:%.*]] = inttoptr i64 [[TMP12]] to ptr165; CHECK-NEXT:    store i64 -868082074056920077, ptr [[TMP13]], align 1166; CHECK-NEXT:    [[TMP14:%.*]] = add i64 [[TMP9]], 12512167; CHECK-NEXT:    [[TMP15:%.*]] = inttoptr i64 [[TMP14]] to ptr168; CHECK-NEXT:    store i64 -868082074056920077, ptr [[TMP15]], align 1169; CHECK-NEXT:    [[TMP16:%.*]] = add i64 [[TMP9]], 12520170; CHECK-NEXT:    [[TMP17:%.*]] = inttoptr i64 [[TMP16]] to ptr171; CHECK-NEXT:    store i64 -868082074056920077, ptr [[TMP17]], align 1172; CHECK-NEXT:    [[TMP18:%.*]] = add i64 [[TMP9]], 12528173; CHECK-NEXT:    [[TMP19:%.*]] = inttoptr i64 [[TMP18]] to ptr174; CHECK-NEXT:    store i64 -868082074056920077, ptr [[TMP19]], align 1175; CHECK-NEXT:    call void @Foo(ptr [[TMP2]])176; CHECK-NEXT:    store i64 1172321806, ptr [[MYALLOCA]], align 8177; CHECK-NEXT:    [[TMP20:%.*]] = add i64 [[TMP9]], 0178; CHECK-NEXT:    [[TMP21:%.*]] = inttoptr i64 [[TMP20]] to ptr179; CHECK-NEXT:    store i32 0, ptr [[TMP21]], align 1180; CHECK-NEXT:    [[TMP22:%.*]] = add i64 [[TMP9]], 12504181; CHECK-NEXT:    [[TMP23:%.*]] = inttoptr i64 [[TMP22]] to ptr182; CHECK-NEXT:    store i64 0, ptr [[TMP23]], align 1183; CHECK-NEXT:    [[TMP24:%.*]] = add i64 [[TMP9]], 12512184; CHECK-NEXT:    [[TMP25:%.*]] = inttoptr i64 [[TMP24]] to ptr185; CHECK-NEXT:    store i64 0, ptr [[TMP25]], align 1186; CHECK-NEXT:    [[TMP26:%.*]] = add i64 [[TMP9]], 12520187; CHECK-NEXT:    [[TMP27:%.*]] = inttoptr i64 [[TMP26]] to ptr188; CHECK-NEXT:    store i64 0, ptr [[TMP27]], align 1189; CHECK-NEXT:    [[TMP28:%.*]] = add i64 [[TMP9]], 12528190; CHECK-NEXT:    [[TMP29:%.*]] = inttoptr i64 [[TMP28]] to ptr191; CHECK-NEXT:    store i64 0, ptr [[TMP29]], align 1192; CHECK-NEXT:    ret void193;194entry:195  %x = alloca [100000 x i8], align 16196  call void @Foo(ptr %x)197  ret void198}199