[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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340921 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Max Kazantsev
2018-08-29 11:37:34 +00:00
parent 3b08dd1f3f
commit 68de447e4f
9 changed files with 24 additions and 19 deletions
+2 -2
View File
@@ -34,6 +34,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/GuardUtils.h"
#include <cassert>
#include <cstdint>
#include <vector>
@@ -172,8 +173,7 @@ void AliasSet::addUnknownInst(Instruction *I, AliasAnalysis &AA) {
// Guards are marked as modifying memory for control flow modelling purposes,
// but don't actually modify any specific memory location.
using namespace PatternMatch;
bool MayWriteMemory = I->mayWriteToMemory() &&
!match(I, m_Intrinsic<Intrinsic::experimental_guard>()) &&
bool MayWriteMemory = I->mayWriteToMemory() && !isGuard(I) &&
!(I->use_empty() && match(I, m_Intrinsic<Intrinsic::invariant_start>()));
if (!MayWriteMemory) {
Alias = SetMayAlias;