From 8ba740816d0bbe5044d6728370f53801aa0ce277 Mon Sep 17 00:00:00 2001 From: Cameron McInally Date: Wed, 19 Jun 2019 15:11:41 +0000 Subject: [PATCH] [DFSan] Add UnaryOperator visitor to DataFlowSanitizer Differential Revision: https://reviews.llvm.org/D62815 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363814 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 5 +++++ test/Instrumentation/DataFlowSanitizer/arith.ll | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index a5776a47af7..2279c1bcb6a 100644 --- a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -437,6 +437,7 @@ public: } void visitOperandShadowInst(Instruction &I); + void visitUnaryOperator(UnaryOperator &UO); void visitBinaryOperator(BinaryOperator &BO); void visitCastInst(CastInst &CI); void visitCmpInst(CmpInst &CI); @@ -1398,6 +1399,10 @@ void DFSanVisitor::visitStoreInst(StoreInst &SI) { DFSF.storeShadow(SI.getPointerOperand(), Size, Align, Shadow, &SI); } +void DFSanVisitor::visitUnaryOperator(UnaryOperator &UO) { + visitOperandShadowInst(UO); +} + void DFSanVisitor::visitBinaryOperator(BinaryOperator &BO) { visitOperandShadowInst(BO); } diff --git a/test/Instrumentation/DataFlowSanitizer/arith.ll b/test/Instrumentation/DataFlowSanitizer/arith.ll index db33e452083..3ea78552e4f 100644 --- a/test/Instrumentation/DataFlowSanitizer/arith.ll +++ b/test/Instrumentation/DataFlowSanitizer/arith.ll @@ -62,3 +62,13 @@ define i8 @udiv(i8 %a, i8 %b) { %c = udiv i8 %a, %b ret i8 %c } + +define double @fneg(double %a) { + ; CHECK: @"dfs$fneg" + ; CHECK: load{{.*}}__dfsan_arg_tls + ; CHECK: fneg double + ; CHECK: store{{.*}}__dfsan_retval_tls + ; CHECK: ret double + %c = fneg double %a + ret double %c +} -- 2.11.0