Skip to content

[SPIR-V] SPIRVGlobalRegistry::createOpType() doesn't ensure that iterator and machine basic block of the insertion point are consistent #120078

@VyacheslavLevytskyy

Description

@VyacheslavLevytskyy

One of SYCL CTS cases (group_barrier) fails to build due to inconsistency between iterator and machine basic block of the insertion point inside of SPIRVGlobalRegistry::createOpType(). The result is

llc: /localdisk2/vlevytsk/llvm-project/llvm/include/llvm/CodeGen/MachineBasicBlock.h:1020:
llvm::MachineBasicBlock::iterator llvm::MachineBasicBlock::insert(iterator, llvm::MachineInstr*):
Assertion `(I == end() || I->getParent() == this) && "iterator points outside of basic block"' failed.

Triaging shows that while SPIRVGlobalRegistry::createOpType() itself expects that users of this function are to insert definitions at the insertion point set by this utility function (that is always the first MBB), it might happen that the instruction gets relocated along its way through passes. This means that there is no guarantee for SPIRVGlobalRegistry::createOpType() to create a valid insertion point without additional checks before using one of previously stored positions.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions