[PATCH] D62815: Add UnaryOperator visitor to DataFlowSanitizer

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 09:39:35 PDT 2019


cameron.mcinally created this revision.
cameron.mcinally added reviewers: spatel, craig.topper, andrew.w.kaylor, arsenm, kpn, pcc, Eugene.Zelenko, samsonov.
Herald added subscribers: llvm-commits, hiraditya, wdng.
Herald added a project: LLVM.

I'm not familiar with this sanitizer at all, so I would appreciate a thorough review...


Repository:
  rL LLVM

https://reviews.llvm.org/D62815

Files:
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/test/Instrumentation/DataFlowSanitizer/arith.ll


Index: llvm/test/Instrumentation/DataFlowSanitizer/arith.ll
===================================================================
--- llvm/test/Instrumentation/DataFlowSanitizer/arith.ll
+++ llvm/test/Instrumentation/DataFlowSanitizer/arith.ll
@@ -62,3 +62,13 @@
   %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
+}
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -437,6 +437,7 @@
   }
 
   void visitOperandShadowInst(Instruction &I);
+  void visitUnaryOperator(UnaryOperator &UO);
   void visitBinaryOperator(BinaryOperator &BO);
   void visitCastInst(CastInst &CI);
   void visitCmpInst(CmpInst &CI);
@@ -1398,6 +1399,10 @@
   DFSF.storeShadow(SI.getPointerOperand(), Size, Align, Shadow, &SI);
 }
 
+void DFSanVisitor::visitUnaryOperator(UnaryOperator &UO) {
+  visitOperandShadowInst(UO);
+}
+
 void DFSanVisitor::visitBinaryOperator(BinaryOperator &BO) {
   visitOperandShadowInst(BO);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62815.202740.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190603/527a4819/attachment.bin>


More information about the llvm-commits mailing list