[dfsan] Introduce further optimization to reduce the number of union queries.
Specifically, do not compute a union if it is statically known that one
shadow set subsumes the other.
llvm-svn: 213100
diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/union.ll b/llvm/test/Instrumentation/DataFlowSanitizer/union.ll
index 30162e7..2b31081 100644
--- a/llvm/test/Instrumentation/DataFlowSanitizer/union.ll
+++ b/llvm/test/Instrumentation/DataFlowSanitizer/union.ll
@@ -8,10 +8,10 @@
; CHECK-LABEL: @"dfs$f"
define void @f(i32 %x, i32 %y) {
- ; CHECK: __dfsan_union
+ ; CHECK: call{{.*}}__dfsan_union
%xay = add i32 %x, %y
store i32 %xay, i32* @a
- ; CHECK-NOT: __dfsan_union
+ ; CHECK-NOT: call{{.*}}__dfsan_union
%xmy = mul i32 %x, %y
store i32 %xmy, i32* @b
ret void
@@ -25,13 +25,13 @@
br i1 %p, label %l1, label %l2
l1:
- ; CHECK: __dfsan_union
+ ; CHECK: call{{.*}}__dfsan_union
%xay = add i32 %x, %y
store i32 %xay, i32* @a
br label %l3
l2:
- ; CHECK: __dfsan_union
+ ; CHECK: call{{.*}}__dfsan_union
%xmy = mul i32 %x, %y
store i32 %xmy, i32* @b
br label %l3
@@ -39,3 +39,14 @@
l3:
ret void
}
+
+; In this case, we know that the label for %xayax subsumes the label for %xay.
+
+; CHECK-LABEL: @"dfs$h"
+define i32 @h(i32 %x, i32 %y) {
+ ; CHECK: call{{.*}}__dfsan_union
+ %xay = add i32 %x, %y
+ ; CHECK-NOT: call{{.*}}__dfsan_union
+ %xayax = add i32 %xay, %x
+ ret i32 %xayax
+}