[clang] [HLSL] add loop unroll (PR #93879)

David Peixotto via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 21:49:40 PDT 2024


================
@@ -635,6 +635,17 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
         Option = LoopHintAttr::UnrollCount;
         State = LoopHintAttr::Numeric;
       }
+    } else if (HLSLLoopHint) {
+      ValueInt = HLSLLoopHint->getDirective();
+      if (HLSLLoopHint->getSemanticSpelling() ==
+          HLSLLoopHintAttr::Spelling::Microsoft_unroll) {
+        if (ValueInt == 0)
+          State = LoopHintAttr::Enable;
+        if (ValueInt > 0) {
+          Option = LoopHintAttr::UnrollCount;
----------------
dmpots wrote:

That sounds like a good path forward to me. Change looks good overall.

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


More information about the cfe-commits mailing list