[llvm] [SPIR-V] Add llvm.loop.unroll metadata lowering (PR #132062)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 08:27:06 PDT 2025


================
@@ -611,6 +611,40 @@ class SPIRVStructurizer : public FunctionPass {
       auto MergeAddress = BlockAddress::get(Merge->getParent(), Merge);
       auto ContinueAddress = BlockAddress::get(Continue->getParent(), Continue);
       SmallVector<Value *, 2> Args = {MergeAddress, ContinueAddress};
+      unsigned LC = SPIRV::LoopControl::None;
+      // Currently used only to store PartialCount value. Later when other
+      // LoopControls are added - this map should be sorted before making
+      // them loop_merge operands to satisfy 3.23. Loop Control requirements.
+      std::vector<std::pair<unsigned, unsigned>> MaskToValueMap;
----------------
Keenuts wrote:

Shall this be wrapped in a utility function?
```
SmallVector<unsigned, 1> getSpirvLoopControlOperandsFromLoopMetadata(Loop *L);
```

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


More information about the llvm-commits mailing list