[PATCH] D46706: [PM/LoopUnswitch] Support partial trivial unswitching.

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 10 20:43:32 PDT 2018


sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.

This lgtm.

Have you considered making full unswitching a special case for partial unswitching?  It seems like we could "partially unswitch" `br %loop_invariant, label %t, label %f` into `br true/false, label %t, label %f` and have a beefed up LoopSimplifyCFG clean this up?



================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:84
+  SmallVector<Value *, 4> Invariants;
+
+  // Build a worklist and recurse through operators collecting invariants.
----------------
Assert that `Root` is loop invariant?  That justifies why we're not adding it to `Invariants`.


Repository:
  rL LLVM

https://reviews.llvm.org/D46706





More information about the llvm-commits mailing list