1 //===-- MakeGuardsExplicit.h - Turn guard intrinsics into guard branches --===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass lowers the @llvm.experimental.guard intrinsic to the new form of
11 // guard represented as widenable explicit branch to the deopt block. The
12 // difference between this pass and LowerGuardIntrinsic is that after this pass
13 // the guard represented as intrinsic:
15 // call void(i1, ...) @llvm.experimental.guard(i1 %old_cond) [ "deopt"() ]
17 // transforms to a guard represented as widenable explicit branch:
19 // %widenable_cond = call i1 @llvm.experimental.widenable.condition()
20 // br i1 (%old_cond & %widenable_cond), label %guarded, label %deopt
23 // - The semantics of @llvm.experimental.widenable.condition allows to replace
24 // %widenable_cond with the construction (%widenable_cond & %any_other_cond)
25 // without loss of correctness;
26 // - %guarded is the lower part of old guard intrinsic's parent block split by
27 // the intrinsic call;
28 // - %deopt is a block containing a sole call to @llvm.experimental.deoptimize
31 // Therefore, this branch preserves the property of widenability.
33 //===----------------------------------------------------------------------===//
34 #ifndef LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
35 #define LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
37 #include "llvm/IR/PassManager.h"
41 struct MakeGuardsExplicitPass : public PassInfoMixin<MakeGuardsExplicitPass> {
42 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
47 #endif //LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H