summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2018-08-01 08:02:40 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2018-08-01 08:02:40 +0000
commit8e70a95cbcef5291a220d1e5b18c8f8943611384 (patch)
tree3814277dcad379b48a4e19f454b3b2302bf69610 /include
parentf0efa56f8045811ef7e54fdaa39496d7f5cc6e58 (diff)
Revert "Enrich inline messages", tests fail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338496 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/InlineCost.h35
-rw-r--r--include/llvm/IR/DiagnosticInfo.h1
-rw-r--r--include/llvm/Transforms/Utils/Cloning.h18
3 files changed, 12 insertions, 42 deletions
diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h
index 529fb75bec9..8c412057fb8 100644
--- a/include/llvm/Analysis/InlineCost.h
+++ b/include/llvm/Analysis/InlineCost.h
@@ -74,15 +74,8 @@ class InlineCost {
/// The adjusted threshold against which this cost was computed.
const int Threshold;
- /// Must be set for Always and Never instances.
- const char *Reason = nullptr;
-
// Trivial constructor, interesting logic in the factory functions below.
- InlineCost(int Cost, int Threshold, const char *Reason = nullptr)
- : Cost(Cost), Threshold(Threshold), Reason(Reason) {
- assert((isVariable() || Reason) &&
- "Reason must be provided for Never or Always");
- }
+ InlineCost(int Cost, int Threshold) : Cost(Cost), Threshold(Threshold) {}
public:
static InlineCost get(int Cost, int Threshold) {
@@ -90,11 +83,11 @@ public:
assert(Cost < NeverInlineCost && "Cost crosses sentinel value");
return InlineCost(Cost, Threshold);
}
- static InlineCost getAlways(const char *Reason) {
- return InlineCost(AlwaysInlineCost, 0, Reason);
+ static InlineCost getAlways() {
+ return InlineCost(AlwaysInlineCost, 0);
}
- static InlineCost getNever(const char *Reason) {
- return InlineCost(NeverInlineCost, 0, Reason);
+ static InlineCost getNever() {
+ return InlineCost(NeverInlineCost, 0);
}
/// Test whether the inline cost is low enough for inlining.
@@ -119,30 +112,12 @@ public:
return Threshold;
}
- /// Get the reason of Always or Never.
- const char *getReason() const {
- assert((Reason || isVariable()) &&
- "InlineCost reason must be set for Always or Never");
- return Reason;
- }
-
/// Get the cost delta from the threshold for inlining.
/// Only valid if the cost is of the variable kind. Returns a negative
/// value if the cost is too high to inline.
int getCostDelta() const { return Threshold - getCost(); }
};
-/// InlineResult is basically true or false. For false results the message
-/// describes a reason why it is decided not to inline.
-struct InlineResult {
- const char *message = nullptr;
- InlineResult(bool result, const char *message = nullptr)
- : message(result ? nullptr : (message ? message : "cost > threshold")) {}
- InlineResult(const char *message = nullptr) : message(message) {}
- operator bool() const { return !message; }
- operator const char *() const { return message; }
-};
-
/// Thresholds to tune inline cost analysis. The inline cost analysis decides
/// the condition to apply a threshold and applies it. Otherwise,
/// DefaultThreshold is used. If a threshold is Optional, it is applied only
diff --git a/include/llvm/IR/DiagnosticInfo.h b/include/llvm/IR/DiagnosticInfo.h
index b8fdae2fcad..81d4ae84bf0 100644
--- a/include/llvm/IR/DiagnosticInfo.h
+++ b/include/llvm/IR/DiagnosticInfo.h
@@ -414,7 +414,6 @@ public:
Argument(StringRef Key, const Value *V);
Argument(StringRef Key, const Type *T);
Argument(StringRef Key, StringRef S);
- Argument(StringRef Key, const char *S) : Argument(Key, StringRef(S)) {};
Argument(StringRef Key, int N);
Argument(StringRef Key, float N);
Argument(StringRef Key, long N);
diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h
index e4d6053b70b..7531fb2d69b 100644
--- a/include/llvm/Transforms/Utils/Cloning.h
+++ b/include/llvm/Transforms/Utils/Cloning.h
@@ -22,7 +22,6 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/InlineCost.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
@@ -233,16 +232,13 @@ public:
/// and all varargs at the callsite will be passed to any calls to
/// ForwardVarArgsTo. The caller of InlineFunction has to make sure any varargs
/// are only used by ForwardVarArgsTo.
-InlineResult InlineFunction(CallInst *C, InlineFunctionInfo &IFI,
- AAResults *CalleeAAR = nullptr,
- bool InsertLifetime = true);
-InlineResult InlineFunction(InvokeInst *II, InlineFunctionInfo &IFI,
- AAResults *CalleeAAR = nullptr,
- bool InsertLifetime = true);
-InlineResult InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
- AAResults *CalleeAAR = nullptr,
- bool InsertLifetime = true,
- Function *ForwardVarArgsTo = nullptr);
+bool InlineFunction(CallInst *C, InlineFunctionInfo &IFI,
+ AAResults *CalleeAAR = nullptr, bool InsertLifetime = true);
+bool InlineFunction(InvokeInst *II, InlineFunctionInfo &IFI,
+ AAResults *CalleeAAR = nullptr, bool InsertLifetime = true);
+bool InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
+ AAResults *CalleeAAR = nullptr, bool InsertLifetime = true,
+ Function *ForwardVarArgsTo = nullptr);
/// Clones a loop \p OrigLoop. Returns the loop and the blocks in \p
/// Blocks.