================
@@ -1978,13 +1978,18 @@ void cir::TernaryOp::build(
   result.addOperands(cond);
   OpBuilder::InsertionGuard guard(builder);
   Region *trueRegion = result.addRegion();
-  Block *block = builder.createBlock(trueRegion);
+  builder.createBlock(trueRegion);
   trueBuilder(builder, result.location);
   Region *falseRegion = result.addRegion();
   builder.createBlock(falseRegion);
   falseBuilder(builder, result.location);
 
-  auto yield = dyn_cast<YieldOp>(block->getTerminator());
+  // Get result type from whichever branch has a yield (the other may have
+  // unreachable from a throw expression)
+  YieldOp yield = 
dyn_cast_or_null<YieldOp>(trueRegion->back().getTerminator());
----------------
andykaylor wrote:

```suggestion
  auto yield = 
dyn_cast_or_null<cir::YieldOp>(trueRegion->back().getTerminator());
```
We should get rid of `using namespace cir` throughout our code. We want uses of 
this namespace to be explicit.

https://github.com/llvm/llvm-project/pull/163580
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to