[llvm] baa005c - [dfsan] Add a test case for phi
Jianzhou Zhao via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 13:30:23 PST 2020
Author: Jianzhou Zhao
Date: 2020-12-02T21:29:44Z
New Revision: baa005c96ce610e9ee91ef55a3a1b1eacd5a0a27
URL: https://github.com/llvm/llvm-project/commit/baa005c96ce610e9ee91ef55a3a1b1eacd5a0a27
DIFF: https://github.com/llvm/llvm-project/commit/baa005c96ce610e9ee91ef55a3a1b1eacd5a0a27.diff
LOG: [dfsan] Add a test case for phi
Added:
llvm/test/Instrumentation/DataFlowSanitizer/phi.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/phi.ll b/llvm/test/Instrumentation/DataFlowSanitizer/phi.ll
new file mode 100644
index 000000000000..08c457f3bfc7
--- /dev/null
+++ b/llvm/test/Instrumentation/DataFlowSanitizer/phi.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -dfsan -S | FileCheck %s
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define {i32, i32} @test({i32, i32} %a, i1 %c) {
+ ; CHECK: [[E0:%.*]] = load i16, i16* getelementptr inbounds ([64 x i16], [64 x i16]* @__dfsan_arg_tls, i64 0, i64 0), align 2
+ ; CHECK: [[E3:%.*]] = phi i16 [ [[E0]], %T ], [ [[E0]], %F ]
+ ; CHECK: store i16 [[E3]], i16* @__dfsan_retval_tls, align 2
+
+entry:
+ br i1 %c, label %T, label %F
+
+T:
+ %at = insertvalue {i32, i32} %a, i32 1, 0
+ br label %done
+
+F:
+ %af = insertvalue {i32, i32} %a, i32 1, 1
+ br label %done
+
+done:
+ %b = phi {i32, i32} [%at, %T], [%af, %F]
+ ret {i32, i32} %b
+}
More information about the llvm-commits
mailing list