about summary refs log tree commit diff homepage
path: root/test/regression
diff options
context:
space:
mode:
authorJulian Büning <julian.buening@rwth-aachen.de>2019-05-30 21:47:29 +0200
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2020-06-25 16:30:10 +0100
commit537f4e1e2558aac56e0a5894aec848d7af0ec71e (patch)
treea1e0ed97b88be77e2caa8c899838b523a80ad494 /test/regression
parent6cba814e54ebb1eacebbe2ef07a102e9466272db (diff)
downloadklee-537f4e1e2558aac56e0a5894aec848d7af0ec71e.tar.gz
add known bitcast test for comparison
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/2019-05-30_known-bitcast-alias.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/regression/2019-05-30_known-bitcast-alias.ll b/test/regression/2019-05-30_known-bitcast-alias.ll
new file mode 100644
index 00000000..f72c62d8
--- /dev/null
+++ b/test/regression/2019-05-30_known-bitcast-alias.ll
@@ -0,0 +1,42 @@
+; RUN: %llvmas %s -o=%t.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee -exit-on-error-type=Abort -output-source -output-dir=%t.klee-out %t.bc
+
+@x = global i32 0, align 4
+
+define i32 @__foo() {
+entry:
+  %0 = load i32, i32* @x, align 4
+  %inc = add nsw i32 %0, 1
+  store i32 %inc, i32* @x, align 4
+  ret i32 1
+}
+
+@foo = alias i32 (...), bitcast (i32 ()* @__foo to i32 (...)*)
+@foo2 = alias i32 (...), i32 (...)* @foo
+@foo3 = alias i16 (...), bitcast (i32 (...)* @foo2 to i16 (...)*)
+
+define i32 @main() {
+entry:
+  %call1 = call i32 (...) @foo()
+  %call2 = call i32 (...) @foo2()
+  %call3 = call i16 (...) @foo3()
+  %load = load i32, i32* @x, align 4
+  %inc1 = add nsw i32 %load, %call1
+  %inc2 = add nsw i32 %inc1, %call2
+  %zext = zext i16 %call3 to i32
+  %inc3 = add nsw i32 %inc2, %zext
+  %cmp = icmp ne i32 %inc3, 6
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+  call void @klee_abort()
+  unreachable
+
+if.end:
+  ret i32 0
+}
+
+declare void @klee_abort() #1
+
+attributes #1 = { noreturn }