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

Unified Diff: tests_lit/asan_tests/scatteredallocas.ll

Issue 2194853003: Subzero: Implemented codegen for poisoning and unpoisoning stack redzones (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Added missing REQUIRES directive Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests_lit/asan_tests/multiple_returns.ll ('k') | tests_lit/llvm2ice_tests/fused-alloca.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/asan_tests/scatteredallocas.ll
diff --git a/tests_lit/asan_tests/scatteredallocas.ll b/tests_lit/asan_tests/scatteredallocas.ll
new file mode 100644
index 0000000000000000000000000000000000000000..5c4588cd04fdca12afcc26763921e563c48fa7c4
--- /dev/null
+++ b/tests_lit/asan_tests/scatteredallocas.ll
@@ -0,0 +1,63 @@
+; Test that static allocas throughout the entry block are instrumented correctly
+
+; REQUIRES: allow_dump
+
+; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \
+; RUN: -allow-externally-defined-symbols | FileCheck --check-prefix=DUMP %s
+
+declare external i32 @malloc(i32)
+declare external void @free(i32)
+
+define void @func() {
+ %a = alloca i8, i32 4, align 4
+ %m1 = call i32 @malloc(i32 42)
+ %b = alloca i8, i32 16, align 4
+ store i8 50, i8* %a, align 1
+ %c = alloca i8, i32 8, align 8
+ call void @free(i32 %m1)
+ %d = alloca i8, i32 12, align 4
+ ret void
+}
+
+; DUMP-LABEL: ================ Instrumented CFG ================
+; DUMP-NEXT: define void @func() {
+; DUMP-NEXT: __0:
+; DUMP-NEXT: %__$rz0 = alloca i8, i32 32, align 8
+; DUMP-NEXT: %a = alloca i8, i32 64, align 8
+; DUMP-NEXT: %b = alloca i8, i32 64, align 8
+; DUMP-NEXT: %c = alloca i8, i32 64, align 8
+; DUMP-NEXT: %d = alloca i8, i32 64, align 8
+; DUMP-NEXT: %shadowIndex = lshr i32 %__$rz0, 3
+; DUMP-NEXT: %firstShadowLoc = add i32 %shadowIndex, 536870912
+; DUMP-NEXT: %__8 = add i32 %firstShadowLoc, 0
+; DUMP-NEXT: store i32 -1, i32* %__8, align 1
+; DUMP-NEXT: %__9 = add i32 %firstShadowLoc, 4
+; DUMP-NEXT: store i32 -252, i32* %__9, align 1
+; DUMP-NEXT: %__10 = add i32 %firstShadowLoc, 8
+; DUMP-NEXT: store i32 -1, i32* %__10, align 1
+; DUMP-NEXT: %__11 = add i32 %firstShadowLoc, 12
+; DUMP-NEXT: store i32 -65536, i32* %__11, align 1
+; DUMP-NEXT: %__12 = add i32 %firstShadowLoc, 16
+; DUMP-NEXT: store i32 -1, i32* %__12, align 1
+; DUMP-NEXT: %__13 = add i32 %firstShadowLoc, 20
+; DUMP-NEXT: store i32 -256, i32* %__13, align 1
+; DUMP-NEXT: %__14 = add i32 %firstShadowLoc, 24
+; DUMP-NEXT: store i32 -1, i32* %__14, align 1
+; DUMP-NEXT: %__15 = add i32 %firstShadowLoc, 28
+; DUMP-NEXT: store i32 -64512, i32* %__15, align 1
+; DUMP-NEXT: %__16 = add i32 %firstShadowLoc, 32
+; DUMP-NEXT: store i32 -1, i32* %__16, align 1
+; DUMP-NEXT: %m1 = call i32 @__asan_malloc(i32 42)
+; DUMP-NEXT: store i8 50, i8* %a, align 1
+; DUMP-NEXT: call void @__asan_free(i32 %m1)
+; DUMP-NEXT: store i32 0, i32* %__8, align 1
+; DUMP-NEXT: store i32 0, i32* %__9, align 1
+; DUMP-NEXT: store i32 0, i32* %__10, align 1
+; DUMP-NEXT: store i32 0, i32* %__11, align 1
+; DUMP-NEXT: store i32 0, i32* %__12, align 1
+; DUMP-NEXT: store i32 0, i32* %__13, align 1
+; DUMP-NEXT: store i32 0, i32* %__14, align 1
+; DUMP-NEXT: store i32 0, i32* %__15, align 1
+; DUMP-NEXT: store i32 0, i32* %__16, align 1
+; DUMP-NEXT: ret void
+; DUMP-NEXT: }
« no previous file with comments | « tests_lit/asan_tests/multiple_returns.ll ('k') | tests_lit/llvm2ice_tests/fused-alloca.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698