Path: blob/main/contrib/llvm-project/llvm/lib/Analysis/DomConditionCache.cpp
35232 views
//===- DomConditionCache.cpp ----------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/Analysis/DomConditionCache.h"9#include "llvm/Analysis/ValueTracking.h"10using namespace llvm;1112static void findAffectedValues(Value *Cond,13SmallVectorImpl<Value *> &Affected) {14auto InsertAffected = [&Affected](Value *V) { Affected.push_back(V); };15findValuesAffectedByCondition(Cond, /*IsAssume=*/false, InsertAffected);16}1718void DomConditionCache::registerBranch(BranchInst *BI) {19assert(BI->isConditional() && "Must be conditional branch");20SmallVector<Value *, 16> Affected;21findAffectedValues(BI->getCondition(), Affected);22for (Value *V : Affected) {23auto &AV = AffectedValues[V];24if (!is_contained(AV, BI))25AV.push_back(BI);26}27}282930