From 1dafaa87d9c3b25f53bd18cab18725dd1d76023e Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Wed, 29 Aug 2018 11:37:34 +0000 Subject: [NFC] Unify guards detection We have multiple places in code where we try to identify whether or not some instruction is a guard. This patch factors out this logic into a separate utility function which works uniformly in all places. Differential Revision: https://reviews.llvm.org/D51152 Reviewed By: fedor.sergeev llvm-svn: 340921 --- llvm/lib/Analysis/ValueTracking.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index a207a50..527673f 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -66,6 +66,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/KnownBits.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Transforms/Utils/GuardUtils.h" #include #include #include @@ -1902,8 +1903,7 @@ static bool isKnownNonNullFromDominatingCondition(const Value *V, BasicBlockEdge Edge(BI->getParent(), NonNullSuccessor); if (Edge.isSingleEdge() && DT->dominates(Edge, CtxI->getParent())) return true; - } else if (Pred == ICmpInst::ICMP_NE && - match(Curr, m_Intrinsic()) && + } else if (Pred == ICmpInst::ICMP_NE && isGuard(Curr) && DT->dominates(cast(Curr), CtxI)) { return true; } -- cgit v1.1