[PATCH] D22143: [SimplifyCFG] Rewrite SinkThenElseCodeToEnd
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 08:56:03 PDT 2016
jmolloy added a comment.
Sorry to hear this caused a regression; perhaps it's similar to https://llvm.org/bugs/show_bug.cgi?id=30188 ? There, improved SimplifyCFG confuses SROA.
SimplifyCFG's sinking logic was and is indeed dumb. It being run a million times is a dual-edged sword though - yes, complex algorithms are difficult to run in the time constraint but also you get many attempts at optimizing across the compilation pipeline. Code sinking is a really important optimization that I think really needs to be done multiple times during canonicalization as more opportunities are opened up (by CSE, InstCombine etc).
I think there's certainly an upside in implementing a better, higher runtime algorithm in something like GVN hoist, but I don't think that should replace the dumb logic in SimplifyCFG entirely. In fact, this rewrite makes it slightly less dumb at no extra algorithmic complexity, and the code you commented on (that is deliberately conservative) gets deleted in https://reviews.llvm.org/D23911 as it becomes no longer needed.
More information about the llvm-commits