[PATCH] D139565: [IR] add new callbrpad instruction

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 14:56:24 PST 2022


efriedma added a comment.

> I think perhaps it makes sense to create transform machinery distinct from a pass.

Sure.

> GlobalISel cannot lower callbr today. See IRTranslator::translateCallBr. Is GlobalISel "driven" by SelectionDAGISel, (like SelectionDAG is?)

GlobalISel is completely separate; it doesn't use SelectionDAG infrastructure at all.  IRTranslator generates MachineInstrs using G_* instruction, then successive passes optimize and lower those instructions into native opcodes.  So unlike SelectionDAG, you can conveniently do cross-block transforms like splitting edges.  (There's a fallback mechanism, but that just basically invokes SelectionDAG from scratch for the whole function.)

> I'm not certain either; it looks like SelectionDAGISel::SelectAllBasicBlocks does a ReversePostOrderTraversal of the basic blocks of a function.

The point of this digression is just that it might be more straightforward to avoid depending on anything in particular being present in the FunctionLoweringInfo .

> Any thoughts on what this "token" should be? i.e. a new instruction, call to a new intrinsic, one entry phi with metadata, <other>?

Intrinsic is hopefully sufficient here.  (One entry PHI is very fragile, new instruction is a lot of work to implement.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139565



More information about the llvm-commits mailing list