[PATCH] D52760: [SimplifyCFG] Change recursive calls to llvm::SimplifyCFG to instead call the "run" function on the SimplifyCFGOpt object

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 17:41:15 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: bogner, eli.friedman, reames.

The llvm::SimplifyCFG function creates a SimplifyCFGOpt object and calls run on it. There were numerous places reached from this run function that called back out llvm::SimplifyCFG which would create another SimplifyCFGOpt object. This is an inefficient use of stack space at minimum. We are also not passing along the LoopHeaders pointer passed into the outer llvm::SimplifyCFG call. So if its not null we lose it on the first recursion and get nullptr from there on.

This patch renames "SimplifyCFGOpt::run" to "SimplifyCFGOpt::simplify" and now calls that instead of llvm::SimplifyCFG. I had to move one static function into the class so that it would be able to call the method.


https://reviews.llvm.org/D52760

Files:
  lib/Transforms/Utils/SimplifyCFG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52760.167864.patch
Type: text/x-patch
Size: 9947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181002/a9d3195e/attachment.bin>


More information about the llvm-commits mailing list