[PATCH] Pass the non-zero label to __dfsan_nonzero_label

Lorenzo Martignoni martignlo at google.com
Tue Dec 3 05:50:09 PST 2013


Hi pcc,

The intent is to reuse this functionality as is, to provide a mechanism to track the statements with operands with non-zero labels. 

http://llvm-reviews.chandlerc.com/D2317

Files:
  lib/Transforms/Instrumentation/DataFlowSanitizer.cpp

Index: lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -112,8 +112,8 @@
              "storing in memory."),
     cl::Hidden, cl::init(false));
 
-static cl::opt<bool> ClDebugNonzeroLabels(
-    "dfsan-debug-nonzero-labels",
+static cl::opt<bool> ClLogNonzeroLabels(
+    "dfsan-log-nonzero-labels",
     cl::desc("Insert calls to __dfsan_nonzero_label on observing a parameter, "
              "load or return with a nonzero label"),
     cl::Hidden);
@@ -719,11 +719,11 @@
       }
     }
 
-    // -dfsan-debug-nonzero-labels will split the CFG in all kinds of crazy
+    // -dfsan-log-nonzero-labels will split the CFG in all kinds of crazy
     // places (i.e. instructions in basic blocks we haven't even begun visiting
     // yet).  To make our life easier, do this work in a pass after the main
     // instrumentation.
-    if (ClDebugNonzeroLabels) {
+    if (ClLogNonzeroLabels) {
       for (DenseSet<Value *>::iterator i = DFSF.NonZeroChecks.begin(),
                                        e = DFSF.NonZeroChecks.end();
            i != e; ++i) {
@@ -740,7 +740,7 @@
         BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
             NeInst, /*Unreachable=*/ false, ColdCallWeights));
         IRBuilder<> ThenIRB(BI);
-        ThenIRB.CreateCall(DFSF.DFS.DFSanNonzeroLabelFn);
+        ThenIRB.CreateCall(DFSF.DFS.DFSanNonzeroLabelFn, *i);
       }
     }
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2317.1.patch
Type: text/x-patch
Size: 1583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131203/a4650d6a/attachment.bin>


More information about the llvm-commits mailing list