From 48b3c93735585243d5e0765b0a5f64a5340988cd Mon Sep 17 00:00:00 2001 From: Igor Laevsky Date: Tue, 20 Oct 2015 21:33:30 +0000 Subject: [PATCH] [MemorySanitizer] NFC. Do not use GET_INTRINSIC_MODREF_BEHAVIOR table. It is now possible to infer intrinsic modref behaviour purely from intrinsic attributes. This change will allow to completely remove GET_INTRINSIC_MODREF_BEHAVIOR table. Differential Revision: http://reviews.llvm.org/D13907 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250860 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/MemorySanitizer.cpp | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index ca801fb3280..b8c21e20ad9 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -1918,25 +1918,6 @@ struct MemorySanitizerVisitor : public InstVisitor { VAHelper->visitVACopyInst(I); } - enum IntrinsicKind { - IK_DoesNotAccessMemory, - IK_OnlyReadsMemory, - IK_WritesMemory - }; - - static IntrinsicKind getIntrinsicKind(Intrinsic::ID iid) { - const int FMRB_DoesNotAccessMemory = IK_DoesNotAccessMemory; - const int FMRB_OnlyReadsArgumentPointees = IK_OnlyReadsMemory; - const int FMRB_OnlyReadsMemory = IK_OnlyReadsMemory; - const int FMRB_OnlyAccessesArgumentPointees = IK_WritesMemory; - const int FMRB_UnknownModRefBehavior = IK_WritesMemory; -#define GET_INTRINSIC_MODREF_BEHAVIOR -#define FunctionModRefBehavior IntrinsicKind -#include "llvm/IR/Intrinsics.gen" -#undef FunctionModRefBehavior -#undef GET_INTRINSIC_MODREF_BEHAVIOR - } - /// \brief Handle vector store-like intrinsics. /// /// Instrument intrinsics that look like a simple SIMD store: writes memory, @@ -2036,17 +2017,11 @@ struct MemorySanitizerVisitor : public InstVisitor { if (NumArgOperands == 0) return false; - Intrinsic::ID iid = I.getIntrinsicID(); - IntrinsicKind IK = getIntrinsicKind(iid); - bool OnlyReadsMemory = IK == IK_OnlyReadsMemory; - bool WritesMemory = IK == IK_WritesMemory; - assert(!(OnlyReadsMemory && WritesMemory)); - if (NumArgOperands == 2 && I.getArgOperand(0)->getType()->isPointerTy() && I.getArgOperand(1)->getType()->isVectorTy() && I.getType()->isVoidTy() && - WritesMemory) { + !I.onlyReadsMemory()) { // This looks like a vector store. return handleVectorStoreIntrinsic(I); } @@ -2054,12 +2029,12 @@ struct MemorySanitizerVisitor : public InstVisitor { if (NumArgOperands == 1 && I.getArgOperand(0)->getType()->isPointerTy() && I.getType()->isVectorTy() && - OnlyReadsMemory) { + I.onlyReadsMemory()) { // This looks like a vector load. return handleVectorLoadIntrinsic(I); } - if (!OnlyReadsMemory && !WritesMemory) + if (I.doesNotAccessMemory()) if (maybeHandleSimpleNomemIntrinsic(I)) return true; -- 2.34.1