[PATCH] D75381: [WinEH] Fix inttoptr+phi optimization in presence of catchswitch

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 14:27:32 PST 2020


rnk marked an inline comment as done.
rnk added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:222
+  // instruction, do not do it. Similarly, do not do the transform if the value
+  // is PHI in a block with no insertion point, since we will not be able to
+  // insert a cast after the PHI.
----------------
hfinkel wrote:
> When you say, "a block with no insertion point", I'd add, "for example, a catchswitch block." I don't think that it's otherwise obvious how one has a block with no insertion point.
Sure, will do.

---

I think when we added catchswitch, part of what we were thinking was that getFirstInsertionPt returns an iterator, and an end iterator is a valid iterator, so it wouldn't be unreasonable to expect callers to check them for validity. In practice, people expect the function to do what it says and return a suitable insertion point, and not a failure value.

At the time we considered adding a multi-unwind-destination version of invoke, but I considered it to be too radical. Instead we settled for this unwind-edge-multiplex instruction, catchswitch. Now we have callbr though, so we should rethink this sharp edge of our WinEH (wasm uses it too, I guess) representation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75381





More information about the llvm-commits mailing list