aboutsummaryrefslogtreecommitdiff
path: root/test/Instrumentation
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-11-29 14:25:47 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-11-29 14:25:47 +0000
commit84af05e1ba3a97d98b76929df858edc7b8b0d252 (patch)
treed2dc56e904161e98cb77c44ab9f01898ffa2d36d /test/Instrumentation
parent3a10b49781afcf0ea445d69dfc6949335269f231 (diff)
[msan] Propagate shadow through (x<0) and (x>=0) comparisons.
This is a special case of signed relational comparison where result only depends on the sign of x. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Instrumentation')
-rw-r--r--test/Instrumentation/MemorySanitizer/msan_basic.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/Instrumentation/MemorySanitizer/msan_basic.ll b/test/Instrumentation/MemorySanitizer/msan_basic.ll
index 2346d75f8e..8d729d6d41 100644
--- a/test/Instrumentation/MemorySanitizer/msan_basic.ll
+++ b/test/Instrumentation/MemorySanitizer/msan_basic.ll
@@ -235,6 +235,53 @@ entry:
; CHECK: }
+; Check that we propagate shadow for x<0, x>=0, etc (i.e. sign bit tests)
+
+define zeroext i1 @ICmpSLT(i32 %x) nounwind uwtable readnone {
+ %1 = icmp slt i32 %x, 0
+ ret i1 %1
+}
+
+; CHECK: define zeroext i1 @ICmpSLT
+; CHECK: icmp slt
+; CHECK: icmp slt
+; CHECK-NOT: br
+; CHECK: }
+
+define zeroext i1 @ICmpSGE(i32 %x) nounwind uwtable readnone {
+ %1 = icmp sge i32 %x, 0
+ ret i1 %1
+}
+
+; CHECK: define zeroext i1 @ICmpSGE
+; CHECK: icmp slt
+; CHECK: icmp sge
+; CHECK-NOT: br
+; CHECK: }
+
+define zeroext i1 @ICmpSGT(i32 %x) nounwind uwtable readnone {
+ %1 = icmp sgt i32 0, %x
+ ret i1 %1
+}
+
+; CHECK: define zeroext i1 @ICmpSGT
+; CHECK: icmp slt
+; CHECK: icmp sgt
+; CHECK-NOT: br
+; CHECK: }
+
+define zeroext i1 @ICmpSLE(i32 %x) nounwind uwtable readnone {
+ %1 = icmp sle i32 0, %x
+ ret i1 %1
+}
+
+; CHECK: define zeroext i1 @ICmpSLE
+; CHECK: icmp slt
+; CHECK: icmp sle
+; CHECK-NOT: br
+; CHECK: }
+
+
; Check that loads from shadow have the same aligment as the original loads.
define i32 @ShadowLoadAlignmentLarge() nounwind uwtable {