[llvm] [SPIR-V] Fix bad insertion for type/id MIR (PR #109686)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 13:15:09 PDT 2024
================
@@ -336,6 +347,7 @@ class SPIRVGlobalRegistry {
MachineFunction *setCurrentFunc(MachineFunction &MF) {
MachineFunction *Ret = CurMF;
CurMF = &MF;
+ LastInsertedType = nullptr;
----------------
VyacheslavLevytskyy wrote:
The problem here would be when a user of this function switches contexts between machine functions. After this change the context would be not only `MachineFunction *` that is returned, but also last inserted type position. See, for example:
https://github.com/llvm/llvm-project/blob/372611e186fc7eaea4f94c3ee7516d5d0e655dcd/llvm/lib/Target/SPIRV/SPIRVISelLowering.cpp#L291-L295
Here the context is switched between function definition/function call, and we would reset `LastInsertedType` to nullptr in both to/fro cases.
https://github.com/llvm/llvm-project/pull/109686
More information about the llvm-commits
mailing list