[PATCH] D144927: [GVNHoist] skip hoisting into blocks terminated by callbr

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 16:24:45 PST 2023


bjope added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVNHoist.cpp:888
+    // Don't hoist into CallBr terminated blocks.
+    if (isa<CallBrInst>(TI))
+      continue;
----------------
I think this is more restricted than needed. I mean, it could still be valid to hoist values into the CallBr terminated block if the hoisted instruction isn't using a value defined by the CallBr. That ofcourse also depends on if the CallBr might have other side effects or not. So ideally we would need to check if it is safe to hoist past the terminator and not only if it is safe to hoist to the end of BB.

It should at least be worth some more code comments here, explaining that we are conservative in this sense, to make a simple safe fix (while assuming that hoisting past a CallBr would be a quite rare opportunity anyway).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144927



More information about the llvm-commits mailing list