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/Transforms/Scalar/EarlyCSE.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Scalar/EarlyCSE.cpp') diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 533d16e088c..d24ad0327f1 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -54,6 +54,7 @@ #include "llvm/Support/RecyclingAllocator.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Utils/GuardUtils.h" #include #include #include @@ -863,7 +864,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { continue; } - if (match(Inst, m_Intrinsic())) { + if (isGuard(Inst)) { if (auto *CondI = dyn_cast(cast(Inst)->getArgOperand(0))) { if (SimpleValue::canHandle(CondI)) { -- cgit v1.2.3