[PATCH] D53744: [SimpleLoopUnswitch] Unswitch by experimental.guard intrinsics

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 03:04:43 PDT 2018


mkazantsev added inline comments.


================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2258-2265
+  // Whether or not we should also collect guards in the loop.
+  bool CollectGuards = false;
+  if (UnswitchGuards) {
+    auto *GuardDecl = L.getHeader()->getParent()->getParent()->getFunction(
+        Intrinsic::getName(Intrinsic::experimental_guard));
+    if (GuardDecl && !GuardDecl->use_empty())
+      CollectGuards = true;
----------------
chandlerc wrote:
> I assume this is trying to avoid the cost of looking for a guard intrinsic? We already walk all the instructions in the loop several times in this routine, so I'm not sure this matters much in practice. I'd just skip this and check the flag below.
Maybe we'll remove it in future, but I see no harm in it.


https://reviews.llvm.org/D53744





More information about the llvm-commits mailing list