[clang] [llvm] [HLSL] Add support to branch/flatten attributes to switch (PR #131739)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 24 15:07:41 PDT 2025
================
@@ -91,6 +91,137 @@ if.end: ; preds = %if.else, %if.then
%3 = load i32, ptr %resp, align 4
ret i32 %3
}
+
+; CHECK: define i32 @flatten_switch(i32 %X)
+; CHECK-NOT: hlsl.controlflow.hint
+; CHECK: switch i32 %0, label %sw.epilog [
+; CHECK-NEXT: i32 0, label %sw.bb
+; CHECK-NEXT: i32 1, label %sw.bb1
+; CHECK-NEXT: i32 2, label %sw.bb2
+; CHECK-NEXT: ], !dx.controlflow.hints [[HINT_FLATTEN]]
----------------
joaosaffran wrote:
HINT_FLATTEN and HINT_BRANCH will be metadata nodes, I think in this example they will be !3 and !4
https://github.com/llvm/llvm-project/pull/131739
More information about the llvm-commits
mailing list