[PATCH] D141203: [SPIR-V] Fix switch lowering with common compare register

Michal Paszkowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 7 11:11:08 PST 2023


mpaszkowski created this revision.
mpaszkowski added reviewers: iliya-diyachkov, konrad.trifunovic, andreytr, zuban32, rengolin, arsenm, MaskRay.
Herald added subscribers: StephenFan, ThomasRaoux, hiraditya.
Herald added a project: All.
mpaszkowski requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Often switches share a compare register. This is the case when the source code shares the same variable for multiple switches. For example, in CTS math_brute_force/pow test:

  size_t parity = ...
  ...
  switch( parity )
  {
      case 1:
          ...
      case 0:
          ...
  }
  ...
  switch( parity )
  {
      case 0:
          ...
      case 1:
          ...
  }

The virtual register representing the parity variable cannot be used for differentiating between switches (as it was done before).
This change removes this mapping of case values + target machine basic blocks to concrete switch compare registers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141203

Files:
  llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
  llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
  llvm/test/CodeGen/SPIRV/transcoding/Two_OpSwitch_same_register.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141203.487111.patch
Type: text/x-patch
Size: 12459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/a073b63c/attachment.bin>


More information about the llvm-commits mailing list