From: Evandro Menezes Date: Fri, 29 Mar 2019 17:28:11 +0000 (+0000) Subject: [CodeGen] Refactor the option for the maximum jump table size X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5ec07fa48629b81896dad57f14ba01871a737b6;p=llvm [CodeGen] Refactor the option for the maximum jump table size Refactor the option `max-jump-table-size` to default to the maximum representable number. Essentially, NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357280 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/TargetLowering.h b/include/llvm/CodeGen/TargetLowering.h index 1ec4035568c..cb1ae579738 100644 --- a/include/llvm/CodeGen/TargetLowering.h +++ b/include/llvm/CodeGen/TargetLowering.h @@ -956,9 +956,7 @@ public: const bool OptForSize = SI->getParent()->getParent()->optForSize(); const unsigned MinDensity = getMinimumJumpTableDensity(OptForSize); const unsigned MaxJumpTableSize = - OptForSize || getMaximumJumpTableSize() == 0 - ? UINT_MAX - : getMaximumJumpTableSize(); + OptForSize ? UINT_MAX : getMaximumJumpTableSize(); // Check whether a range of clusters is dense enough for a jump table. if (Range <= MaxJumpTableSize && (NumCases * 100 >= Range * MinDensity)) { diff --git a/lib/CodeGen/TargetLoweringBase.cpp b/lib/CodeGen/TargetLoweringBase.cpp index 41cf19f1761..312579fb14c 100644 --- a/lib/CodeGen/TargetLoweringBase.cpp +++ b/lib/CodeGen/TargetLoweringBase.cpp @@ -73,8 +73,8 @@ static cl::opt MinimumJumpTableEntries cl::desc("Set minimum number of entries to use a jump table.")); static cl::opt MaximumJumpTableSize - ("max-jump-table-size", cl::init(0), cl::Hidden, - cl::desc("Set maximum size of jump tables; zero for no limit.")); + ("max-jump-table-size", cl::init(UINT_MAX), cl::Hidden, + cl::desc("Set maximum size of jump tables.")); /// Minimum jump table density for normal functions. static cl::opt diff --git a/lib/Target/AArch64/AArch64ISelLowering.cpp b/lib/Target/AArch64/AArch64ISelLowering.cpp index 3d72949f1c6..ff6d30bbb10 100644 --- a/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -613,9 +613,9 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM, setPrefLoopAlignment(STI.getPrefLoopAlignment()); // Only change the limit for entries in a jump table if specified by - // the subtarget, but not at the command line. + // the sub target, but not at the command line. unsigned MaxJT = STI.getMaximumJumpTableSize(); - if (MaxJT && getMaximumJumpTableSize() == 0) + if (MaxJT && getMaximumJumpTableSize() == UINT_MAX) setMaximumJumpTableSize(MaxJT); setHasExtractBitsInsn(true);