Files
llvm-project/llvm/lib/Analysis/DomConditionCache.cpp
Alexis Engelke 94da4039cb [Analysis][NFC] Drop use of BranchInst (#186374)
Largely straight-forward replacement.
2026-03-13 13:42:19 +00:00

28 lines
1015 B
C++

//===- DomConditionCache.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/DomConditionCache.h"
#include "llvm/Analysis/ValueTracking.h"
using namespace llvm;
static void findAffectedValues(Value *Cond,
SmallVectorImpl<Value *> &Affected) {
auto InsertAffected = [&Affected](Value *V) { Affected.push_back(V); };
findValuesAffectedByCondition(Cond, /*IsAssume=*/false, InsertAffected);
}
void DomConditionCache::registerBranch(CondBrInst *BI) {
SmallVector<Value *, 16> Affected;
findAffectedValues(BI->getCondition(), Affected);
for (Value *V : Affected) {
auto &AV = AffectedValues[V];
if (!is_contained(AV, BI))
AV.push_back(BI);
}
}