1 //===-- GuardUtils.h - Utils for work with guards ---------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
8 // Utils that are used to perform analyzes related to guards and their
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_ANALYSIS_GUARDUTILS_H
13 #define LLVM_ANALYSIS_GUARDUTILS_H
21 /// Returns true iff \p U has semantics of a guard expressed in a form of call
22 /// of llvm.experimental.guard intrinsic.
23 bool isGuard(const User
*U
);
25 /// Returns true iff \p U has semantics of a guard expressed in a form of a
26 /// widenable conditional branch to deopt block.
27 bool isGuardAsWidenableBranch(const User
*U
);
29 /// If U is widenable branch looking like:
31 /// %wc = call i1 @llvm.experimental.widenable.condition()
32 /// %branch_cond = and i1 %cond, %wc
33 /// br i1 %branch_cond, label %if_true_bb, label %if_false_bb ; <--- U
34 /// The function returns true, and the values %cond and %wc and blocks
35 /// %if_true_bb, if_false_bb are returned in
36 /// the parameters (Condition, WidenableCondition, IfTrueBB and IfFalseFF)
37 /// respectively. If \p U does not match this pattern, return false.
38 bool parseWidenableBranch(const User
*U
, Value
*&Condition
,
39 Value
*&WidenableCondition
, BasicBlock
*&IfTrueBB
,
40 BasicBlock
*&IfFalseBB
);
44 #endif // LLVM_ANALYSIS_GUARDUTILS_H