[PATCH] D52716: [Inliner] Penalise inlining of calls with loops at Oz

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 13:20:19 PDT 2018


dmgreen added a comment.

For loop-noinline.ll the "Simplified" instructions (the ones that cost nothing) appear to be:
br %body
3 x phis
one of the geps in the loop
the gep outside the loop
the ret

For the other testcase it's 8, again the 2 x unconditional branches, 3 x phis and 2 x geps + ret.

I guess we could argue the gep without a load isn't free, but I'm not sure why the other gep in the loop isn't free. In the second test case the two branches for the loop arn't free because they aren't fallthroughs, but that sounds tough to model.

Perhaps we could say that phis in loops have one "setup" cost? We would have to detect that the phi comes from a loop in that case.


https://reviews.llvm.org/D52716





More information about the llvm-commits mailing list