[PATCH] D29016: [LoopUnswitch] Do not freeze condition if hoisted branch is guaranteed to be reachable

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 10:18:14 PST 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:631
+    // is needed.
+    bool NeedFreeze = true;
+    {
----------------
aqjune wrote:
> efriedma wrote:
> > Maybe we should be a little more aggressive here?  LoopUnswitch::TryTrivialLoopUnswitch has a branch-following loop which special-cases conditional branches with a constant condition.
> > 
> > Can we compute this once for the whole loop, rather than iterating over the whole loop for each basic block?
> @efriedma  Hello. I couldn't understand your comment. Do you mean we can cache the necessity of freeze when LoopUnswitch::TryTrivialLoopUnswitch is called (which is called at line 545), and then reuse the cached info here?
The two paragraphs are sort of separate issues: you should share the branch-following code, and you should compute this property outside of the loop.  I don't think you can reuse the result from TryTrivialLoopUnswitch because it isn't computing the same property.


https://reviews.llvm.org/D29016





More information about the llvm-commits mailing list