LLVM 19.0.0git
Go to the documentation of this file.
1//===- DomConditionCache.cpp ----------------------------------------------===//
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
11using namespace llvm;
14 SmallVectorImpl<Value *> &Affected) {
15 auto InsertAffected = [&Affected](Value *V) { Affected.push_back(V); };
16 findValuesAffectedByCondition(Cond, /*IsAssume=*/false, InsertAffected);
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 }
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:586
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
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:1879
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.