Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/Transforms/NaCl/expand-alloca.ll

Issue 29743003: Add passes for applying SFI sandboxing at the LLVM IR level Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry upload Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 ; RUN: opt %s -expand-allocas -S | FileCheck %s
2
3 declare void @foo()
4 declare void @external_func(i8*, i8*)
5
6
7 ; CHECK: @__sfi_stack = internal global i32 1073741824
8
9 define void @alloca() {
10 call void @foo()
11 %var1 = alloca i8, i32 10
12 %var2 = alloca i8, i32 20
13 call void @external_func(i8* %var1, i8* %var2)
14 ret void
15 }
16 ; CHECK: define void @alloca()
17 ; CHECK-NEXT: %frame_top = load i32* @__sfi_stack{{$}}
18 ; CHECK-NEXT: %frame_bottom = add i32 %frame_top, -30
19 ; CHECK-NEXT: store i32 %frame_bottom, i32* @__sfi_stack
20 ; CHECK-NEXT: call void @foo()
21 ; CHECK-NEXT: %1 = add i32 %frame_top, -10
22 ; CHECK-NEXT: %var1 = inttoptr i32 %1 to i8*
23 ; CHECK-NEXT: %2 = add i32 %frame_top, -30
24 ; CHECK-NEXT: %var2 = inttoptr i32 %2 to i8*
25 ; CHECK-NEXT: call void @external_func(i8* %var1, i8* %var2)
26 ; CHECK-NEXT: store i32 %frame_top, i32* @__sfi_stack
27 ; CHECK-NEXT: ret void
28
29
30 ; Check that all functions refer to the same __sfi_stack variable.
31 define void @second_function() {
32 alloca i8, i32 10
33 ret void
34 }
35 ; CHECK: define void @second_function()
36 ; CHECK-NEXT: %frame_top = load i32* @__sfi_stack{{$}}
37
38
39 ; If a function contains no allocas, it doesn't need to modify and
40 ; restore __sfi_stack.
41 define void @func_without_alloca() {
42 ret void
43 }
44 ; CHECK: define void @func_without_alloca() {
45 ; CHECK-NEXT: ret void
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/allocate-data-segment-size.ll ('k') | test/Transforms/NaCl/flatten-globals.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698