[mlir] Implement conditional branch
This looks heavyweight but most of the code is in the massive number of operand accessors!
We need to be able to iterate over all operands to the condbr (all live-outs) but also just
the true/just the false operands too.
PiperOrigin-RevId: 205897704
diff --git a/include/mlir/IR/Builders.h b/include/mlir/IR/Builders.h
index e6e4e4d..ec9ce18 100644
--- a/include/mlir/IR/Builders.h
+++ b/include/mlir/IR/Builders.h
@@ -146,6 +146,13 @@
return insertTerminator(BranchInst::create(dest));
}
+ CondBranchInst *createCondBranchInst(CFGValue *condition,
+ BasicBlock *trueDest,
+ BasicBlock *falseDest) {
+ return insertTerminator(
+ CondBranchInst::create(condition, trueDest, falseDest));
+ }
+
private:
template <typename T>
T *insertTerminator(T *term) {