[PATCH] Move easily derivable pointers optimization from CodeGenPrepare to RewriteStatepointPass

Igor Laevsky igor at azulsystems.com
Mon May 18 11:56:45 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp:1873
@@ +1872,3 @@
+
+  // Avoid rematerializing very long instruction chains to avoid code size
+  // problems
----------------
sanjoy wrote:
> igor-laevsky wrote:
> > sanjoy wrote:
> > > What is a situation where this guard will help?
> > In theory TTI functions can return zero cost. In that case it is possible to have very long instruction chain with estimated cost of zero. It does not seems very right. This is purely hypothetical and I don't think it is  very likely to happen on practice.
> But I'd say in those cases it should be perfectly okay to have a large chain.  Otherwise TTI is wrong. :)
> 
> Actually, I don't have strong objections to this part, but I think it is more sensible to have this as an optimization to reduce //compile time// -- in the caller, check if `Chain.size()` is higher than some threshold (`10` is good) and if so bail out of rewriting anything for the given `Chain`.
> 
> In either case, please add a test case that exercises this path.
I think it's ok for TTI function to return zero - they estimate only runtime cost. But since we are cloning instructions we also need to account compile time for them. 

I agree, this threshold fits for the caller better.

http://reviews.llvm.org/D9774

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






More information about the llvm-commits mailing list