KhronosGroup / SPIRV-LLVM-Translator

A tool and a library for bi-directional translation between SPIR-V and LLVM IR
Other
473 stars 211 forks source link

Start moving away from insert-before Instruction pointers #2498

Closed svenvh closed 5 months ago

svenvh commented 5 months ago

In preparation for LLVM's deprecation of Instruction constructors and Create methods that accept Instruction pointers, upgrade call sites to pass an iterator instead of an Instruction pointer.

This patch only upgrades constructor and Create calls that were trivial to upgrade with no impact on the test suite. Some calls remain to be upgraded as future work.

asudarsa commented 5 months ago

Thanks for looking into this @svenvh One quick comment (might be my ignorance). Do we need a nullptr check before dereferencing these pointers?

Thanks

svenvh commented 5 months ago

Yes, in most if not all cases, the variable is already dereferenced for getName, getOperand or replaceUsesOfWith calls.