================
@@ -1206,6 +1202,21 @@ 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)
+      assert(MDNode->getNumOperands() == 2 &&
----------------
llvm-beanz wrote:

You shouldn't put an `assert` as the only statement on an `if` block, it is 
better to fold it into the assert condition.

Today most C runtimes are nice about the `assert` macro defining to a no-op 
statement because the spec defines it as such, but people do replace `assert`, 
and lots of horrible things can happen if a single-statement `if`'s body is a 
macro expansion and the macro doesn't expand to a complete statement. Things 
like the _next_ statement becoming the body of the `if`.

https://github.com/llvm/llvm-project/pull/116331
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to