[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 02:58:29 PDT 2024


Keenuts wrote:

Ok, so I've figured out 3 issues:

1. A bug in my sorting of merge instructions. If LHS == RHS, I returned LHS < RHS, that was wrong. Executed outside of GDB, it was very slow to show the backtrace and crash, so tests looked like it was hanging, but it was just crashing.
2. An existing bug in the SPIRVPreLegalizer: the GET_ID instruction insertion point is wrong. Seems like I found a quick fix.
3. When SPIRVGlobalRegistry is used to create OpTypeBool, it creates it not in the main BB, but in the current location. Meaning if you then want this type on a BB located before the last insertion point, you'll end-up with a "use before declare".

Fixing those 3 allowed me to get later in the verification process. I now have 2 more types of issues:
- OpBranch/OpBranchConditional are not considered to be valid basic block terminators
- OpLoopMerge are taking BB operands, but verifier expected register operand.

I'd be tempted to fix the issue 1 (the actual iterator issue), but leave the rest unfixed in this PR (which is already huge).
Then, in distrinct PRs, fir 1 and 2, and then address the next ones.

https://github.com/llvm/llvm-project/pull/107408


More information about the cfe-commits mailing list