Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:42

0001 //===-- MakeGuardsExplicit.h - Turn guard intrinsics into guard branches --===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This pass lowers the @llvm.experimental.guard intrinsic to the new form of
0010 // guard represented as widenable explicit branch to the deopt block. The
0011 // difference between this pass and LowerGuardIntrinsic is that after this pass
0012 // the guard represented as intrinsic:
0013 //
0014 //   call void(i1, ...) @llvm.experimental.guard(i1 %old_cond) [ "deopt"() ]
0015 //
0016 // transforms to a guard represented as widenable explicit branch:
0017 //
0018 //   %widenable_cond = call i1 @llvm.experimental.widenable.condition()
0019 //   br i1 (%old_cond & %widenable_cond), label %guarded, label %deopt
0020 //
0021 // Here:
0022 //   - The semantics of @llvm.experimental.widenable.condition allows to replace
0023 //     %widenable_cond with the construction (%widenable_cond & %any_other_cond)
0024 //     without loss of correctness;
0025 //   - %guarded is the lower part of old guard intrinsic's parent block split by
0026 //     the intrinsic call;
0027 //   - %deopt is a block containing a sole call to @llvm.experimental.deoptimize
0028 //     intrinsic.
0029 //
0030 // Therefore, this branch preserves the property of widenability.
0031 //
0032 //===----------------------------------------------------------------------===//
0033 #ifndef LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
0034 #define LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
0035 
0036 #include "llvm/IR/PassManager.h"
0037 
0038 namespace llvm {
0039 
0040 struct MakeGuardsExplicitPass : public PassInfoMixin<MakeGuardsExplicitPass> {
0041   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0042 };
0043 
0044 } // namespace llvm
0045 
0046 #endif // LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H