[PATCH] [Inlining] Teach the inliner pass to inline through statepoints.

Pat Gavlin pagavlin at microsoft.com
Wed Jun 24 15:21:09 PDT 2015


================
Comment at: include/llvm/IR/CallSite.h:107
@@ -105,1 +106,3 @@
 
+  FunTy *getMetaCallDestination() const {
+    FunTy *LiteralDest = getCalledFunction();
----------------
reames wrote:
> a) comments!  both here on getCalledFunction to distinguish
> b) naming - "meta" isn't real descriptive.  Possible getCalledFunctionUnwrapped?
This feels a bit ugly to me, esp. since the information about the location of the actual callee in the statepoint argument list is also present as a constant in Statepoint.h. Would it perhaps make sense to split StatepointBase into 2 types--a base type that provides argument accessors and can be included next to `CallSite`, and a derived type that provides `getRelocates()`?

Bikeshedding a bit, I'd probably also rename this to `getActualCalledFunction()` or similar.

================
Comment at: lib/Transforms/IPO/Inliner.cpp:139-145
@@ -136,2 +138,9 @@
   // inlined.
-  if (!InlineFunction(CS, IFI, InsertLifetime))
+  if (Statepoint SP = Statepoint(CS)) {
+    Callee = cast<Function>(SP.getActualCallee());
+    InlineResult = InlineFunction(SP, IFI, InsertLifetime);
+  } else {
+    Callee = CS.getCalledFunction();
+    InlineResult = InlineFunction(CS, IFI, InsertLifetime);
+  }
+
----------------
Should this simply be using `getMetaCallDestination()`?

================
Comment at: lib/Transforms/IPO/Inliner.cpp:457-473
@@ -446,1 +456,19 @@
 
+  class InlineTask {
+    Function *Callee;
+    Function *Caller;
+    CallSite CS;
+    int InlineHistoryID;
+
+  public:
+    explicit InlineTask(Function *Callee, Function *Caller, CallSite CS,
+                        int InlineHistoryID = -1)
+        : Callee(Callee), Caller(Caller), CS(CS),
+          InlineHistoryID(InlineHistoryID) {}
+
+    Function *getCalledFunction() const { return Callee; }
+    Function *getCaller() const { return Caller; }
+    CallSite getCallSite() const { return CS; }
+    int getInlineHistoryID() const { return InlineHistoryID; }
+  };
+
----------------
reames wrote:
> Again, it's really not clear to me that the extra level of abstraction is worthwhile here.  
This abstraction seems unnecessary: why not just `s/CS.getCalledFunction()/CS.getMetaCallDestination()`?

http://reviews.llvm.org/D10633

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list