[llvm] 44d0c3d - [PGO][PGSO] Fix -DBUILD_SHARED_LIBS=on builds after D69580/llvmorg-10-init-8797-g0d987e411ac

Hiroshi Yamauchi via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 14:50:00 PDT 2019


Thanks for the fix, Fangrui.

On Thu, Oct 31, 2019 at 2:02 PM Fangrui Song via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

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


More information about the llvm-commits mailing list