[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 22 14:37:56 PST 2024


================
@@ -1206,6 +1202,20 @@ class SPIRVStructurizer : public FunctionPass {
     AU.addPreserved<SPIRVConvergenceRegionAnalysisWrapperPass>();
     FunctionPass::getAnalysisUsage(AU);
   }
+
+  void createOpSelectMerge(IRBuilder<> *Builder, BlockAddress *MergeAddress) {
+    Instruction *BBTerminatorInst = Builder->GetInsertBlock()->getTerminator();
+
+    MDNode *MDNode = BBTerminatorInst->getMetadata("hlsl.controlflow.hint");
+    if (MDNode && MDNode->getNumOperands() != 2)
+      llvm_unreachable("invalid metadata hlsl.controlflow.hint");
----------------
llvm-beanz wrote:

This should be an assert, not a branch then unreachable.

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


More information about the cfe-commits mailing list