[PATCH] D46203: [InstCombine] Widen guards with conditions between

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 14:36:06 PDT 2018


reames added a comment.

In https://reviews.llvm.org/D46203#1085980, @mkazantsev wrote:

> I would suggest a slightly different approach to handle such situations. Whenever we see consecutive guard followed by an instruction that is safe to speculate, we can just swap them. Doing so, we will collect all guards in one continuous sequence after all speculable code. And then we just fold consecutive pairs. What do you think about it?


I thought about this approach and I agree it's interesting.  It does have one serious problem I haven't quite figured out yet though which is that hoisting above the guard changes placement in the final lowered IR.  If we'd left it where it was, we might have been able to *sink* the instruction into a block with the only user.

My original plan was to do this patch, then spend more time thinking about the sinking problem.  If we can solve that, then I agree, hoisting over guards by default is probably the right long term answer.


Repository:
  rL LLVM

https://reviews.llvm.org/D46203





More information about the llvm-commits mailing list