[PATCH] D108087: [SimpleLoopUnswitch] Create SimpleLoopNestUnswitch pass

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 11:21:53 PDT 2021


Whitney added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2973
+  Instruction *BestUnswitchTI =
+      findBestUnswitchTI(L, DT, LI, AC, AA, TTI, SE, MSSAU, PartialIVInfo,
+                         ExitBlocks, BestUnswitchInvariants);
----------------
When given BestUnswitchTIForLoopNest, why do we want to findBestUnswitchTI?

When given BestUnswitchTIForLoopNest, this code only unswitch if BestUnswitchTIForLoopNest == findBestUnswitchTI. Is it possible that BestUnswitchTIForLoopNest != findBestUnswitchTI only have some loop level?


================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2976
+
+  if (BestUnswitchTI == nullptr)
+    return false;
----------------



================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2982
+  // unswitching.
+  if (BestUnswitchTIForLoopNest != nullptr &&
+      BestUnswitchTI != BestUnswitchTIForLoopNest)
----------------



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

https://reviews.llvm.org/D108087



More information about the llvm-commits mailing list