Skip to content

Commit 5003126

Browse files
committed
SimplifyCFG: Add isLookupTable method
Check if the SwitchReplacement is a lookup table or not.
1 parent 5d67286 commit 5003126

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6466,6 +6466,9 @@ class SwitchReplacement {
64666466
/// Return the default value of the switch.
64676467
Constant *getDefaultValue();
64686468

6469+
/// Return true if the replacement is a lookup table.
6470+
bool isLookupTable();
6471+
64696472
private:
64706473
// Depending on the switch, there are different alternatives.
64716474
enum {
@@ -6753,6 +6756,8 @@ static bool isTypeLegalForLookupTable(Type *Ty, const TargetTransformInfo &TTI,
67536756

67546757
Constant *SwitchReplacement::getDefaultValue() { return DefaultValue; }
67556758

6759+
bool SwitchReplacement::isLookupTable() { return Kind == LookupTableKind; }
6760+
67566761
static bool isSwitchDense(uint64_t NumCases, uint64_t CaseRange) {
67576762
// 40% is the default density for building a jump table in optsize/minsize
67586763
// mode. See also TargetLoweringBase::isSuitableForJumpTable(), which this

0 commit comments

Comments
 (0)