LLVM 23.0.0git
GuardUtils.h
Go to the documentation of this file.
1//===-- GuardUtils.h - Utils for work with guards ---------------*- C++ -*-===//
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// Utils that are used to perform transformations related to guards and their
9// conditions.
10//===----------------------------------------------------------------------===//
11
12#ifndef LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
13#define LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
14
16
17namespace llvm {
18
19class CondBrInst;
20class CallInst;
21class Function;
22class Value;
23
24/// Splits control flow at point of \p Guard, replacing it with explicit branch
25/// by the condition of guard's first argument. The taken branch then goes to
26/// the block that contains \p Guard's successors, and the non-taken branch
27/// goes to a newly-created deopt block that contains a sole call of the
28/// deoptimize function \p DeoptIntrinsic. If 'UseWC' is set, preserve the
29/// widenable nature of the guard by lowering to equivelent form. If not set,
30/// lower to a form without widenable semantics.
32 CallInst *Guard, bool UseWC);
33
34/// Given a branch we know is widenable (defined per Analysis/GuardUtils.h),
35/// widen it such that condition 'NewCond' is also known to hold on the taken
36/// path. Branch remains widenable after transform.
37LLVM_ABI void widenWidenableBranch(CondBrInst *WidenableBR, Value *NewCond);
38
39/// Given a branch we know is widenable (defined per Analysis/GuardUtils.h),
40/// *set* it's condition such that (only) 'Cond' is known to hold on the taken
41/// path and that the branch remains widenable after transform.
43
44} // llvm
45
46#endif // LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
#define LLVM_ABI
Definition Compiler.h:213
const SmallVectorImpl< MachineOperand > & Cond
This class represents a function call, abstracting a target machine's calling convention.
Conditional Branch instruction.
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard, bool UseWC)
Splits control flow at point of Guard, replacing it with explicit branch by the condition of guard's ...
LLVM_ABI void setWidenableBranchCond(CondBrInst *WidenableBR, Value *Cond)
Given a branch we know is widenable (defined per Analysis/GuardUtils.h), set it's condition such that...
LLVM_ABI void widenWidenableBranch(CondBrInst *WidenableBR, Value *NewCond)
Given a branch we know is widenable (defined per Analysis/GuardUtils.h), widen it such that condition...