[PATCH] D79131: [IRBuilder] Don't crash when creating alloca/load/store in unparented block.

Mark Lacey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 16:46:16 PDT 2020


rudkx added a comment.

In the particular out-of-tree code I'm trying to fix up the issue isn't that you don't know what function the blocks will go into, more that you don't know at the point when the blocks are created whether they will end up getting inserted into the function at all, or where. Imagine something like:

  struct Blocks { BasicBlock *First, *Second, etc. };
  switch (condition) {
    case OneOfSeveral:
      Blocks = createBlocksForOptionOne(...);
      break;
   case TwoOfSeveral:
     Blocks = ...;
  }
  // ...
  // under the right conditions, call the function that inserts the blocks appropriately
  if (...) {
    InsertBlocks(Blocks);
  }

An alternative would be to insert all the blocks arbitrarily when they are created, the move them later.

If the general direction here is to just always require an alignment (which FWIW I think makes perfect sense), then I'll just do that in this code and move on.

Thanks for taking a look.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79131





More information about the llvm-commits mailing list