File indexing completed on 2026-05-10 08:44:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYCFGOPTIONS_H
0017 #define LLVM_TRANSFORMS_UTILS_SIMPLIFYCFGOPTIONS_H
0018
0019 namespace llvm {
0020
0021 class AssumptionCache;
0022
0023 struct SimplifyCFGOptions {
0024 int BonusInstThreshold = 1;
0025 bool ForwardSwitchCondToPhi = false;
0026 bool ConvertSwitchRangeToICmp = false;
0027 bool ConvertSwitchToLookupTable = false;
0028 bool NeedCanonicalLoop = true;
0029 bool HoistCommonInsts = false;
0030 bool HoistLoadsStoresWithCondFaulting = false;
0031 bool SinkCommonInsts = false;
0032 bool SimplifyCondBranch = true;
0033 bool SpeculateBlocks = true;
0034 bool SpeculateUnpredictables = false;
0035
0036 AssumptionCache *AC = nullptr;
0037
0038
0039 SimplifyCFGOptions &bonusInstThreshold(int I) {
0040 BonusInstThreshold = I;
0041 return *this;
0042 }
0043 SimplifyCFGOptions &forwardSwitchCondToPhi(bool B) {
0044 ForwardSwitchCondToPhi = B;
0045 return *this;
0046 }
0047 SimplifyCFGOptions &convertSwitchRangeToICmp(bool B) {
0048 ConvertSwitchRangeToICmp = B;
0049 return *this;
0050 }
0051 SimplifyCFGOptions &convertSwitchToLookupTable(bool B) {
0052 ConvertSwitchToLookupTable = B;
0053 return *this;
0054 }
0055 SimplifyCFGOptions &needCanonicalLoops(bool B) {
0056 NeedCanonicalLoop = B;
0057 return *this;
0058 }
0059 SimplifyCFGOptions &hoistCommonInsts(bool B) {
0060 HoistCommonInsts = B;
0061 return *this;
0062 }
0063 SimplifyCFGOptions &hoistLoadsStoresWithCondFaulting(bool B) {
0064 HoistLoadsStoresWithCondFaulting = B;
0065 return *this;
0066 }
0067 SimplifyCFGOptions &sinkCommonInsts(bool B) {
0068 SinkCommonInsts = B;
0069 return *this;
0070 }
0071 SimplifyCFGOptions &setAssumptionCache(AssumptionCache *Cache) {
0072 AC = Cache;
0073 return *this;
0074 }
0075 SimplifyCFGOptions &setSimplifyCondBranch(bool B) {
0076 SimplifyCondBranch = B;
0077 return *this;
0078 }
0079
0080 SimplifyCFGOptions &speculateBlocks(bool B) {
0081 SpeculateBlocks = B;
0082 return *this;
0083 }
0084 SimplifyCFGOptions &speculateUnpredictables(bool B) {
0085 SpeculateUnpredictables = B;
0086 return *this;
0087 }
0088 };
0089
0090 }
0091
0092 #endif