Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Analysis / DomConditionCache.cpp
blob66bd15b47901d79b0e8d9683c70e3899e04572cb
1 //===- DomConditionCache.cpp ----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Analysis/DomConditionCache.h"
10 #include "llvm/Analysis/ValueTracking.h"
11 using namespace llvm;
13 static void findAffectedValues(Value *Cond,
14 SmallVectorImpl<Value *> &Affected) {
15 auto InsertAffected = [&Affected](Value *V) { Affected.push_back(V); };
16 findValuesAffectedByCondition(Cond, /*IsAssume=*/false, InsertAffected);
19 void DomConditionCache::registerBranch(BranchInst *BI) {
20 assert(BI->isConditional() && "Must be conditional branch");
21 SmallVector<Value *, 16> Affected;
22 findAffectedValues(BI->getCondition(), Affected);
23 for (Value *V : Affected) {
24 auto &AV = AffectedValues[V];
25 if (!is_contained(AV, BI))
26 AV.push_back(BI);