<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thanks for the fix, Fangrui.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 31, 2019 at 2:02 PM Fangrui Song via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Fangrui Song<br>
Date: 2019-10-31T14:02:29-07:00<br>
New Revision: 44d0c3d94775be2ec1947426a8483cd135d51625<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/44d0c3d94775be2ec1947426a8483cd135d51625" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/44d0c3d94775be2ec1947426a8483cd135d51625</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/44d0c3d94775be2ec1947426a8483cd135d51625.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/44d0c3d94775be2ec1947426a8483cd135d51625.diff</a><br>
<br>
LOG: [PGO][PGSO] Fix -DBUILD_SHARED_LIBS=on builds after D69580/llvmorg-10-init-8797-g0d987e411ac<br>
<br>
Move TargetLoweringBase::isSuitableForJumpTable from<br>
llvm/CodeGen/TargetLowering.h to .cpp, to avoid the undefined reference<br>
from all LLVM${Target}ISelLowering.cpp.<br>
<br>
Another fix is to add a dependency on TransformUtils to all<br>
lib/Target/$Target/LLVMBuild.txt, but that is too disruptive.<br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
llvm/include/llvm/CodeGen/TargetLowering.h<br>
llvm/lib/CodeGen/TargetLoweringBase.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h<br>
index a90b838c52e0..509ea65c4c0e 100644<br>
--- a/llvm/include/llvm/CodeGen/TargetLowering.h<br>
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h<br>
@@ -1032,27 +1032,8 @@ class TargetLoweringBase {<br>
/// Return true if lowering to a jump table is suitable for a set of case<br>
/// clusters which may contain \p NumCases cases, \p Range range of values.<br>
virtual bool isSuitableForJumpTable(const SwitchInst *SI, uint64_t NumCases,<br>
- uint64_t Range, ProfileSummaryInfo* PSI,<br>
- BlockFrequencyInfo *BFI) const {<br>
- // FIXME: This function check the maximum table size and density, but the<br>
- // minimum size is not checked. It would be nice if the minimum size is<br>
- // also combined within this function. Currently, the minimum size check is<br>
- // performed in findJumpTable() in SelectionDAGBuiler and<br>
- // getEstimatedNumberOfCaseClusters() in BasicTTIImpl.<br>
- const bool OptForSize = SI->getParent()->getParent()->hasOptSize() ||<br>
- llvm::shouldOptimizeForSize(SI->getParent(), PSI,<br>
- BFI);<br>
- const unsigned MinDensity = getMinimumJumpTableDensity(OptForSize);<br>
- const unsigned MaxJumpTableSize = getMaximumJumpTableSize();<br>
- <br>
- // Check whether the number of cases is small enough and<br>
- // the range is dense enough for a jump table.<br>
- if ((OptForSize || Range <= MaxJumpTableSize) &&<br>
- (NumCases * 100 >= Range * MinDensity)) {<br>
- return true;<br>
- }<br>
- return false;<br>
- }<br>
+ uint64_t Range, ProfileSummaryInfo *PSI,<br>
+ BlockFrequencyInfo *BFI) const;<br>
<br>
/// Return true if lowering to a bit test is suitable for a set of case<br>
/// clusters which contains \p NumDests unique destinations, \p Low and<br>
<br>
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp<br>
index 9b23012f47e3..cb95d47e598f 100644<br>
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp<br>
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp<br>
@@ -1456,6 +1456,28 @@ unsigned TargetLoweringBase::getVectorTypeBreakdown(LLVMContext &Context, EVT VT<br>
return NumVectorRegs;<br>
}<br>
<br>
+bool TargetLoweringBase::isSuitableForJumpTable(const SwitchInst *SI,<br>
+ uint64_t NumCases,<br>
+ uint64_t Range,<br>
+ ProfileSummaryInfo *PSI,<br>
+ BlockFrequencyInfo *BFI) const {<br>
+ // FIXME: This function check the maximum table size and density, but the<br>
+ // minimum size is not checked. It would be nice if the minimum size is<br>
+ // also combined within this function. Currently, the minimum size check is<br>
+ // performed in findJumpTable() in SelectionDAGBuiler and<br>
+ // getEstimatedNumberOfCaseClusters() in BasicTTIImpl.<br>
+ const bool OptForSize =<br>
+ SI->getParent()->getParent()->hasOptSize() ||<br>
+ llvm::shouldOptimizeForSize(SI->getParent(), PSI, BFI);<br>
+ const unsigned MinDensity = getMinimumJumpTableDensity(OptForSize);<br>
+ const unsigned MaxJumpTableSize = getMaximumJumpTableSize();<br>
+<br>
+ // Check whether the number of cases is small enough and<br>
+ // the range is dense enough for a jump table.<br>
+ return (OptForSize || Range <= MaxJumpTableSize) &&<br>
+ (NumCases * 100 >= Range * MinDensity);<br>
+}<br>
+<br>
/// Get the EVTs and ArgFlags collections that represent the legalized return<br>
/// type of the given function. This does not require a DAG or a return value,<br>
/// and is suitable for use before any DAGs for the function are constructed.<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>