[llvm] [MachineVerifier] Query TargetInstrInfo for PHI nodes. (PR #110507)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 08:41:29 PDT 2024


Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/110507 at github.com>


VyacheslavLevytskyy wrote:

In fact https://github.com/llvm/llvm-project/issues/108844 might have been worded as follows:
1. By definition [https://llvm.org/docs/CodeGenerator.html#instruction-selection-section] Instruction Selection results in target-specific machine instructions. It's the SPIR-V code set in our case.
2. According to the SPIR-V spec, OpPhi [https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpPhi] is used to implement the φ node in the SSA graph representing the function.
3. When Machine Verifier reports `Virtual register defs don't dominate all uses` applied to OpPhi, it is an issue in implementation of Machine Verifier, because this is reported **after** Instruction Selection and the SPIR-V spec considers this use valid.

In other words, it doesn't matter what is the difference between phi and OpPhi when we discuss this issue. Machine Verifier may not consider this a bad code, because Instruction Selection results in *target-specific* instructions, and by the SPIR-V spec (target-specific) OpPhi implements the φ node.

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


More information about the llvm-commits mailing list