]> granicus.if.org Git - llvm/commitdiff
[MSAN] Add unary FNeg visitor to the MemorySanitizer
authorCameron McInally <cameron.mcinally@nyu.edu>
Wed, 5 Jun 2019 22:37:05 +0000 (22:37 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Wed, 5 Jun 2019 22:37:05 +0000 (22:37 +0000)
Differential Revision: https://reviews.llvm.org/D62909

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362664 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/MemorySanitizer.cpp
test/Instrumentation/MemorySanitizer/msan_basic.ll

index 87f73ff24c4d8d5b7cddd64d739da2eb60770044..7c261775003c20eb4e2e44c66f8f4bb342d7263f 100644 (file)
@@ -2110,6 +2110,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
     SC.Done(&I);
   }
 
+  void visitFNeg(UnaryOperator &I) { handleShadowOr(I); }
+
   // Handle multiplication by constant.
   //
   // Handle a special case of multiplication by constant that may have one or
index a42730de012461812de1119e5346d312ba6011e0..499de14aea39a9be331a5885356a9778bd79d5d9 100644 (file)
@@ -438,6 +438,22 @@ entry:
 ; CHECK: store i32 %[[SC]], i32* {{.*}}@__msan_retval_tls
 ; CHECK: ret float
 
+; Check that fneg simply propagates shadow.
+
+define float @FNeg(float %a) nounwind uwtable readnone sanitize_memory {
+entry:
+  %c = fneg float %a
+  ret float %c
+}
+
+; CHECK-LABEL: @FNeg
+; CHECK: %[[SA:.*]] = load i32,{{.*}}@__msan_param_tls
+; CHECK-ORIGINS: %[[SB:.*]] = load i32,{{.*}}@__msan_param_origin_tls
+; CHECK: = fneg float
+; CHECK: store i32 %[[SA]], i32* {{.*}}@__msan_retval_tls
+; CHECK-ORIGINS: store i32{{.*}}@__msan_retval_origin_tls
+; CHECK: ret float
+
 ; Check that we propagate shadow for x<0, x>=0, etc (i.e. sign bit tests)
 
 define zeroext i1 @ICmpSLTZero(i32 %x) nounwind uwtable readnone sanitize_memory {