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

Unified Diff: tests_lit/asan_tests/multiple_returns.ll

Issue 2128643002: Fixed instruction corruption bug for multiple returns. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 5 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
« src/IceASanInstrumentation.cpp ('K') | « src/IceASanInstrumentation.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/asan_tests/multiple_returns.ll
diff --git a/tests_lit/asan_tests/multiple_returns.ll b/tests_lit/asan_tests/multiple_returns.ll
new file mode 100644
index 0000000000000000000000000000000000000000..5575c4bc06f50256c8fda01c7f512a153b6d9b57
--- /dev/null
+++ b/tests_lit/asan_tests/multiple_returns.ll
@@ -0,0 +1,42 @@
+; Check that functions with multiple returns are correctly instrumented
+
+; REQUIRES: allow_dump
+
+; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \
+; RUN: | FileCheck --check-prefix=DUMP %s
+
+define internal void @ret_twice(i32 %condarg) {
+ %local1 = alloca i8, i32 4, align 4
+ %local2 = alloca i8, i32 4, align 4
+ %cond = icmp ne i32 %condarg, 0
+ br i1 %cond, label %yes, label %no
+yes:
+ ret void
+no:
+ ret void
+}
+
+; DUMP-LABEL: ================ Instrumented CFG ================
+; DUMP-NEXT: define internal void @ret_twice(i32 %condarg) {
+; DUMP-NEXT: __0:
+; DUMP-NEXT: %local1 = alloca i8, i32 64, align 8
+; DUMP-NEXT: %local2 = alloca i8, i32 64, align 8
+; DUMP-NEXT: %__$rz2 = alloca i8, i32 32, align 8
+; DUMP-NEXT: call void @__asan_poison(i32 %__$rz2, i32 32)
+; DUMP-NEXT: %__$rz0 = add i32 %local1, 4
+; DUMP-NEXT: call void @__asan_poison(i32 %__$rz0, i32 60)
+; DUMP-NEXT: %__$rz1 = add i32 %local2, 4
+; DUMP-NEXT: call void @__asan_poison(i32 %__$rz1, i32 60)
+; DUMP-NEXT: %cond = icmp ne i32 %condarg, 0
+; DUMP-NEXT: br i1 %cond, label %yes, label %no
+; DUMP-NEXT: yes:
+; DUMP-NEXT: call void @__asan_unpoison(i32 %__$rz0, i32 60)
+; DUMP-NEXT: call void @__asan_unpoison(i32 %__$rz1, i32 60)
+; DUMP-NEXT: call void @__asan_unpoison(i32 %__$rz2, i32 32)
+; DUMP-NEXT: ret void
+; DUMP-NEXT: no:
+; DUMP-NEXT: call void @__asan_unpoison(i32 %__$rz0, i32 60)
+; DUMP-NEXT: call void @__asan_unpoison(i32 %__$rz1, i32 60)
+; DUMP-NEXT: call void @__asan_unpoison(i32 %__$rz2, i32 32)
+; DUMP-NEXT: ret void
+; DUMP-NEXT: }
« src/IceASanInstrumentation.cpp ('K') | « src/IceASanInstrumentation.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698