LLVM 20.0.0git
DomConditionCache.cpp
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
8
11using namespace llvm;
12
14 SmallVectorImpl<Value *> &Affected) {
15 auto InsertAffected = [&Affected](Value *V) { Affected.push_back(V); };
16 findValuesAffectedByCondition(Cond, /*IsAssume=*/false, InsertAffected);
17}
18
20 assert(BI->isConditional() && "Must be conditional branch");
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);
27 }
28}
static void findAffectedValues(CallBase *CI, TargetTransformInfo *TTI, SmallVectorImpl< AssumptionCache::ResultElem > &Affected)
static void findAffectedValues(Value *Cond, SmallVectorImpl< Value * > &Affected)
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Conditional or Unconditional Branch instruction.
bool isConditional() const
Value * getCondition() const
void registerBranch(BranchInst *BI)
Add a branch condition to the cache.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
void push_back(const T &Elt)
Definition: SmallVector.h:413
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1903
void findValuesAffectedByCondition(Value *Cond, bool IsAssume, function_ref< void(Value *)> InsertAffected)
Call InsertAffected on all Values whose known bits / value may be affected by the condition Cond.