[llvm-dev] Different internal representation of SwitchInst

Shawn Landden via llvm-dev llvm-dev at lists.llvm.org
Thu May 23 07:29:15 PDT 2019


SwitchInst is currently represented as paired operands, which is
internally a linked-list. This is not ideal, as these types are fixed
(APInt and BasicBlock), and there is also code of dubious quality that
doesn't really get that this is a linked list, like from
SwitchInst:removeCase:

  OL[NumOps-2].set(nullptr);
  OL[NumOps-2+1].set(nullptr);

I've already done quite a bit of work on the SwitchInst, and have much
more planned. I think the cases would be better represented by a
SmallArray<std::pair<APInt, BasicBlock*>, 4>.

Before I get time to jump in implement this, assuming I can probably
keep most of the interfaces, is there any reason this wouldn't work?

-Shawn Landden


More information about the llvm-dev mailing list