1 //===-- MakeGuardsExplicit.h - Turn guard intrinsics into guard branches --===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 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: 14 // 15 // call void(i1, ...) @llvm.experimental.guard(i1 %old_cond) [ "deopt"() ] 16 // 17 // transforms to a guard represented as widenable explicit branch: 18 // 19 // %widenable_cond = call i1 @llvm.experimental.widenable.condition() 20 // br i1 (%old_cond & %widenable_cond), label %guarded, label %deopt 21 // 22 // Here: 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 29 // intrinsic. 30 // 31 // Therefore, this branch preserves the property of widenability. 32 // 33 //===----------------------------------------------------------------------===// 34 #ifndef LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H 35 #define LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H 36 37 #include "llvm/IR/PassManager.h" 38 39 namespace llvm { 40 41 struct MakeGuardsExplicitPass : public PassInfoMixin<MakeGuardsExplicitPass> { 42 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 43 }; 44 45 } // namespace llvm 46 47 #endif //LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H 48