diff options
author | Mircea Trofin <mtrofin@google.com> | 2020-01-28 13:36:46 -0800 |
---|---|---|
committer | Mircea Trofin <mtrofin@google.com> | 2020-01-28 13:38:45 -0800 |
commit | 7f434b91a95f71ccd775c0cc43a5bc6f7dd5b939 (patch) | |
tree | e9bf70bab91aac601f492b83ad8431132f08057d | |
parent | a2fb2c0ddca14c133f24d08af4a78b6a3d612ec6 (diff) | |
download | llvm-7f434b91a95f71ccd775c0cc43a5bc6f7dd5b939.zip llvm-7f434b91a95f71ccd775c0cc43a5bc6f7dd5b939.tar.gz llvm-7f434b91a95f71ccd775c0cc43a5bc6f7dd5b939.tar.bz2 |
[llvm] Ensure InlineCost-related fields are initialized
Summary: Small fix - never hurts to have things initialized.
Reviewers: davidxl, eraman
Reviewed By: davidxl
Subscribers: haicheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73420
-rw-r--r-- | llvm/include/llvm/Analysis/InlineCost.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h index f34708e..fcb6305 100644 --- a/llvm/include/llvm/Analysis/InlineCost.h +++ b/llvm/include/llvm/Analysis/InlineCost.h @@ -48,7 +48,7 @@ const int ColdccPenalty = 2000; /// Do not inline functions which allocate this many bytes on the stack /// when the caller is recursive. const unsigned TotalAllocaSizeRecursiveCaller = 1024; -} +} // namespace InlineConstants /// Represents the cost of inlining a function. /// @@ -61,16 +61,13 @@ const unsigned TotalAllocaSizeRecursiveCaller = 1024; /// directly tested to determine if inlining should occur given the cost and /// threshold for this cost metric. class InlineCost { - enum SentinelValues { - AlwaysInlineCost = INT_MIN, - NeverInlineCost = INT_MAX - }; + enum SentinelValues { AlwaysInlineCost = INT_MIN, NeverInlineCost = INT_MAX }; /// The estimated cost of inlining this callsite. - int Cost; + int Cost = 0; /// The adjusted threshold against which this cost was computed. - int Threshold; + int Threshold = 0; /// Must be set for Always and Never instances. const char *Reason = nullptr; @@ -96,9 +93,7 @@ public: } /// Test whether the inline cost is low enough for inlining. - explicit operator bool() const { - return Cost < Threshold; - } + explicit operator bool() const { return Cost < Threshold; } bool isAlways() const { return Cost == AlwaysInlineCost; } bool isNever() const { return Cost == NeverInlineCost; } @@ -160,7 +155,7 @@ public: struct InlineParams { /// The default threshold to start with for a callee. - int DefaultThreshold; + int DefaultThreshold = -1; /// Threshold to use for callees with inline hint. Optional<int> HintThreshold; @@ -240,6 +235,6 @@ getInlineCost(CallBase &Call, Function *Callee, const InlineParams &Params, /// Minimal filter to detect invalid constructs for inlining. InlineResult isInlineViable(Function &Callee); -} +} // namespace llvm #endif |