[PATCH] D98958: [NewPM] Disable non-trivial loop-unswitch on targets with divergence

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 10:01:35 PDT 2021


tra added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2907
+  // unswitching, which is useful for testing and debugging.
+  if ((!NonTrivial || TTI.hasBranchDivergence()) && !EnableNonTrivialUnswitch)
     return false;
----------------
rampitec wrote:
> Is this a correct condition? Double negative "!NonTrivial" = Trivial, right? Are we not doing trivial loop unswitching?
This should be a bit easier to read:

```
if (!(EnableNonTrivialUnswitch || 
      (NonTrivial && !TTI.hasBranchDivergence())))

```

Or, maybe extract part of the condition into a `bool ShouldUnswitch = NonTrivial && !TTI.hasBranchDivergence()`.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98958/new/

https://reviews.llvm.org/D98958



More information about the llvm-commits mailing list