Skip to content

Commit

Permalink
[MSAN] Add unary FNeg visitor to the MemorySanitizer
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D62909

llvm-svn: 362664
  • Loading branch information
mcinally committed Jun 5, 2019
1 parent 6c5d5ce commit c72fbe5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c72fbe5

Please sign in to comment.