[llvm] r222997 - [msan] Add compile-time checks for missing origins.
Sergey Matveev
earthdok at google.com
Mon Dec 1 09:06:34 PST 2014
NFC? Can't this potentially cause new compilation failures?
On Mon, Dec 1, 2014 at 12:53 PM, Evgeniy Stepanov <eugeni.stepanov at gmail.com
> wrote:
> Author: eugenis
> Date: Mon Dec 1 03:53:51 2014
> New Revision: 222997
>
> URL: http://llvm.org/viewvc/llvm-project?rev=222997&view=rev
> Log:
> [msan] Add compile-time checks for missing origins.
>
> This change makes MemorySanitizer instrumentation a bit more strict
> about instructions that have no origin id assigned to them.
>
> This would have caught the bug that was fixed in r222918.
>
> No functional change.
>
> 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=222997&r1=222996&r2=222997&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp Mon Dec
> 1 03:53:51 2014
> @@ -921,6 +921,8 @@ struct MemorySanitizerVisitor : public I
> Value *OriginPtr =
> getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
> setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
> + } else {
> + setOrigin(A, getCleanOrigin());
> }
> }
> ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
> @@ -940,15 +942,13 @@ struct MemorySanitizerVisitor : public I
> /// \brief Get the origin for a value.
> Value *getOrigin(Value *V) {
> if (!MS.TrackOrigins) return nullptr;
> - 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();
> + 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;
> }
>
> /// \brief Get the origin for i-th argument of the instruction I.
> @@ -1088,6 +1088,7 @@ struct MemorySanitizerVisitor : public I
> IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
>
> setShadow(&I, getCleanShadow(&I));
> + setOrigin(&I, getCleanOrigin());
> }
>
> void visitAtomicRMWInst(AtomicRMWInst &I) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141201/d16adcd4/attachment.html>
More information about the llvm-commits
mailing list