[llvm] r223211 - Revert r222997. The newly added compile-time checks are finding missing origins, testcase is being reduced and a PR will be posted shortly.

Nick Lewycky nicholas at mxc.ca
Tue Dec 2 21:47:00 PST 2014


Author: nicholas
Date: Tue Dec  2 23:47:00 2014
New Revision: 223211

URL: http://llvm.org/viewvc/llvm-project?rev=223211&view=rev
Log:
Revert r222997. The newly added compile-time checks are finding missing origins, testcase is being reduced and a PR will be posted shortly.


Modified:
    llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=223211&r1=223210&r2=223211&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp Tue Dec  2 23:47:00 2014
@@ -921,8 +921,6 @@ struct MemorySanitizerVisitor : public I
             Value *OriginPtr =
                 getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
             setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
-          } else {
-            setOrigin(A, getCleanOrigin());
           }
         }
         ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
@@ -942,13 +940,15 @@ struct MemorySanitizerVisitor : public I
   /// \brief Get the origin for a value.
   Value *getOrigin(Value *V) {
     if (!MS.TrackOrigins) return nullptr;
-    if (!PropagateShadow) return getCleanOrigin();
-    if (isa<Constant>(V)) return getCleanOrigin();
-    assert((isa<Instruction>(V) || isa<Argument>(V)) &&
-           "Unexpected value type in getOrigin()");
-    Value *Origin = OriginMap[V];
-    assert(Origin && "Missing origin");
-    return Origin;
+    if (isa<Instruction>(V) || isa<Argument>(V)) {
+      Value *Origin = OriginMap[V];
+      if (!Origin) {
+        DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n");
+        Origin = getCleanOrigin();
+      }
+      return Origin;
+    }
+    return getCleanOrigin();
   }
 
   /// \brief Get the origin for i-th argument of the instruction I.
@@ -1088,7 +1088,6 @@ struct MemorySanitizerVisitor : public I
     IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
 
     setShadow(&I, getCleanShadow(&I));
-    setOrigin(&I, getCleanOrigin());
   }
 
   void visitAtomicRMWInst(AtomicRMWInst &I) {





More information about the llvm-commits mailing list