• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; This test checks that non-instrumented allocas stay in the first basic block.
2; Only first-basic-block allocas are considered stack slots, and moving them
3; breaks debug info.
4
5; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -S | FileCheck %s
6; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s
7; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-instrument-dynamic-allocas -S | FileCheck %s
8; RUN: opt < %s -passes='asan-pipeline' -asan-instrument-dynamic-allocas -S | FileCheck %s
9
10target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
11target triple = "x86_64-apple-macosx10.10.0"
12
13define i32 @foo() sanitize_address {
14entry:
15  ; Won't be instrumented because of asan-skip-promotable-allocas.
16  %non_instrumented1 = alloca i32, align 4
17
18  ; Regular alloca, will get instrumented (forced by the ptrtoint below).
19  %instrumented = alloca i32, align 4
20
21  ; Won't be instrumented because of asan-skip-promotable-allocas.
22  %non_instrumented2 = alloca i32, align 4
23
24  br label %bb0
25
26bb0:
27  ; Won't be instrumented because of asan-skip-promotable-allocas.
28  %non_instrumented3 = alloca i32, align 4
29
30  %ptr = ptrtoint i32* %instrumented to i32
31  br label %bb1
32
33bb1:
34  ret i32 %ptr
35}
36
37; CHECK: entry:
38; CHECK: %non_instrumented1 = alloca i32, align 4
39; CHECK: %non_instrumented2 = alloca i32, align 4
40; CHECK: load i32, i32* @__asan_option_detect_stack_use_after_return
41; CHECK: bb0:
42; CHECK: %non_instrumented3 = alloca i32, align 4
43